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: Fix dependency of openai env variables for OpenSourceApp (#144)
Taranjeet Singh200f11a0e059
diff --git a/embedchain/embedchain.py b/embedchain/embedchain.pyindex 4606cb084..65ec73619 100644--- a/embedchain/embedchain.py+++ b/embedchain/embedchain.py@@ -19,12 +19,6 @@ from embedchain.chunkers.qna_pair import QnaPairChunkerfrom embedchain.chunkers.text import TextChunkerfrom embedchain.vectordb.chroma_db import ChromaDB-openai_ef = embedding_functions.OpenAIEmbeddingFunction(- api_key=os.getenv("OPENAI_API_KEY"),- organization_id=os.getenv("OPENAI_ORGANIZATION"),- model_name="text-embedding-ada-002"-)-sentence_transformer_ef = embedding_functions.SentenceTransformerEmbeddingFunction(model_name="all-MiniLM-L6-v2")gpt4all_model = None@@ -238,7 +232,11 @@ class App(EmbedChain):def __int__(self, db=None, ef=None):if ef is None:- ef = openai_ef+ ef = embedding_functions.OpenAIEmbeddingFunction(+ api_key=os.getenv("OPENAI_API_KEY"),+ organization_id=os.getenv("OPENAI_ORGANIZATION"),+ model_name="text-embedding-ada-002"+ )super().__init__(db, ef)def get_llm_model_answer(self, prompt):@@ -270,7 +268,9 @@ class OpenSourceApp(EmbedChain):def __init__(self, db=None, ef=None):print("Loading open source embedding model. This may take some time...")if ef is None:- ef = sentence_transformer_ef+ ef = embedding_functions.SentenceTransformerEmbeddingFunction(+ model_name="all-MiniLM-L6-v2"+ )print("Successfully loaded open source embedding model.")super().__init__(db, ef)diff --git a/embedchain/vectordb/chroma_db.py b/embedchain/vectordb/chroma_db.pyindex 96166f834..6cfa7db12 100644--- a/embedchain/vectordb/chroma_db.py+++ b/embedchain/vectordb/chroma_db.py@@ -5,15 +5,17 @@ from chromadb.utils import embedding_functionsfrom embedchain.vectordb.base_vector_db import BaseVectorDB-openai_ef = embedding_functions.OpenAIEmbeddingFunction(- api_key=os.getenv("OPENAI_API_KEY"),- organization_id=os.getenv("OPENAI_ORGANIZATION"),- model_name="text-embedding-ada-002"-)class ChromaDB(BaseVectorDB):def __init__(self, db_dir=None, ef=None):- self.ef = ef if ef is not None else openai_ef+ if ef:+ self.ef = ef+ else:+ self.ef = embedding_functions.OpenAIEmbeddingFunction(+ api_key=os.getenv("OPENAI_API_KEY"),+ organization_id=os.getenv("OPENAI_ORGANIZATION"),+ model_name="text-embedding-ada-002"+ )if db_dir is None:db_dir = "db"self.client_settings = chromadb.config.Settings(