ids=[document_id],
)
At this point, we have a new Chroma instance with a single document “This is an initial document content” with id “doc1”. Now, let’s update the content of the document.
# Updated document content
updated_content = "This is the updated document content"
# Create a new Document instance with the updated content
updated_doc = Document(page_content=updated_content, metadata={"page": "1"})
# Update the document in the Chroma instance by passing the document id and the updated document
new_db.update_document(document_id=document_id, document=updated_doc)
# Now, let's retrieve the updated document using similarity search
output = new_db.similarity_search(updated_content, k=1)
# Print the content of the retrieved document
print(output[0].page_content, output[0].metadata)
This is the updated document content {'page': '1'}
previous
Azure Cognitive Search
next
ClickHouse Vector Search
 Contents
  
Similarity search with score
Persistance
Initialize PeristedChromaDB
Persist the Database
Load the Database from disk, and create the chain
Retriever options
MMR
Updating a Document
By Harrison Chase
    
      © Copyright 2023, Harrison Chase.
      
  Last updated on Jun 16, 2023.
rtdocs_stable/api.python.langchain.com/en/stable/modules/indexes/vectorstores/examples/chroma.html