From d3ce47414d91ef1aecbea28d5f7026e6e2304b2e Mon Sep 17 00:00:00 2001 From: Harrison Chase Date: Mon, 24 Apr 2023 22:19:36 -0700 Subject: [PATCH] Harrison/chroma update (#3489) Co-authored-by: vyeevani <30946190+vyeevani@users.noreply.github.com> Co-authored-by: Vineeth Yeevani --- langchain/vectorstores/chroma.py | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/langchain/vectorstores/chroma.py b/langchain/vectorstores/chroma.py index c3d977aa..43ce6c0a 100644 --- a/langchain/vectorstores/chroma.py +++ b/langchain/vectorstores/chroma.py @@ -315,6 +315,17 @@ class Chroma(VectorStore): ) self._client.persist() + def update_document(self, document_id: str, document: Document) -> None: + """Update a document in the collection. + + Args: + document_id (str): ID of the document to update. + document (Document): Document to update. + """ + text = document.page_content + metadata = document.metadata + self._collection.update_document(document_id, text, metadata) + @classmethod def from_texts( cls: Type[Chroma],