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
Added documentation (#219)
aaishikdutta6936d6983dbf
diff --git a/embedchain/chunkers/base_chunker.py b/embedchain/chunkers/base_chunker.pyindex dfbacac57..83c00d722 100644--- a/embedchain/chunkers/base_chunker.py+++ b/embedchain/chunkers/base_chunker.py@@ -3,6 +3,7 @@ import hashlibclass BaseChunker:def __init__(self, text_splitter):+ ''' Initialize the chunker. '''self.text_splitter = text_splitterdef create_chunks(self, loader, src):diff --git a/embedchain/chunkers/docx_file.py b/embedchain/chunkers/docx_file.pyindex 55e186dd1..3277223ff 100644--- a/embedchain/chunkers/docx_file.py+++ b/embedchain/chunkers/docx_file.py@@ -14,6 +14,7 @@ TEXT_SPLITTER_CHUNK_PARAMS = {class DocxFileChunker(BaseChunker):+ ''' Chunker for .docx file. '''def __init__(self, config: Optional[ChunkerConfig] = None):if config is None:config = TEXT_SPLITTER_CHUNK_PARAMSdiff --git a/embedchain/chunkers/pdf_file.py b/embedchain/chunkers/pdf_file.pyindex a6e1afcb4..76847a3c2 100644--- a/embedchain/chunkers/pdf_file.py+++ b/embedchain/chunkers/pdf_file.py@@ -13,6 +13,7 @@ TEXT_SPLITTER_CHUNK_PARAMS = {class PdfFileChunker(BaseChunker):+ ''' Chunker for PDF file. '''def __init__(self, config: Optional[ChunkerConfig] = None):if config is None:config = TEXT_SPLITTER_CHUNK_PARAMSdiff --git a/embedchain/chunkers/qna_pair.py b/embedchain/chunkers/qna_pair.pyindex f3352ea53..6ea17af51 100644--- a/embedchain/chunkers/qna_pair.py+++ b/embedchain/chunkers/qna_pair.py@@ -13,6 +13,7 @@ TEXT_SPLITTER_CHUNK_PARAMS = {class QnaPairChunker(BaseChunker):+ ''' Chunker for QnA pair. '''def __init__(self, config: Optional[ChunkerConfig] = None):if config is None:config = TEXT_SPLITTER_CHUNK_PARAMSdiff --git a/embedchain/chunkers/text.py b/embedchain/chunkers/text.pyindex 95fa8eeee..800ed67ef 100644--- a/embedchain/chunkers/text.py+++ b/embedchain/chunkers/text.py@@ -13,6 +13,7 @@ TEXT_SPLITTER_CHUNK_PARAMS = {class TextChunker(BaseChunker):+ ''' Chunker for text. '''def __init__(self, config: Optional[ChunkerConfig] = None):if config is None:config = TEXT_SPLITTER_CHUNK_PARAMSdiff --git a/embedchain/chunkers/web_page.py b/embedchain/chunkers/web_page.pyindex a442556f2..17f9665bc 100644--- a/embedchain/chunkers/web_page.py+++ b/embedchain/chunkers/web_page.py@@ -13,6 +13,7 @@ TEXT_SPLITTER_CHUNK_PARAMS = {class WebPageChunker(BaseChunker):+ ''' Chunker for web page. '''def __init__(self, config: Optional[ChunkerConfig] = None):if config is None:config = TEXT_SPLITTER_CHUNK_PARAMSdiff --git a/embedchain/chunkers/youtube_video.py b/embedchain/chunkers/youtube_video.pyindex a1406ca78..6467ddfcb 100644--- a/embedchain/chunkers/youtube_video.py+++ b/embedchain/chunkers/youtube_video.py@@ -13,6 +13,7 @@ TEXT_SPLITTER_CHUNK_PARAMS = {class YoutubeVideoChunker(BaseChunker):+ ''' Chunker for Youtube video. '''def __init__(self, config: Optional[ChunkerConfig] = None):if config is None:config = TEXT_SPLITTER_CHUNK_PARAMSdiff --git a/embedchain/loaders/docx_file.py b/embedchain/loaders/docx_file.pyindex d9872e231..e588c8d4b 100644--- a/embedchain/loaders/docx_file.py+++ b/embedchain/loaders/docx_file.py@@ -2,6 +2,7 @@ from langchain.document_loaders import Docx2txtLoaderclass DocxFileLoader:def load_data(self, url):+ ''' Load data from a .docx file. '''loader = Docx2txtLoader(url)output = []data = loader.load()diff --git a/embedchain/loaders/local_qna_pair.py b/embedchain/loaders/local_qna_pair.pyindex 76151d98a..843027440 100644--- a/embedchain/loaders/local_qna_pair.py+++ b/embedchain/loaders/local_qna_pair.py@@ -1,6 +1,7 @@class LocalQnaPairLoader:def load_data(self, content):+ ''' Load data from a local QnA pair. '''question, answer = contentcontent = f"Q: {question}\nA: {answer}"meta_data = {diff --git a/embedchain/loaders/local_text.py b/embedchain/loaders/local_text.pyindex 52ea143fe..2f9e6a171 100644--- a/embedchain/loaders/local_text.py+++ b/embedchain/loaders/local_text.py@@ -1,6 +1,7 @@class LocalTextLoader:def load_data(self, content):+ ''' Load data from a local text file. '''meta_data = {"url": "local",}diff --git a/embedchain/loaders/pdf_file.py b/embedchain/loaders/pdf_file.pyindex 14b096c59..7d0c6a49a 100644--- a/embedchain/loaders/pdf_file.py+++ b/embedchain/loaders/pdf_file.py@@ -6,6 +6,7 @@ from embedchain.utils import clean_stringclass PdfFileLoader:def load_data(self, url):+ ''' Load data from a PDF file. '''loader = PyPDFLoader(url)output = []pages = loader.load_and_split()diff --git a/embedchain/loaders/web_page.py b/embedchain/loaders/web_page.pyindex 88ece4b8f..a9e25df36 100644--- a/embedchain/loaders/web_page.py+++ b/embedchain/loaders/web_page.py@@ -8,6 +8,7 @@ from embedchain.utils import clean_stringclass WebPageLoader:def load_data(self, url):+ ''' Load data from a web page. '''response = requests.get(url)data = response.contentsoup = BeautifulSoup(data, 'html.parser')diff --git a/embedchain/loaders/youtube_video.py b/embedchain/loaders/youtube_video.pyindex 8bbda5a9f..601a7089c 100644--- a/embedchain/loaders/youtube_video.py+++ b/embedchain/loaders/youtube_video.py@@ -6,6 +6,7 @@ from embedchain.utils import clean_stringclass YoutubeVideoLoader:def load_data(self, url):+ ''' Load data from a Youtube video. '''loader = YoutubeLoader.from_youtube_url(url, add_video_info=True)doc = loader.load()output = []diff --git a/embedchain/vectordb/base_vector_db.py b/embedchain/vectordb/base_vector_db.pyindex 190646f33..fcde45427 100644--- a/embedchain/vectordb/base_vector_db.py+++ b/embedchain/vectordb/base_vector_db.py@@ -1,10 +1,13 @@class BaseVectorDB:+ ''' Base class for vector database. '''+def __init__(self):self.client = self._get_or_create_db()self.collection = self._get_or_create_collection()def _get_or_create_db(self):+ ''' Get or create the database. '''raise NotImplementedErrordef _get_or_create_collection(self):- raise NotImplementedError\ No newline at end of file+ raise NotImplementedErrordiff --git a/embedchain/vectordb/chroma_db.py b/embedchain/vectordb/chroma_db.pyindex 6cfa7db12..46b1b9e52 100644--- a/embedchain/vectordb/chroma_db.py+++ b/embedchain/vectordb/chroma_db.py@@ -7,6 +7,8 @@ from embedchain.vectordb.base_vector_db import BaseVectorDBclass ChromaDB(BaseVectorDB):+ ''' Vector database using ChromaDB. '''+def __init__(self, db_dir=None, ef=None):if ef:self.ef = ef@@ -26,9 +28,11 @@ class ChromaDB(BaseVectorDB):super().__init__()def _get_or_create_db(self):+ ''' Get or create the database. '''return chromadb.Client(self.client_settings)def _get_or_create_collection(self):+ ''' Get or create the collection. '''return self.client.get_or_create_collection('embedchain_store', embedding_function=self.ef,)