[Docs] add docs for youtube channel (#1072)
Co-authored-by: Deven Patel <deven298@yahoo.com>
This commit is contained in:
@@ -189,8 +189,7 @@ class EmbedChain(JSONSerializable):
|
||||
data_type = detect_datatype(source)
|
||||
|
||||
# `source_hash` is the md5 hash of the source argument
|
||||
hash_object = hashlib.md5(str(source).encode("utf-8"))
|
||||
source_hash = hash_object.hexdigest()
|
||||
source_hash = hashlib.md5(str(source).encode("utf-8")).hexdigest()
|
||||
|
||||
self.user_asks.append([source, data_type.value, metadata])
|
||||
|
||||
|
||||
@@ -27,6 +27,7 @@ class DirectoryLoader(BaseLoader):
|
||||
if not directory_path.is_dir():
|
||||
raise ValueError(f"Invalid path: {path}")
|
||||
|
||||
logging.info(f"Loading data from directory: {path}")
|
||||
data_list = self._process_directory(directory_path)
|
||||
doc_id = hashlib.sha256((str(data_list) + str(directory_path)).encode()).hexdigest()
|
||||
|
||||
@@ -44,6 +45,8 @@ class DirectoryLoader(BaseLoader):
|
||||
if file_path.is_file() and (not self.extensions or any(file_path.suffix == ext for ext in self.extensions)):
|
||||
loader = self._predict_loader(file_path)
|
||||
data_list.extend(loader.load_data(str(file_path))["data"])
|
||||
elif file_path.is_dir():
|
||||
logging.info(f"Loading data from directory: {file_path}")
|
||||
return data_list
|
||||
|
||||
def _predict_loader(self, file_path: Path) -> BaseLoader:
|
||||
|
||||
@@ -358,10 +358,6 @@ def is_valid_json_string(source: str):
|
||||
_ = json.loads(source)
|
||||
return True
|
||||
except json.JSONDecodeError:
|
||||
logging.error(
|
||||
"Insert valid string format of JSON. \
|
||||
Check the docs to see the supported formats - `https://docs.embedchain.ai/data-sources/json`"
|
||||
)
|
||||
return False
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user