chroma
0.5.20
Chroma - 开源嵌入数据库。
使用内存构建 Python 或 JavaScript LLM 应用程序的最快方法!
| |文档 |主页
pip install chromadb # python client
# for javascript, npm install chromadb!
# for client-server mode, chroma run --path /chroma_db_path
核心 API 只有 4 个函数(运行我们的 Google Colab 或 Replit 模板):
import chromadb
# setup Chroma in-memory, for easy prototyping. Can add persistence easily!
client = chromadb . Client ()
# Create collection. get_collection, get_or_create_collection, delete_collection also available!
collection = client . create_collection ( "all-my-documents" )
# Add docs to the collection. Can also update and delete. Row-based API coming soon!
collection . add (
documents = [ "This is document1" , "This is document2" ], # we handle tokenization, embedding, and indexing automatically. You can skip that and add your own embeddings as well
metadatas = [{ "source" : "notion" }, { "source" : "google-docs" }], # filter on these!
ids = [ "doc1" , "doc2" ], # unique for each doc
)
# Query/search 2 most similar results. You can also .get by id
results = collection . query (
query_texts = [ "This is a query document" ],
n_results = 2 ,
# where={"metadata_field": "is_equal_to_this"}, # optional filter
# where_document={"$contains":"search_string"} # optional filter
)
?️? LangChain
(python 和 js), ? LlamaIndex
及更多内容即将推出例如, "Chat your data"
用例:
GPT3
等 LLM 的上下文窗口中,以进行额外的总结或分析。 什么是嵌入?
[1.2, 2.1, ....]
。此过程使机器学习模型“可以理解”文档。嵌入数据库(也称为向量数据库)存储嵌入,并允许您按最近邻居进行搜索,而不是像传统数据库那样按子字符串进行搜索。默认情况下,Chroma 使用 Sentence Transformers 为您嵌入,但您也可以使用 OpenAI 嵌入、Cohere(多语言)嵌入或您自己的嵌入。
Chroma 是一个快速发展的项目。我们欢迎公关贡献者和关于如何改进该项目的想法。
#contributing
频道Good first issue tag
发布 Cadence目前,我们每周一发布pypi
和npm
软件包的新标记版本。修补程序在一周中的任何时间都会发布。
阿帕奇2.0