docs(vectorstores/integrations/chroma): Fix loading and saving (#7437)

- Description: Fix loading and saving code about Chroma
- Issue: the issue #7436 
- Dependencies: -
- Twitter handle: https://twitter.com/ftnext
This commit is contained in:
nikkie 2023-07-10 15:05:15 +09:00 committed by GitHub
parent c7f7788d0b
commit dfc3f83b0f
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -146,11 +146,11 @@
"# save to disk\n", "# save to disk\n",
"db2 = Chroma.from_documents(docs, embedding_function, persist_directory=\"./chroma_db\")\n", "db2 = Chroma.from_documents(docs, embedding_function, persist_directory=\"./chroma_db\")\n",
"db2.persist()\n", "db2.persist()\n",
"docs = db.similarity_search(query)\n", "docs = db2.similarity_search(query)\n",
"\n", "\n",
"# load from disk\n", "# load from disk\n",
"db3 = Chroma(persist_directory=\"./chroma_db\")\n", "db3 = Chroma(persist_directory=\"./chroma_db\", embedding_function=embedding_function)\n",
"docs = db.similarity_search(query)\n", "docs = db3.similarity_search(query)\n",
"print(docs[0].page_content)" "print(docs[0].page_content)"
] ]
}, },