community[patch]: Fixing some caching issues for AzureCosmosDBSemanticCache (#18884)

Fixing some issues for AzureCosmosDBSemanticCache
- Added the entry for "AzureCosmosDBSemanticCache" which was missing in
langchain/cache.py
- Added application name when creating the MongoClient for the
AzureCosmosDBVectorSearch, for tracking purposes.

@baskaryan, can you please review this PR, we need this to go in asap.
These are just small fixes which we found today in our testing.
This commit is contained in:
Aayush Kataria
2024-03-25 19:06:17 -07:00
committed by GitHub
parent a6cbb755a7
commit 03c38005cb
6 changed files with 84 additions and 62 deletions

View File

@@ -35,6 +35,7 @@ m = 16
ef_construction = 64
ef_search = 40
score_threshold = 0.1
application_name = "LANGCHAIN_PYTHON"
def prepare_collection() -> Any:
@@ -108,6 +109,7 @@ class TestAzureCosmosDBVectorSearch:
azure_openai_embeddings,
collection=collection,
index_name=INDEX_NAME,
application_name=application_name,
)
sleep(1) # waits for Cosmos DB to save contents to the collection
@@ -911,6 +913,7 @@ class TestAzureCosmosDBVectorSearch:
NAMESPACE,
azure_openai_embeddings,
index_name=INDEX_NAME,
application_name=application_name,
)
)
@@ -926,6 +929,7 @@ class TestAzureCosmosDBVectorSearch:
NAMESPACE,
azure_openai_embeddings,
index_name=INDEX_NAME,
application_name=application_name,
)
)