ChromaDB
Here is a list of all available ChromaDB procedures, note that the list and the signature procedures are consistent with the others, like the Qdrant ones:
name | description |
---|---|
apoc.vectordb.chroma.createCollection(hostOrKey, collection, similarity, size, $config) |
Creates a collection, with the name specified in the 2nd parameter, and with the specified |
apoc.vectordb.chroma.deleteCollection(hostOrKey, collection, $config) |
Deletes a collection with the name specified in the 2nd parameter.
The default endpoint is |
apoc.vectordb.chroma.upsert(hostOrKey, collection, vectors, $config) |
Upserts, in the collection with the name specified in the 2nd parameter, the vectors [{id: 'id', vector: '<vectorDb>', medatada: '<metadata>'}].
The default endpoint is |
apoc.vectordb.chroma.delete(hostOrKey, collection, ids, $config) |
Deletes the vectors with the specified |
apoc.vectordb.chroma.get(hostOrKey, collection, ids, $config) |
Gets the vectors with the specified |
apoc.vectordb.chroma.query(hostOrKey, collection, vector, filter, limit, $config) |
Retrieve closest vectors from the defined |
apoc.vectordb.chroma.getAndUpdate(hostOrKey, collection, ids, $config) |
Gets the vectors with the specified |
apoc.vectordb.chroma.queryAndUpdate(hostOrKey, collection, vector, filter, limit, $config) |
Retrieve closest vectors from the defined |
where the 1st parameter can be a key defined by the apoc config apoc.chroma.<key>.host=myHost
.
With hostOrKey=null, the default is 'http://localhost:8000'.
Examples
CALL apoc.vectordb.chroma.createCollection($host, 'test_collection', 'Cosine', 4, {<optional config>})
CALL apoc.vectordb.chroma.deleteCollection($host, '<collection_id>', {<optional config>})
CALL apoc.vectordb.qdrant.upsert($host, '<collection_id>',
[
{id: 1, vector: [0.05, 0.61, 0.76, 0.74], metadata: {city: "Berlin", foo: "one"}, text: 'ajeje'},
{id: 2, vector: [0.19, 0.81, 0.75, 0.11], metadata: {city: "London", foo: "two"}, text: 'brazorf'}
],
{<optional config>})
CALL apoc.vectordb.chroma.get($host, '<collection_id>', ['1','2'], {<optional config>}), text
score | metadata | id | vector | text | entity |
---|---|---|---|---|---|
null |
{city: "Berlin", foo: "one"} |
null |
null |
null |
null |
null |
{city: "Berlin", foo: "two"} |
null |
null |
null |
null |
{allResults: true}
CALL apoc.vectordb.chroma.get($host, '<collection_id>', ['1','2'], {<optional config>}), text
score | metadata | id | vector | text | entity |
---|---|---|---|---|---|
null |
{city: "Berlin", foo: "one"} |
1 |
[…] |
ajeje |
null |
null |
{city: "Berlin", foo: "two"} |
2 |
[…] |
brazorf |
null |
CALL apoc.vectordb.chroma.query($host,
'<collection_id>',
[0.2, 0.1, 0.9, 0.7],
{city: 'London'},
5,
{allResults: true, <optional config>}), text
score | metadata | id | vector | text |
---|---|---|---|---|
1, |
{city: "Berlin", foo: "one"} |
1 |
[…] |
ajeje |
0.1 |
{city: "Berlin", foo: "two"} |
2 |
[…] |
brazorf |
To optimize performances, we can choose what to |
In the same way as other procedures, we can define a mapping, to fetch the associated nodes and relationships and optionally create them, by leveraging the vector metadata. For example:
CALL apoc.vectordb.chroma.query($host, '<collection_id>',
[0.2, 0.1, 0.9, 0.7],
{},
5,
{ mapping: {
embeddingKey: "vect",
nodeLabel: "Test",
entityKey: "myId",
metadataKey: "foo"
}
})
CALL apoc.vectordb.chroma.delete($host, '<collection_id>', [1,2], {<optional config>})