AI 原生开源嵌入数据库-chroma

作者 : noise 发布时间: 2023-07-13

Chroma拥有使用嵌入所需的所有工具

让嵌入变得简单

安装:

pip install chromadb

核心 API 是 4 个命令

import chromadb
client = chromadb.Client()

collection = client.create_collection("sample_collection")

# 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 embed for you, or bring your own
    metadatas=[{"source": "notion"}, {"source": "google-docs"}], # filter on arbitrary metadata!
    ids=["doc1", "doc2"], # must be unique for each doc 
)

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
)  
    来自NOISE资源阁-noisevip.cn
    NOISE宝藏阁 » AI 原生开源嵌入数据库-chroma

    发表回复

    微信
    我会尽快回复。
    取消