The Memory Layer for AI Agents - Drop-in memory infrastructure for AI agents and apps. Context that persists. Built for production.
Python agentic-memoryagentic-memory-systemagentsaiai-agentschatgptgenaillmlong-term-memorymemorymemory-managementpythonragstate-management
fix: Don't create instance in InitConfig `__init__` (#236)
cachho6fbf45498a64
diff --git a/embedchain/config/InitConfig.py b/embedchain/config/InitConfig.pyindex 268538b05..fb4daf2e5 100644--- a/embedchain/config/InitConfig.py+++ b/embedchain/config/InitConfig.py@@ -20,27 +20,11 @@ class InitConfig(BaseConfig):"""self._setup_logging(log_level)- # Embedding Function- if ef is None:- from chromadb.utils import embedding_functions-- self.ef = embedding_functions.OpenAIEmbeddingFunction(- api_key=os.getenv("OPENAI_API_KEY"),- organization_id=os.getenv("OPENAI_ORGANIZATION"),- model_name="text-embedding-ada-002",- )- else:- self.ef = ef-- if db is None:- from embedchain.vectordb.chroma_db import ChromaDB-- self.db = ChromaDB(ef=self.ef, host=host, port=port)- else:- self.db = db-self.ef = efself.db = db++ self.host = host+ self.port = portreturndef _set_embedding_function(self, ef):@@ -78,8 +62,7 @@ class InitConfig(BaseConfig):Sets database to default (`ChromaDb`)."""from embedchain.vectordb.chroma_db import ChromaDB-- self.db = ChromaDB(ef=self.ef)+ self.db = ChromaDB(ef=self.ef, host=self.host, port=self.port)def _setup_logging(self, debug_level):level = logging.WARNING # Default leveldiff --git a/embedchain/vectordb/chroma_db.py b/embedchain/vectordb/chroma_db.pyindex 40fc6b644..2142f9d3c 100644--- a/embedchain/vectordb/chroma_db.py+++ b/embedchain/vectordb/chroma_db.py@@ -1,4 +1,5 @@import os+import loggingimport chromadbfrom chromadb.utils import embedding_functions@@ -20,6 +21,7 @@ class ChromaDB(BaseVectorDB):)if host and port:+ logging.info(f"Connecting to ChromaDB server: {host}:{port}")self.client_settings = chromadb.config.Settings(chroma_api_impl="rest",chroma_server_host=host,