Prerequisites
Before proceeding, ensure the following prerequisites are met:- Install MindsDB locally via Docker or use MindsDB Cloud.
- To connect ChromaDB to MindsDB, install the required dependencies following this instruction.
- Install or ensure access to ChromaDB.
Connection
This handler is implemented using thechromadb Python library.
The required arguments to establish a connection are:
host: the host name or IP address of the ChromaDB instance.port: the TCP/IP port of the ChromaDB instance.
persist_directory: the directory to use for persisting data.
The
host and port arguments should be provided if you want to connect to a remote ChromaDB instance. Otherwise, the persist_directory argument should be provided. This will create an in-memory ChromaDB instance.Usage
Now, you can use the established connection to create a collection (or table in the context of MindsDB) in ChromaDB and insert data into it:mysql_datasource is another MindsDB data source that has been created by connecting to a MySQL database. The test_embeddings table in the mysql_datasource data source contains the embeddings that we want to store in ChromaDB.