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
chore: linting (#597)
cachho03146946fa3d
diff --git a/embedchain/embedchain.py b/embedchain/embedchain.pyindex a2019b753..d6364b5b4 100644--- a/embedchain/embedchain.py+++ b/embedchain/embedchain.py@@ -242,7 +242,7 @@ class EmbedChain(JSONSerializable):src: Any,metadata: Optional[Dict[str, Any]] = None,source_id: Optional[str] = None,- dry_run = False+ dry_run=False,) -> Tuple[List[str], Dict[str, Any], List[str], int]:"""The loader to use to load the data.@@ -320,14 +320,14 @@ class EmbedChain(JSONSerializable):return list(documents), metadatas, ids, count_new_chunksdef load_and_embed_v2(- self,- loader: BaseLoader,- chunker: BaseChunker,- src: Any,- metadata: Optional[Dict[str, Any]] = None,- source_id: Optional[str] = None,- dry_run = False- ):+ self,+ loader: BaseLoader,+ chunker: BaseChunker,+ src: Any,+ metadata: Optional[Dict[str, Any]] = None,+ source_id: Optional[str] = None,+ dry_run=False,+ ):"""Loads the data from the given URL, chunks it, and adds it to database.@@ -364,9 +364,7 @@ class EmbedChain(JSONSerializable):# this means that doc content has changed.if existing_doc_id and existing_doc_id != new_doc_id:print("Doc content has changed. Recomputing chunks and embeddings intelligently.")- self.db.delete({- "doc_id": existing_doc_id- })+ self.db.delete({"doc_id": existing_doc_id})# get existing ids, and discard doc if any common id exist.where = {"app_id": self.config.id} if self.config.id is not None else {}diff --git a/embedchain/loaders/csv.py b/embedchain/loaders/csv.pyindex 9de84de03..1730ae9c2 100644--- a/embedchain/loaders/csv.py+++ b/embedchain/loaders/csv.py@@ -46,7 +46,4 @@ class CsvLoader(BaseLoader):lines.append(line)result.append({"content": line, "meta_data": {"url": content, "row": i + 1}})doc_id = hashlib.sha256((content + " ".join(lines)).encode()).hexdigest()- return {- "doc_id": doc_id,- "data": result- }+ return {"doc_id": doc_id, "data": result}diff --git a/embedchain/loaders/local_qna_pair.py b/embedchain/loaders/local_qna_pair.pyindex 36da278e1..61d9a5766 100644--- a/embedchain/loaders/local_qna_pair.py+++ b/embedchain/loaders/local_qna_pair.py@@ -22,5 +22,5 @@ class LocalQnaPairLoader(BaseLoader):"content": content,"meta_data": meta_data,}- ]+ ],}diff --git a/embedchain/loaders/local_text.py b/embedchain/loaders/local_text.pyindex 7a5195787..118cbd3af 100644--- a/embedchain/loaders/local_text.py+++ b/embedchain/loaders/local_text.py@@ -20,5 +20,5 @@ class LocalTextLoader(BaseLoader):"content": content,"meta_data": meta_data,}- ]+ ],}diff --git a/embedchain/loaders/notion.py b/embedchain/loaders/notion.pyindex 065673e56..7ff84ed58 100644--- a/embedchain/loaders/notion.py+++ b/embedchain/loaders/notion.py@@ -39,9 +39,9 @@ class NotionLoader(BaseLoader):return {"doc_id": doc_id,"data": [- {- "content": text,- "meta_data": {"url": f"notion-{formatted_id}"},- }- ],+ {+ "content": text,+ "meta_data": {"url": f"notion-{formatted_id}"},+ }+ ],}diff --git a/embedchain/loaders/sitemap.py b/embedchain/loaders/sitemap.pyindex c78542c41..d85e8829d 100644--- a/embedchain/loaders/sitemap.py+++ b/embedchain/loaders/sitemap.py@@ -43,7 +43,4 @@ class SitemapLoader(BaseLoader):logging.warning(f"Page is not readable (too many invalid characters): {link}")except ParserRejectedMarkup as e:logging.error(f"Failed to parse {link}: {e}")- return {- "doc_id": doc_id,- "data": [data[0] for data in output]- }+ return {"doc_id": doc_id, "data": [data[0] for data in output]}diff --git a/embedchain/loaders/web_page.py b/embedchain/loaders/web_page.pyindex 9e62df388..53d41df01 100644--- a/embedchain/loaders/web_page.py+++ b/embedchain/loaders/web_page.py@@ -66,7 +66,7 @@ class WebPageLoader(BaseLoader):}content = contentdoc_id = hashlib.sha256((content + url).encode()).hexdigest()- return {+ return {"doc_id": doc_id,"data": [{diff --git a/embedchain/vectordb/base_vector_db.py b/embedchain/vectordb/base_vector_db.pyindex e7ef5c8ea..aee18f1c0 100644--- a/embedchain/vectordb/base_vector_db.py+++ b/embedchain/vectordb/base_vector_db.py@@ -47,4 +47,4 @@ class BaseVectorDB(JSONSerializable):raise NotImplementedErrordef set_collection_name(self, name: str):- raise NotImplementedError\ No newline at end of file+ raise NotImplementedErrordiff --git a/embedchain/vectordb/chroma.py b/embedchain/vectordb/chroma.pyindex 2717b378f..3086c23fa 100644--- a/embedchain/vectordb/chroma.py+++ b/embedchain/vectordb/chroma.py@@ -1,5 +1,5 @@import logging-from typing import Dict, List, Optional, Any+from typing import Any, Dict, List, Optionalfrom chromadb import Collection, QueryResultfrom langchain.docstore.document import Document@@ -105,9 +105,7 @@ class ChromaDB(BaseVectorDB):args["where"] = whereif limit:args["limit"] = limit- return self.collection.get(- **args- )+ return self.collection.get(**args)def get_advanced(self, where):return self.collection.get(where=where, limit=1)diff --git a/tests/chunkers/test_text.py b/tests/chunkers/test_text.pyindex 6ea566202..e5bc32ab7 100644--- a/tests/chunkers/test_text.py+++ b/tests/chunkers/test_text.py@@ -76,5 +76,5 @@ class MockLoader:"content": src,"meta_data": {"url": "none"},}- ]+ ],}diff --git a/tests/embedchain/test_add.py b/tests/embedchain/test_add.pyindex 446ab496c..f8c205640 100644--- a/tests/embedchain/test_add.py+++ b/tests/embedchain/test_add.py@@ -3,7 +3,7 @@ import unittestfrom unittest.mock import MagicMock, patchfrom embedchain import App-from embedchain.config import AppConfig, AddConfig, ChunkerConfig+from embedchain.config import AddConfig, AppConfig, ChunkerConfigfrom embedchain.models.data_type import DataType