chromadol.base¶
Base objects for chromadol.
Functions
|
|
|
Classes
|
ChromaCollection with |
|
|
|
|
|
ChromaCollection but reading and writing only the 'documents' field. |
|
ChromaCollection but reading and writing only the 'metadatas' field. |
|
ChromaCollection but reading and writing only the 'uris' field. |
- class chromadol.base.AppendableChromaCollection(collection)[source]¶
Bases:
AppendableChromaCollectionChromaCollection with
appendandextend, auto-generating uuid keys.Items are the raw
chromadbkwargs mappings thatChromaCollection.__setitem__()accepts (e.g.{"documents": ..., "metadatas": ...}) – use this when you need to append more than the single field the codec-ed stores below expose.
- class chromadol.base.ChromaClient(client=None, *, decoder=<class 'chromadol.base.ChromaCollection'>, get_or_create=True, **create_collection_kwargs)[source]¶
Bases:
MutableMapping- clear()[source]¶
This method is here, in fact, to disable the clear method, that would otherwise be inherited from MutableMapping. It’s existence is too dangerous, as it would delete all collections in the client. If you want to actually delete all collections in the client, do so explicitly by iterating over the client and deleting each collection, as such:
>>> for k in chroma_client_instance: ... del chroma_client_instance[k]
- class chromadol.base.ChromaCollection(collection)[source]¶
Bases:
MutableMapping
- class chromadol.base.ChromaDocuments(collection)[source]¶
Bases:
ChromaDocumentsChromaCollection but reading and writing only the ‘documents’ field.
appendandextendtake the same values__setitem__takes (that is, the ‘documents’ field’s value), generating uuid keys for them. To write rawchromadbkwargs instead, useAppendableChromaCollection.
- class chromadol.base.ChromaMetadatas(collection)[source]¶
Bases:
StoreChromaCollection but reading and writing only the ‘metadatas’ field.
Mainly a read view:
chromadbrefuses anupsertthat carries neither documents nor images, so writing metadata alone raises (that is also why this one has noappend). Write metadata with the documents, throughChromaCollectionorAppendableChromaCollection.
- class chromadol.base.ChromaUris(collection)[source]¶
Bases:
ChromaUrisChromaCollection but reading and writing only the ‘uris’ field.
Writing uris needs a collection created with a
data_loader(seechromadol.data_loaders): the record is embedded from the data it loads.chromadbonly does that inadd(upsertandupdateembed only documents or images), so a new key is added and an existing key is replaced (delete, then add, keeping its metadata), and restored if the add fails.