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

- **Description:** This PR is to fix a bug in
semantic_hybrid_search_with_score_and_rerank() function in
langchain_community/vectorstores/azuresearch.py. The hardcoded
"metadata" name is replaced with FIELDS_METADATA variable with an if
block to check if the metadata column exists or not.
- **Issue:** Fixed #15581
- **Dependencies:** No
- **Twitter handle:** None

Co-authored-by: H161961 <Raunak.Raunak@Honeywell.com>
pull/15648/head
Raunak 9 months ago committed by GitHub
parent 472f70c54b
commit 64f5968a81
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

@ -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 "",
"",
),
},
},

Loading…
Cancel
Save