From 77e1983b2e31e669f38b0299c5504ccfb6015bee Mon Sep 17 00:00:00 2001 From: Dev Khant Date: Sun, 24 Sep 2023 04:40:18 +0530 Subject: [PATCH] bug: app.online fixed (#647) --- embedchain/embedchain.py | 15 ++++++++++++--- pyproject.toml | 1 + 2 files changed, 13 insertions(+), 3 deletions(-) diff --git a/embedchain/embedchain.py b/embedchain/embedchain.py index 3c72d02a..cbb1dfb6 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 7c310810..2315d248 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 }