bug: app.online fixed (#647)

This commit is contained in:
Dev Khant
2023-09-24 04:40:18 +05:30
committed by GitHub
parent d344ee226c
commit 77e1983b2e
2 changed files with 13 additions and 3 deletions

View File

@@ -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