浏览代码

docs: chroma client documentation (#248)

cachho 2 年之前
父节点
当前提交
17ff0b0b35
共有 2 个文件被更改,包括 15 次插入0 次删除
  1. 13 0
      README.md
  2. 2 0
      embedchain/config/InitConfig.py

+ 13 - 0
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**
 

+ 2 - 0
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)