From 17ff0b0b35a73c8da86b2991db1dc4122d261d9a Mon Sep 17 00:00:00 2001 From: cachho Date: Thu, 13 Jul 2023 03:47:17 +0200 Subject: [PATCH] docs: chroma client documentation (#248) --- README.md | 13 +++++++++++++ embedchain/config/InitConfig.py | 2 ++ 2 files changed, 15 insertions(+) diff --git a/README.md b/README.md index be88d23a..4e2517f1 100644 --- a/README.md +++ b/README.md @@ -453,6 +453,17 @@ for query in queries: # Response: We divorced due to living apart for five years. ``` +**Client Mode**. By defining a (ChromaDB) server, you can run EmbedChain as a client only. + +```python +from embedchain import App +config = InitConfig(host="localhost", port="8080") +app = App(config) +``` +This is useful for scalability. Say you have EmbedChain behind an API with multiple workers. If you separate clients and server, all clients can connect to the server, which only has to keep one instance of the database in memory. You also don't have to worry about replication. + +To run a chroma db server, run `git clone https://github.com/chroma-core/chroma.git`, navigate to the directory (`cd chroma`) and then start the server with `docker-compose up -d --build`. + ### Configs This section describes all possible config options. @@ -464,6 +475,8 @@ This section describes all possible config options. |log_level|log level|string|WARNING| |ef|embedding function|chromadb.utils.embedding_functions|{text-embedding-ada-002}| |db|vector database (experimental)|BaseVectorDB|ChromaDB| +|host|hostname for (Chroma) DB server|string|None| +|port|port number for (Chroma) DB server|string, int|None| #### **Add Config** diff --git a/embedchain/config/InitConfig.py b/embedchain/config/InitConfig.py index 923ab879..35b8d9bb 100644 --- a/embedchain/config/InitConfig.py +++ b/embedchain/config/InitConfig.py @@ -17,6 +17,8 @@ class InitConfig(BaseConfig): ['DEBUG', 'INFO', 'WARNING', 'ERROR', 'CRITICAL']. :param ef: Optional. Embedding function to use. :param db: Optional. (Vector) database to use for embeddings. + :param host: Optional. Hostname for the database server. + :param port: Optional. Port for the database server. """ self._setup_logging(log_level)