The agent engineering platform.
Python agentsaiai-agentsanthropicchatgptdeepagentsenterpriseframeworkgeminigenerative-ailangchainlanggraphllmmultiagentopen-sourceopenaipydanticpythonragtypescript
community: add score to PineconeHybridSearchRetriever (#25781)
Cillian Berragan754f3c41f9dd
diff --git a/libs/community/langchain_community/retrievers/pinecone_hybrid_search.py b/libs/community/langchain_community/retrievers/pinecone_hybrid_search.pyindex 4c51779681..dcbf35e38d 100644--- a/libs/community/langchain_community/retrievers/pinecone_hybrid_search.py+++ b/libs/community/langchain_community/retrievers/pinecone_hybrid_search.py@@ -173,8 +173,9 @@ class PineconeHybridSearchRetriever(BaseRetriever):final_result = []for res in result["matches"]:context = res["metadata"].pop("context")- final_result.append(- Document(page_content=context, metadata=res["metadata"])- )+ metadata = res["metadata"]+ if "score" not in metadata and "score" in res:+ metadata["score"] = res["score"]+ final_result.append(Document(page_content=context, metadata=metadata))# return search results as jsonreturn final_result