A collection of experimental Chroma extensions.
Project description
ChromaX: An experimental utilities package for Chroma vector database
Installation
pip install chromadbx
Usage
Queries
Supported filters:
$eq
- equal to (string, int, float)$ne
- not equal to (string, int, float)$gt
- greater than (int, float)$gte
- greater than or equal to (int, float)$lt
- less than (int, float)$lte
- less than or equal to (int, float)$in
- in (list of strings, ints, floats,bools)$nin
- not in (list of strings, ints, floats,bools)
Where:
import chromadb
from chromadbx.core.queries import eq, where, ne, and_
client = chromadb.PersistentClient(path="path/to/db")
collection = client.get_collection("collection_name")
collection.query(where=where(and_(eq("a", 1), ne("b", "2"))))
# {'$and': [{'a': ['$eq', 1]}, {'b': ['$ne', '2']}]}
Where Document:
import chromadb
from chromadbx.core.queries import where_document, contains, not_contains, LogicalOperator
client = chromadb.PersistentClient(path="path/to/db")
collection = client.get_collection("collection_name")
collection.query(where_document=where_document(contains("this is a document", "this is another document")))
# {'$and': [{'$contains': 'this is a document'}, {'$contains': 'this is another document'}]}
collection.query(
where_document=where_document(contains("this is a document", "this is another document", op=LogicalOperator.OR)))
# {'$or': [{'$contains': 'this is a document'}, {'$contains': 'this is another document'}]}
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
chromadbx-0.0.2.tar.gz
(2.9 kB
view hashes)
Built Distribution
Close
Hashes for chromadbx-0.0.2-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | f9a8dafb79737ca18d026d0e06da51c4e3d71f320ff0e5a6704bcc6f296e058e |
|
MD5 | d9eeaae37d916a428572a8af11e95bb6 |
|
BLAKE2b-256 | 4424e456ae3311259f0d3779979ae4e2c5a828babd9bd79d0ada6545f6e4cf72 |