Added a index lookup to prompt flow in azure ai studio and while executing that getting error:Run failed: Exception: Exception occured in search_function_construction.

Ramachandran, Sriram (Cognizant) 5 Reputation points
2024-12-24T07:18:18.4166667+00:00

un failed: Exception: Exception occured in search_function_construction. Traceback (most recent call last): File "/azureml-envs/prompt-flow/runtime/lib/python3.9/site-packages/pydantic/_internal/_generate_schema.py", line 864, in _resolve_forward_ref obj = _typing_extra.eval_type_backport(obj, globalns=self._types_namespace) File "/azureml-envs/prompt-flow/runtime/lib/python3.9/site-packages/pydantic/_internal/_typing_extra.py", line 279, in eval_type_backport return _eval_type_backport(value, globalns, localns, type_params) File "/azureml-envs/prompt-flow/runtime/lib/python3.9/site-packages/pydantic/_internal/_typing_extra.py", line 303, in _eval_type_backport return _eval_type(value, globalns, localns, type_params) File "/azureml-envs/prompt-flow/runtime/lib/python3.9/site-packages/pydantic/_internal/_typing_extra.py", line 332, in _eval_type return typing._eval_type( # type: ignore File "/azureml-envs/prompt-flow/runtime/lib/python3.9/typing.py", line 292, in _eval_type return t._evaluate(globalns, localns, recursive_guard) File "/azureml-envs/prompt-flow/runtime/lib/python3.9/typing.py", line 554, in _evaluate eval(self.forward_code, globalns, localns), File "<string>", line 1, in <module> NameError: name 'AzureSearch' is not defined 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 56, 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 46, in build_search_func store = index.as_langchain_vectorstore(credential=DefaultAzureCredential()) File "/azureml-envs/prompt-flow/runtime/lib/python3.9/site-packages/azureml/rag/mlindex.py", line 197, in as_langchain_vectorstore azuresearch = _get_azuresearch_module_instance(langchain_pkg_version) File "/azureml-envs/prompt-flow/runtime/lib/python3.9/site-packages/azureml/rag/utils/acs.py", line 21, in _get_azuresearch_module_instance azuresearch.AzureSearchVectorStoreRetriever.model_rebuild() File "/azureml-envs/prompt-flow/runtime/lib/python3.9/site-packages/pydantic/main.py", line 563, in model_rebuild return _model_construction.complete_model_class( File "/azureml-envs/prompt-flow/runtime/lib/python3.9/site-packages/pydantic/_internal/_model_construction.py", line 577, in complete_model_class schema = cls.get_pydantic_core_schema(cls, handler) File "/azureml-envs/prompt-flow/runtime/lib/python3.9/site-packages/pydantic/main.py", line 671, in get_pydantic_core_schema return handler(source) File "/azureml-envs/prompt-flow/runtime/lib/python3.9/site-packages/pydantic/_internal/_schema_generation_shared.py", line 83, in call schema = self._handler(source_type) File "/azureml-envs/prompt-flow/runtime/lib/python3.9/site-packages/pydantic/_internal/_generate_schema.py", line 655, in generate_schema schema = self._generate_schema_inner(obj) File "/azureml-envs/prompt-flow/runtime/lib/python3.9/site-packages/pydantic/_internal/_generate_schema.py", line 924, in _generate_schema_inner return self._model_schema(obj) File "/azureml-envs/prompt-flow/runtime/lib/python3.9/site-packages/pydantic/_internal/_generate_schema.py", line 739, in _model_schema {k: self._generate_md_field_schema(k, v, decorators) for k, v in fields.items()}, File "/azureml-envs/prompt-flow/runtime/lib/python3.9/site-packages/pydantic/_internal/_generate_schema.py", line 739, in <dictcomp> {k: self._generate_md_field_schema(k, v, decorators) for k, v in fields.items()}, File "/azureml-envs/prompt-flow/runtime/lib/python3.9/site-packages/pydantic/_internal/_generate_schema.py", line 1115, in _generate_md_field_schema common_field = self._common_field_schema(name, field_info, decorators) File "/azureml-envs/prompt-flow/runtime/lib/python3.9/site-packages/pydantic/_internal/_generate_schema.py", line 1308, in _common_field_schema schema = self._apply_annotations( File "/azureml-envs/prompt-flow/runtime/lib/python3.9/site-packages/pydantic/_internal/_generate_schema.py", line 2107, in _apply_annotations schema = get_inner_schema(source_type) File "/azureml-envs/prompt-flow/runtime/lib/python3.9/site-packages/pydantic/_internal/_schema_generation_shared.py", line 83, in call schema = self._handler(source_type) File "/azureml-envs/prompt-flow/runtime/lib/python3.9/site-packages/pydantic/_internal/_generate_schema.py", line 2088, in inner_handler schema = self._generate_schema_inner(obj) File "/azureml-envs/prompt-flow/runtime/lib/python3.9/site-packages/pydantic/_internal/_generate_schema.py", line 918, in _generate_schema_inner return self.generate_schema(self._resolve_forward_ref(obj)) File "/azureml-envs/prompt-flow/runtime/lib/python3.9/site-packages/pydantic/_internal/_generate_schema.py", line 866, in _resolve_forward_ref raise PydanticUndefinedAnnotation.from_name_error(e) from e pydantic.errors.PydanticUndefinedAnnotation: name 'AzureSearch' is not defined For further information visit https://errors.pydantic.dev/2.9/u/undefined-annotation 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 557, 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 170, 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 56, 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

Azure AI services
Azure AI services
A group of Azure services, SDKs, and APIs designed to make apps more intelligent, engaging, and discoverable.
3,000 questions
{count} votes

1 answer

Sort by: Most helpful
  1. Saideep Anchuri 590 Reputation points Microsoft Vendor
    2024-12-24T09:44:07.2633333+00:00

    Hi Ramachandran, Sriram (Cognizant)

    Welcome to Microsoft Q&A Forum, thank you for posting your query here!

    I understand that you are encountering an issue It seems new prompt flow version is creating issues (import failures here). Could you change to previous stable prompt flow runtime in flow.dag.yaml.

    environment:
     image: base image built from stable promptflow and saved in container registry          python_requirements_txt: requirements.txt                  
    

    Kindly refer the below documentation: https://learn.microsoft.com/en-us/azure/ai-studio/how-to/create-manage-compute-session#change-the-base-image

    Hope this helps. Do let us know if you any further queries.


    If this answers your query, do click Accept Answer and Yes for was this answer helpful. And, if you have any further query do let us know.

    Thank You.


Your answer

Answers can be marked as Accepted Answers by the question author, which helps users to know the answer solved the author's problem.