Skip to content

armgit / mem0

Public Imported from GitHub
0

The Memory Layer for AI Agents - Drop-in memory infrastructure for AI agents and apps. Context that persists. Built for production.

bug: app.online fixed (#647)

Dev Khant77e1983b2e31
diff --git a/embedchain/embedchain.py b/embedchain/embedchain.py
index 3c72d02ab..cbb1dfb60 100644
--- a/embedchain/embedchain.py
+++ b/embedchain/embedchain.py
@@ -21,8 +21,7 @@ from embedchain.embedder.base import BaseEmbedder
from embedchain.helper.json_serializable import JSONSerializable
from embedchain.llm.base import BaseLlm
from embedchain.loaders.base_loader import BaseLoader
-from embedchain.models.data_type import (DataType, DirectDataType,
- IndirectDataType, SpecialDataType)
+from embedchain.models.data_type import DataType, DirectDataType, IndirectDataType, SpecialDataType
from embedchain.utils import detect_datatype
from embedchain.vectordb.base import BaseVectorDB
@@ -108,6 +107,16 @@ class EmbedChain(JSONSerializable):
raise ValueError(f"Boolean value expected but got {type(value)}.")
self.config.collect_metrics = value
+ @property
+ def online(self):
+ return self.llm.online
+
+ @online.setter
+ def online(self, value):
+ if not isinstance(value, bool):
+ raise ValueError(f"Boolean value expected but got {type(value)}.")
+ self.llm.online = value
+
def _load_or_generate_user_id(self) -> str:
"""
Loads the user id from the config file if it exists, otherwise generates a new
@@ -332,7 +341,7 @@ class EmbedChain(JSONSerializable):
count_new_chunks = self.db.count() - chunks_before_addition
print((f"Successfully saved {src} ({chunker.data_type}). New chunks count: {count_new_chunks}"))
return list(documents), metadatas, ids, count_new_chunks
-
+
def _get_existing_doc_id(self, chunker: BaseChunker, src: Any):
"""
Get id of existing document for a given source, based on the data type
diff --git a/pyproject.toml b/pyproject.toml
index 7c310810e..2315d2484 100644
--- a/pyproject.toml
+++ b/pyproject.toml
@@ -91,6 +91,7 @@ youtube-transcript-api = "^0.6.1"
beautifulsoup4 = "^4.12.2"
pypdf = "^3.11.0"
pytube = "^15.0.0"
+duckduckgo-search = "^3.8.5"
llama-hub = { version = "^0.0.29", optional = true }
sentence-transformers = { version = "^2.2.2", optional = true }
torch = { version = ">=2.0.0, !=2.0.1", optional = true }