promptflow icon indicating copy to clipboard operation
promptflow copied to clipboard

[BUG] Index Lookup raises Exception in search_function_execution.

Open pkpsomas opened this issue 1 year ago • 7 comments

Description Index lookup step using Registered Inded and an existing index that works OK in Chat playground fails in prompt flow with the following error: Run failed: Exception: Exception occured in search_function_execution.

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 63, in telemetry_wrapper search_result = search_func(query) File "/azureml-envs/prompt-flow/runtime/lib/python3.9/site-packages/promptflow_vectordb/tool/common_index_lookup_extensions/acs.py", line 113, in wrapper results = search_func(query) File "/azureml-envs/prompt-flow/runtime/lib/python3.9/site-packages/langchain_community/vectorstores/azuresearch.py", line 524, in hybrid_search_with_score docs = [ File "/azureml-envs/prompt-flow/runtime/lib/python3.9/site-packages/langchain_community/vectorstores/azuresearch.py", line 527, in page_content=result.pop(FIELDS_CONTENT), KeyError: None

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_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 133, in search results = [ File "/azureml-envs/prompt-flow/runtime/lib/python3.9/site-packages/promptflow_vectordb/tool/common_index_lookup.py", line 133, in results = [ File "/azureml-envs/prompt-flow/runtime/lib/python3.9/concurrent/futures/_base.py", line 609, in result_iterator yield fs.pop().result() File "/azureml-envs/prompt-flow/runtime/lib/python3.9/concurrent/futures/_base.py", line 446, 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_vectordb/tool/common_index_lookup.py", line 63, in telemetry_wrapper search_result = search_func(query) 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_inner_execution.

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 556, 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 133, in search results = [ 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_execution.

How To Reproduce the bug Method 1: get a working Chat example with a Vector index and select Prompt Flow to Orchestrate and customize this setup with prompt flow. Method 2: create a flow by selecting "Multi-Round Q&A on Your Data"

Expected behavior Expected behaviours is the complete successfully the index lookup.

Screenshots image

Running Information(please complete the following information):

  • Azure AI Studio
  • Module: promptflow.tools.aoai

Additional context Add any other context about the problem here.

pkpsomas avatar Aug 27 '24 18:08 pkpsomas

True. Only appears when multiple fields are added to content in Field mapping. Change it to one, and it works alright.

vis23563456 avatar Sep 03 '24 16:09 vis23563456

True. Only appears when multiple fields are added to content in Field mapping. Change it to one, and it works alright.

I don't understand where the "multiple fields refer." Please give me more detailed description. Please note that the model was constructed automatically from a "Chat playground project" that works OK.

pkpsomas avatar Sep 03 '24 17:09 pkpsomas

I've got the same error when running the "Q&A on Your Data" out of the box flow together with AI search. My index lookup settings look the following:

Screenshot 2024-09-04 at 11 09 06

The error is a little more specific, namely keyerror 'content' is given.

tvdermeer avatar Sep 04 '24 09:09 tvdermeer

True. Only appears when multiple fields are added to content in Field mapping. Change it to one, and it works alright.

I don't understand where the "multiple fields refer." Please give me more detailed description. Please note that the model was constructed automatically from a "Chat playground project" that works OK.

@pkpsomas I agree that there is a discrepancy between chat playground and the prompt flow automatically created. By multiple fields, I mean image

This in the prompt flow, is reflected in 'acs_content_field' of the 'querySearchResource' as comma separated fields leading to an error. When you recreate the prompt flow but with only one content field selected in the 'add your data' section of the chat playground, it works fine. Definitely a bug.

vis23563456 avatar Sep 04 '24 09:09 vis23563456

I've got the same error when running the "Q&A on Your Data" out of the box flow together with AI search. My index lookup settings look the following:

Screenshot 2024-09-04 at 11 09 06

The error is a little more specific, namely keyerror 'content' is given.

I'm afraid, we'd need more information to debug. For starters, does the AI search index have the 'content' field?

vis23563456 avatar Sep 04 '24 09:09 vis23563456

image yes, these are there and available to choose from in the Index lookup GUI

tvdermeer avatar Sep 04 '24 09:09 tvdermeer

got it figured out. In the AI search settings, the content was not set as 'retrievable'. Changing this solved the issue for me

tvdermeer avatar Sep 17 '24 11:09 tvdermeer

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!

github-actions[bot] avatar Oct 17 '24 21:10 github-actions[bot]

I retested the functionality in the latest version, and it works OK.

pkpsomas avatar Oct 20 '24 09:10 pkpsomas