yipao.vectorstores.chromadb.ChromaDB¶
- class yipao.vectorstores.chromadb.ChromaDB(cfg: Dict[str, int], **settings)[source]¶
Class for interacting with ChromaDB, a database designed for handling and querying embedded documents.
- client¶
The database client for interacting with ChromaDB.
- Type:
PersistentClient or HttpClient
- ddl_collection¶
A collection for DDL (Data Definition Language) statements.
- Type:
Collection
- __init__(cfg: Dict[str, int], **settings)[source]¶
Initializes the ChromaDB client based on configuration.
- Parameters:
cfg (Dict[str, int] or str) – If string, it represents the file path to the database; if dictionary, it specifies configuration settings for HTTP connection.
settings (dict) – Additional settings for the ChromaDB client, passed to the Settings object.
- Raises:
TypeError – If cfg is neither a dict nor a string.
Methods
__init__
(cfg, **settings)Initializes the ChromaDB client based on configuration.
add_ddl
(ddl)Adds a DDL statement to the ChromaDB collection.
add_ddls
(ddls)Adds multiple DDL statements to the ChromaDB collection.
query
(collection_name, query_text, n_results)Queries the ChromaDB collection and retrieves documents based on the specified query texts.
reset
()Resets the database client, clearing all stored data and configurations.