我正在使用 Chromadb 服务器,当我添加数据并使用 get 查询时,我发现没有嵌入。
chroma_client = chromadb.HttpClient(host='localhost', port='8000')
collection = chroma_client.get_or_create_collection(name="my_collectionvvv")
collection.add(
documents=["This is a document", "This is another document"],
metadatas=[{"source": "my_source"}, {"source": "my_source"}],
ids=["id1", "id2"]
)
# client = chromadb.PersistentClient(path="/Users/guitai/chromadb")
results = collection.query(
query_texts=["document"],
n_results=2,
include=["embeddings", "documents", "metadatas","distances"]
)
results1 = collection.get(
ids=['id1'],
include=["embeddings", "documents", "metadatas"]
)
print(results)
print(results1)
chroma_client = chromadb.Client()
这是正确的,但是 chromadb 服务器无法保存嵌入。
python=3.9 色度数据库=0.4.3
如果您访问 docs.trychroma.com,您会发现他们排除了嵌入,这可能会提高性能。