langchain-ai / langchain

🦜🔗 Build context-aware reasoning applications
https://python.langchain.com
MIT License
88.33k stars 13.86k forks source link

DOC: Azure Cosmos DB No SQL #23018

Open Hela-Masri-shift opened 1 week ago

Hela-Masri-shift commented 1 week ago

URL

https://python.langchain.com/v0.2/docs/integrations/vectorstores/azure_cosmos_db_no_sql/

Checklist

Issue with current documentation:

The current code does not work, it fails on document insertion with the following error TypeError: AzureCosmosDBNoSqlVectorSearch._from_kwargs() missing 1 required keyword-only argument: 'cosmos_database_properties'

Idea or request for content:

No response

AnuragSa commented 1 week ago

I am facing same issue

DamirZelenic commented 1 week ago

Looks like we need to define:

cosmos_database_properties = {"id": cosmos_database_name}

and then:

vector_search = AzureCosmosDBNoSqlVectorSearch.from_documents( documents=docs, embedding=openai_embeddings, cosmos_client=cosmos_client, database_name=cosmos_database_name, container_name=cosmos_container_name, vector_embedding_policy=vector_embedding_policy, indexing_policy=indexing_policy, cosmos_container_properties=cosmos_container_properties, cosmos_database_properties=cosmos_database_properties,)

Regards, Damir