فهرست منبع

bug: app.online fixed (#647)

Dev Khant 1 سال پیش
والد
کامیت
77e1983b2e
2فایلهای تغییر یافته به همراه13 افزوده شده و 3 حذف شده
  1. 12 3
      embedchain/embedchain.py
  2. 1 0
      pyproject.toml

+ 12 - 3
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

+ 1 - 0
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 }