mirror of
https://github.com/hwchase17/langchain.git
synced 2025-06-26 16:43:35 +00:00
LangChain-Community - AzureCosmos Mongo vCore: Bug Fix when the data doesn't contain metadata field (#27772)
Thank you for contributing to LangChain! - **Description:** Adding an empty metadata field when metadata is not present in the data - **Issue:** This PR fixes the issue when the data items doesn't contain the metadata field. This happens when there is already data in the container, or cx uses CosmosDB Python SDK to insert data. - **Dependencies:** No dependencies required Additional guidelines: - Make sure optional dependencies are imported within a function. - Please do not add dependencies to pyproject.toml files (even optional ones) unless they are required for unit tests. - Most PRs should not touch more than one package. - Changes should be backwards compatible. - If you are adding something to community, do not re-import it in langchain. If no one reviews your PR within a few days, please @-mention one of baskaryan, efriis, eyurtsev, ccurme, vbarda, hwchase17.
This commit is contained in:
parent
8d8d85379f
commit
a8a33b2dc6
@ -460,7 +460,7 @@ class AzureCosmosDBVectorSearch(VectorStore):
|
|||||||
continue
|
continue
|
||||||
document_object_field = res.pop("document")
|
document_object_field = res.pop("document")
|
||||||
text = document_object_field.pop(self._text_key)
|
text = document_object_field.pop(self._text_key)
|
||||||
metadata = document_object_field.pop("metadata")
|
metadata = document_object_field.pop("metadata", {})
|
||||||
if with_embedding:
|
if with_embedding:
|
||||||
metadata[self._embedding_key] = document_object_field.pop(
|
metadata[self._embedding_key] = document_object_field.pop(
|
||||||
self._embedding_key
|
self._embedding_key
|
||||||
|
Loading…
Reference in New Issue
Block a user