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 ed8e65cf88..7baa51a17a 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 @@ -122,8 +122,8 @@ class AzureCosmosDBNoSqlVectorSearch(VectorStore): ) self._embedding_key = self._vector_embedding_policy["vectorEmbeddings"][0][ - "path" - ][1:] + "path" + ][1:] def add_texts( self, @@ -317,15 +317,15 @@ class AzureCosmosDBNoSqlVectorSearch(VectorStore): query += "TOP @limit " query += ( - "c.id, c[@embeddingKey], c.text, c.metadata, " - "VectorDistance(c[@embeddingKey], @embeddings) AS SimilarityScore FROM c" + "c.id, c.{}, 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: