Skip to content

The agent engineering platform.

community: Replaced hardcoded "metadata" with FIELDS_METADATA variable in semantic_hybrid_search_with_score_and_rerank (#15642)

Raunak64f5968a81f8
diff --git a/libs/community/langchain_community/vectorstores/azuresearch.py b/libs/community/langchain_community/vectorstores/azuresearch.py
index 0b449688bd..f3ab8ae1e7 100644
--- a/libs/community/langchain_community/vectorstores/azuresearch.py
+++ b/libs/community/langchain_community/vectorstores/azuresearch.py
@@ -653,7 +653,10 @@ class AzureSearch(VectorStore):
if result.get("@search.captions")
else {},
"answers": semantic_answers_dict.get(
- json.loads(result["metadata"]).get("key"), ""
+ json.loads(result[FIELDS_METADATA]).get("key")
+ if FIELDS_METADATA in result
+ else "",
+ "",
),
},
},