Giter VIP home page Giter VIP logo

Comments (8)

adamdougal avatar adamdougal commented on July 20, 2024

I've been playing around with this test with my flow.dag.yml and it looks like where it's falling down is in flow.py:get_connection_names() where it does not inspect the mlindex_content.

I'm not sure if the code has changed to break this, if the generated flow.dag.yml interface has changed or perhaps this has never worked? Or maybe I'm doing something wrong!

from promptflow.

adamdougal avatar adamdougal commented on July 20, 2024

Looks like there has been a change to this recently https://learn.microsoft.com/en-us/azure/machine-learning/prompt-flow/tools-reference/index-lookup-tool?view=azureml-api-2#how-to-migrate-from-legacy-tools-to-the-index-lookup-tool.

from promptflow.

pgr-lopes avatar pgr-lopes commented on July 20, 2024

Pretty sure you hit the same problem I did: #2876

You have to do the metadata account set manually, for whatever reason the activity is not taking the config.json file into consideration:

az login
az account set --subscription <subscription_id>
az configure --defaults group=<resource_group_name> workspace=<workspace_name>

from promptflow.

adamdougal avatar adamdougal commented on July 20, 2024

I've hardcoded a connection in the flow.dag.yml which has got me further.

I am now getting a response of:

{"error":{"code":"UserError","message":"Execution failure in 'index_lookup': (Exception) Exception occured in search_function_construction."}}

I have also deployed this to an AML endpoint using the deploy button in AML and get the same error there.

As it stands, from what I can tell, using Azure AI Search with Prompt Flow is currently unusable unless invoked from AML Studio.

from promptflow.

brynn-code avatar brynn-code commented on July 20, 2024

The response didn't show the full error reason, you could reach the error detail from the app service's container logs.
If the error caused by connection missing, I could explain more about the connections when deploy to app service.

When deploying to Azure App service, promptflow will use connection locally ( here the locally means the connections meta stored in local sqlite ), I took a look at your flow, there are 2 connections, the AI search one and the OpenAI one. If you wanna use Azure AI connections which stored in the Azure AI project, please set the connection provider config to let promptflow fetching Azure AI connections ( you may need to add command in the container startup script, also remember to add the app service as reader roles to your AI project to access the connection keys ). Refer to here for the connection config.

from promptflow.

brynn-code avatar brynn-code commented on July 20, 2024

Usually we won't assume user is deploying app service with AzureAI connections, that will cause many problems, like the permission, the service principal role, balabala, so by default we will guide user setup connections again for there app service locally by setting the app service environment variables. The locally setup guides you could reach via the following documentation:
https://microsoft.github.io/promptflow/cloud/azureai/deploy-to-azure-appservice.html#view-and-test-the-web-app

from promptflow.

adamdougal avatar adamdougal commented on July 20, 2024

Heya, thanks for your response! Unfortunately, even after setting the connection.provider=local setting, it does not pick up the AI Search connection unless I manually add it to the flow.dag.yaml.

Regarding the Exception occured in search_function_construction error. I get this both locally and when the flow is deployed as an AML endpoint. Here is the exception from the logs:

[2024-05-21 07:14:14,056][flowinvoker][ERROR] - Flow run failed with error: {'message': "Execution failure in 'index_lookup': (Exception) Exception occured in search_function_construction.", 'messageFormat': "Execution failure in '{node_name}'.", 'messageParameters': {'node_name': 'index_lookup'}, 'referenceCode': 'Tool/promptflow_vectordb.tool.common_index_lookup', 'code': 'UserError', 'innerError': {'code': 'ToolExecutionError', 'innerError': None}, 'additionalInfo': [{'type': 'ToolExecutionErrorDetails', 'info': {'type': 'Exception', 'message': 'Exception occured in search_function_construction.', 'traceback': 'Traceback (most recent call last):
  File "/azureml-envs/prompt-flow/runtime/lib/python3.9/site-packages/promptflow_vectordb/tool/utils/profiling.py", line 18, in measure_execution_time
    yield
  File "/azureml-envs/prompt-flow/runtime/lib/python3.9/site-packages/promptflow_vectordb/tool/common_index_lookup.py", line 54, in _get_search_func
    search_func = build_search_func(index, top_k, query_type)
  File "/azureml-envs/prompt-flow/runtime/lib/python3.9/site-packages/promptflow_vectordb/tool/common_index_lookup_extensions/utils.py", line 37, in build_search_func
    store = index.as_langchain_vectorstore()
  File "/azureml-envs/prompt-flow/runtime/lib/python3.9/site-packages/azureml/rag/mlindex.py", line 212, in as_langchain_vectorstore
    return azuresearch.AzureSearch(
  File "/azureml-envs/prompt-flow/runtime/lib/python3.9/site-packages/langchain_community/vectorstores/azuresearch.py", line 268, in __init__
    self.client = _get_search_client(
  File "/azureml-envs/prompt-flow/runtime/lib/python3.9/site-packages/langchain_community/vectorstores/azuresearch.py", line 84, in _get_search_client
    from azure.search.documents.indexes.models import (
ImportError: cannot import name \'ExhaustiveKnnAlgorithmConfiguration\' from \'azure.search.documents.indexes.models\' (/azureml-envs/prompt-flow/runtime/lib/python3.9/site-packages/azure/search/documents/indexes/models/__init__.py)

The above exception was the direct cause of the following exception:

Traceback (most recent call last):
  File "/azureml-envs/prompt-flow/runtime/lib/python3.9/site-packages/promptflow/tracing/_trace.py", line 470, in wrapped
    output = func(*args, **kwargs)
  File "/azureml-envs/prompt-flow/runtime/lib/python3.9/site-packages/promptflow_vectordb/core/logging/utils.py", line 98, in wrapper
    res = func(*args, **kwargs)
  File "/azureml-envs/prompt-flow/runtime/lib/python3.9/site-packages/promptflow_vectordb/tool/common_index_lookup.py", line 125, in search
    search_func = _get_search_func(mlindex_content, top_k, query_type)
  File "/azureml-envs/prompt-flow/runtime/lib/python3.9/site-packages/promptflow_vectordb/tool/common_index_lookup.py", line 54, in _get_search_func
    search_func = build_search_func(index, top_k, query_type)
  File "/azureml-envs/prompt-flow/runtime/lib/python3.9/contextlib.py", line 137, in __exit__
    self.gen.throw(typ, value, traceback)
  File "/azureml-envs/prompt-flow/runtime/lib/python3.9/site-packages/promptflow_vectordb/tool/utils/profiling.py", line 21, in measure_execution_time
    raise Exception(error_msg) from e
Exception: Exception occured in search_function_construction.
', 'filename': '/azureml-envs/prompt-flow/runtime/lib/python3.9/site-packages/promptflow_vectordb/tool/utils/profiling.py', 'lineno': 21, 'name': 'measure_execution_time'}}], 'debugInfo': {'type': 'ToolExecutionError', 'message': "Execution failure in 'index_lookup': (Exception) Exception occured in search_function_construction.", 'stackTrace': '
The above exception was the direct cause of the following exception:

Traceback (most recent call last):
  File "/azureml-envs/prompt-flow/runtime/lib/python3.9/site-packages/promptflow/executor/flow_executor.py", line 1008, in _exec
    output, aggregation_inputs = self._exec_inner_with_trace(
  File "/azureml-envs/prompt-flow/runtime/lib/python3.9/site-packages/promptflow/executor/flow_executor.py", line 913, in _exec_inner_with_trace
    output, nodes_outputs = self._traverse_nodes(inputs, context)
  File "/azureml-envs/prompt-flow/runtime/lib/python3.9/site-packages/promptflow/executor/flow_executor.py", line 1189, in _traverse_nodes
    nodes_outputs, bypassed_nodes = self._submit_to_scheduler(context, inputs, batch_nodes)
  File "/azureml-envs/prompt-flow/runtime/lib/python3.9/site-packages/promptflow/executor/flow_executor.py", line 1244, in _submit_to_scheduler
    return scheduler.execute(self._line_timeout_sec)
  File "/azureml-envs/prompt-flow/runtime/lib/python3.9/site-packages/promptflow/executor/_flow_nodes_scheduler.py", line 131, in execute
    raise e
  File "/azureml-envs/prompt-flow/runtime/lib/python3.9/site-packages/promptflow/executor/_flow_nodes_scheduler.py", line 113, in execute
    self._dag_manager.complete_nodes(self._collect_outputs(completed_futures))
  File "/azureml-envs/prompt-flow/runtime/lib/python3.9/site-packages/promptflow/executor/_flow_nodes_scheduler.py", line 160, in _collect_outputs
    each_node_result = each_future.result()
  File "/azureml-envs/prompt-flow/runtime/lib/python3.9/concurrent/futures/_base.py", line 439, in result
    return self.__get_result()
  File "/azureml-envs/prompt-flow/runtime/lib/python3.9/concurrent/futures/_base.py", line 391, in __get_result
    raise self._exception
  File "/azureml-envs/prompt-flow/runtime/lib/python3.9/concurrent/futures/thread.py", line 58, in run
    result = self.fn(*self.args, **self.kwargs)
  File "/azureml-envs/prompt-flow/runtime/lib/python3.9/site-packages/promptflow/executor/_flow_nodes_scheduler.py", line 181, in _exec_single_node_in_thread
    result = context.invoke_tool(node, f, kwargs=kwargs)
  File "/azureml-envs/prompt-flow/runtime/lib/python3.9/site-packages/promptflow/_core/flow_execution_context.py", line 90, in invoke_tool
    result = self._invoke_tool_inner(node, f, kwargs)
  File "/azureml-envs/prompt-flow/runtime/lib/python3.9/site-packages/promptflow/_core/flow_execution_context.py", line 206, in _invoke_tool_inner
    raise ToolExecutionError(node_name=node_name, module=module) from e
', 'innerException': {'type': 'Exception', 'message': 'Exception occured in search_function_construction.', 'stackTrace': '
The above exception was the direct cause of the following exception:

Traceback (most recent call last):
  File "/azureml-envs/prompt-flow/runtime/lib/python3.9/site-packages/promptflow/_core/flow_execution_context.py", line 182, in _invoke_tool_inner
    return f(**kwargs)
  File "/azureml-envs/prompt-flow/runtime/lib/python3.9/site-packages/promptflow/tracing/_trace.py", line 470, in wrapped
    output = func(*args, **kwargs)
  File "/azureml-envs/prompt-flow/runtime/lib/python3.9/site-packages/promptflow_vectordb/core/logging/utils.py", line 98, in wrapper
    res = func(*args, **kwargs)
  File "/azureml-envs/prompt-flow/runtime/lib/python3.9/site-packages/promptflow_vectordb/tool/common_index_lookup.py", line 125, in search
    search_func = _get_search_func(mlindex_content, top_k, query_type)
  File "/azureml-envs/prompt-flow/runtime/lib/python3.9/site-packages/promptflow_vectordb/tool/common_index_lookup.py", line 54, in _get_search_func
    search_func = build_search_func(index, top_k, query_type)
  File "/azureml-envs/prompt-flow/runtime/lib/python3.9/contextlib.py", line 137, in __exit__
    self.gen.throw(typ, value, traceback)
  File "/azureml-envs/prompt-flow/runtime/lib/python3.9/site-packages/promptflow_vectordb/tool/utils/profiling.py", line 21, in measure_execution_time
    raise Exception(error_msg) from e
', 'innerException': {'type': 'ImportError', 'message': "cannot import name 'ExhaustiveKnnAlgorithmConfiguration' from 'azure.search.documents.indexes.models' (/azureml-envs/prompt-flow/runtime/lib/python3.9/site-packages/azure/search/documents/indexes/models/__init__.py)", 'stackTrace': 'Traceback (most recent call last):
  File "/azureml-envs/prompt-flow/runtime/lib/python3.9/site-packages/promptflow_vectordb/tool/utils/profiling.py", line 18, in measure_execution_time
    yield
  File "/azureml-envs/prompt-flow/runtime/lib/python3.9/site-packages/promptflow_vectordb/tool/common_index_lookup.py", line 54, in _get_search_func
    search_func = build_search_func(index, top_k, query_type)
  File "/azureml-envs/prompt-flow/runtime/lib/python3.9/site-packages/promptflow_vectordb/tool/common_index_lookup_extensions/utils.py", line 37, in build_search_func
    store = index.as_langchain_vectorstore()
  File "/azureml-envs/prompt-flow/runtime/lib/python3.9/site-packages/azureml/rag/mlindex.py", line 212, in as_langchain_vectorstore
    return azuresearch.AzureSearch(
  File "/azureml-envs/prompt-flow/runtime/lib/python3.9/site-packages/langchain_community/vectorstores/azuresearch.py", line 268, in __init__
    self.client = _get_search_client(
  File "/azureml-envs/prompt-flow/runtime/lib/python3.9/site-packages/langchain_community/vectorstores/azuresearch.py", line 84, in _get_search_client
    from azure.search.documents.indexes.models import (
', 'innerException': None}}}}

from promptflow.

github-actions avatar github-actions commented on July 20, 2024

Hi, we're sending this friendly reminder because we haven't heard back from you in 30 days. We need more information about this issue to help address it. Please be sure to give us your input. If we don't hear back from you within 7 days of this comment, the issue will be automatically closed. Thank you!

from promptflow.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.