Closed Farid-Ullah closed 9 months ago
Thanks for reaching out.
Could you try using azure-search-documents 11.4.0 rather than 11.4.0b8?
Hi @Farid-Ullah. Thank you for opening this issue and giving us the opportunity to assist. To help our team better understand your issue and the details of your scenario please provide a response to the question asked above or the information requested above. This will help us more accurately address your issue.
@Farid-Ullah - can you check the stack trace you posted and make sure you didn't post sensitive information? I updated to REDACTED but you might want to rotate/invalidate your search API key.
Hi @xiangyan99 thank you for your answer , i changed the version but if i use the latest version or the version you mentioned it give me the same error as mentioned below.
error:
vector_search_configuration is not a known attribute of class <class 'azure.search.documents.indexes.models._index.SearchField'> and will be ignored
Hi @kristapratico Thanks for the prompt response on api key i have changed that. thank you
error: vector_search_configuration is not a known attribute of class <class 'azure.search.documents.indexes.models._index.SearchField'> and will be ignored
@Farid-Ullah that specific error was fixed in langchain in this PR: https://github.com/langchain-ai/langchain/pull/17599
The fix should be in the next release of langchain. As this doesn't seem to be a bug in the azure-search-documents, I'm going to mark this issue as addressed, but let us know if you're still running into errors.
Hi @Farid-Ullah. Thank you for opening this issue and giving us the opportunity to assist. We believe that this has been addressed. If you feel that further discussion is needed, please add a comment with the text "/unresolve" to remove the "issue-addressed" label and continue the conversation.
thanks @kristapratico for addressing this issue on langchain as i have tried whole day but it did not work for me this time i also tried with these new env spec:
langchain==0.1.4 langchain-community==0.0.20 langchain-core==0.1.23 langchain-experimental==0.0.49 langchain-openai==0.0.3
There is also one thing which is very import that the langchain official doc for AzureSearch has set many enviroment variables which is not working with latest version of langchain like 0.1.4 , 0.1.5
which i have tested with and we found out from error that we must use only two enviroment variable that is
so you can see official docs of langchain about Azure AI Search show many env which is outdated so the latest versions only work with the above two enviroment variables , also it did not work with openai embedding model only Azureopenai embdedding model will work.
lets see what they do for the error of azure search document once again thank you
We encountered a similar issue and found that the azure-search-documents version 11.4.0b8 worked well on a local Windows machine. However, when deployed to Azure Functions, it showed the mentioned error. For now, it's functioning in Azure Functions with version 11.4.0. Until a fix is available, we'll need to switch between these two versions.
I encountered the same issue on a docker image on ubuntu, but by following @amitkadu suggestion:
We encountered a similar issue and found that the azure-search-documents version 11.4.0b8 worked well on a local Windows machine. However, when deployed to Azure Functions, it showed the mentioned error. For now, it's functioning in Azure Functions with version 11.4.0. Until a fix is available, we'll need to switch between these two versions.
I cannot totally fix the issue. After analysing the dependencies I did a downgrade of azure core from 1.30.0 to 1.29.7 because it was the latest working setup.
Actually i fixed my requirements to:
@Farid-Ullah it looks like langchain did a release yesterday that contains the fix. I tested it and the following versions work for me:
langchain==0.1.8 azure-search-documents==11.4.0
Can you give it a try and let us know if it works for you?
There is also one thing which is very import that the langchain official doc for AzureSearch has set many enviroment variables which is not working with latest version of langchain like
0.1.4 , 0.1.5
which i have tested with and we found out from error that we must use only two enviroment variable that is
- os.environ["AZURE_OPENAI_API_KEY"] = "azure openai key"
- os.environ["AZURE_OPENAI_ENDPOINT"] = " end point"
so you can see official docs of langchain about Azure AI Search show many env which is outdated so the latest versions only work with the above two enviroment variables , also it did not work with openai embedding model only Azureopenai embdedding model will work.
Good call out, the docs for AzureSearch do seem to be outdated in that they seem to be targeting the older openai library (<1.x) which uses different environment variables than the updated v1.x version. I've opened an issue on langchain to update these docs: https://github.com/langchain-ai/langchain/issues/17818
@amitkadu @michelekorell you say you saw a similar issue - can you describe what error you are seeing?
Hi @Farid-Ullah, since you haven’t asked that we /unresolve
the issue, we’ll close this out. If you believe further discussion is needed, please add a comment /unresolve
to reopen the issue.
All problem is solved after langchain==0.1.8
version released
I'm still facing the same error on langchain==0.1.16 and azure-search-documents==11.4.0. Any idea what could be the issue?
Hi @Bharathi-A7 i think you should install latest version of both langchain and azure-search-documnet
like
pip install --no-cache-dir packagename
without mentioning versions
hi hope you doing well .
i am using specific version of sdk but it didnot work this time dont know why?
`--------------------------------------------------------------------------- ImportError Traceback (most recent call last) Cell In[7], line 5 1 # embeddings: OpenAIEmbeddings = OpenAIEmbeddings(deployment="embed-002", chunk_size=1) 4 index_name = "saa" ----> 5 vector_store: AzureSearch = AzureSearch( 6 azure_search_endpoint="https://xindex.search.windows.net/", 7 azure_search_key="REDACTED", 8 index_name=index_name, 9 embedding_function=embeddings.embed_query, 10 )
File d:\dev\Practice\Streaming-FASTAPI\env_latest\lib\site-packages\langchain_community\vectorstores\azuresearch.py:268, in AzureSearch.init(self, azure_search_endpoint, azure_search_key, index_name, embedding_function, search_type, semantic_configuration_name, fields, vector_search, semantic_configurations, scoring_profiles, default_scoring_profile, cors_options, **kwargs) 266 if "user_agent" in kwargs and kwargs["user_agent"]: 267 user_agent += " " + kwargs["user_agent"] --> 268 self.client = _get_search_client( 269 azure_search_endpoint, 270 azure_search_key, 271 index_name, 272 semantic_configuration_name=semantic_configuration_name, 273 fields=fields, 274 vector_search=vector_search, 275 semantic_configurations=semantic_configurations, 276 scoring_profiles=scoring_profiles, 277 default_scoring_profile=default_scoring_profile, 278 default_fields=default_fields, 279 user_agent=user_agent, 280 cors_options=cors_options, 281 ) 282 self.search_type = search_type 283 self.semantic_configuration_name = semantic_configuration_name
File d:\dev\Practice\Streaming-FASTAPI\env_latest\lib\site-packages\langchain_community\vectorstores\azuresearch.py:84, in _get_search_client(endpoint, key, index_name, semantic_configuration_name, fields, vector_search, semantic_configurations, scoring_profiles, default_scoring_profile, default_fields, user_agent, cors_options) 82 from azure.search.documents import SearchClient 83 from azure.search.documents.indexes import SearchIndexClient ---> 84 from azure.search.documents.indexes.models import ( 85 ExhaustiveKnnAlgorithmConfiguration, 86 ExhaustiveKnnParameters, 87 HnswAlgorithmConfiguration, 88 HnswParameters, 89 SearchIndex, 90 SemanticConfiguration, 91 SemanticField, 92 SemanticPrioritizedFields, 93 SemanticSearch, 94 VectorSearchAlgorithmKind, 95 VectorSearchAlgorithmMetric, 96 VectorSearchProfile, 97 ) 99 default_fields = default_fields or [] 100 if key is None:
ImportError: cannot import name 'ExhaustiveKnnAlgorithmConfiguration' from 'azure.search.documents.indexes.models' (d:\dev\Practice\Streaming-FASTAPI\env_latest\lib\site-packages\azure\search\documents\indexes\models__init__.py)`
i also tried upgraded version but that did not work only this version of sdk work for me but this time it giving me error.
my env spec:
python 3.10, langchain0.1.5 azure-identity==1.14.0 azure-search-documents==11.4.0b8