All Templates / Storage
ChromaDB
The AI-native embedding database
Chroma
chroma-core/chroma
Just deployed
/chroma/chroma
The AI-native embedding database
This ChromaDB is by default exposed under the Private Network.
To use it under the public network you'll need to expose it under the public network and then replace --host ::
with --host 0.0.0.0
in the service's Start Command.
All the documentation is covered here!
Javascript
// install the JS client and the (optional) default embedding function
npm install --save chromadb chromadb-default-embed
// set "type": "module" in your package.json
import { ChromaClient } from 'chromadb'
async function chromaExample() {
const client = new ChromaClient();
const collection = await client.createCollection({name: "sample_collection"});
await collection.add({
documents: ["This is a document", "This is another document"], // we embed for you, or bring your own
metadatas: [{ source: "my_source" }, { source: "my_source" }], // filter on arbitrary metadata!
ids: ["id1", "id2"] // must be unique for each doc
});
const results = await collection.query({
queryTexts: ["This is a query document"],
nResults: 2,
// where: {"metadata_field": "is_equal_to_this"}, // optional filter
// whereDocument: {"$contains":"search_string"} // optional filter
});
}
chromaExample();
Python
# python can also run in-memory with no server running: chromadb.PersistentClient()
import chromadb
client = chromadb.HttpClient()
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
)
Template Content
Details
Created on May 6, 2024
11 total projects
5 active projects
Storage
More templates in this category