From 389771ccc0dc719d66a969f998d3b7316f78f8a1 Mon Sep 17 00:00:00 2001 From: Daniel Birn Date: Thu, 31 Oct 2024 19:36:02 +0100 Subject: [PATCH] community: fix @embeddingKey in azure cosmos db no sql (#27377) I will keep this PR as small as the changes made. **Description:** fixes a fatal bug syntax error in AzureCosmosDBNoSqlVectorSearch **Issue:** #27269 #25468 --- .../vectorstores/azure_cosmos_db_no_sql.py | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/libs/community/langchain_community/vectorstores/azure_cosmos_db_no_sql.py b/libs/community/langchain_community/vectorstores/azure_cosmos_db_no_sql.py index 8a671da921c..2317af9da02 100644 --- a/libs/community/langchain_community/vectorstores/azure_cosmos_db_no_sql.py +++ b/libs/community/langchain_community/vectorstores/azure_cosmos_db_no_sql.py @@ -274,15 +274,15 @@ class AzureCosmosDBNoSqlVectorSearch(VectorStore): query += "TOP @limit " query += ( - "c.id, c.{}, c.text, c.metadata, " - "VectorDistance(c.@embeddingKey, @embeddings) AS SimilarityScore FROM c" + "c.id, c[@embeddingKey], c.text, c.metadata, " + "VectorDistance(c[@embeddingKey], @embeddings) AS SimilarityScore FROM c" ) # Add where_clause if specified if pre_filter is not None and pre_filter.get("where_clause") is not None: query += " {}".format(pre_filter["where_clause"]) - query += " ORDER BY VectorDistance(c.@embeddingKey, @embeddings)" + query += " ORDER BY VectorDistance(c[@embeddingKey], @embeddings)" # Add limit_offset_clause if specified if pre_filter is not None and pre_filter.get("limit_offset_clause") is not None: