Browse Source

refactor: use llama hub instead of llama index (#592)

cachho 1 năm trước cách đây
mục cha
commit
dfe0b414ac
2 tập tin đã thay đổi với 3 bổ sung5 xóa
  1. 1 3
      embedchain/loaders/notion.py
  2. 2 2
      pyproject.toml

+ 1 - 3
embedchain/loaders/notion.py

@@ -2,7 +2,7 @@ import logging
 import os
 
 try:
-    from llama_index import download_loader
+    from llama_hub.notion.base import NotionPageReader
 except ImportError:
     raise ImportError(
         "Notion requires extra dependencies. Install with `pip install --upgrade embedchain[community]`"
@@ -19,8 +19,6 @@ class NotionLoader(BaseLoader):
     def load_data(self, source):
         """Load data from a PDF file."""
 
-        NotionPageReader = download_loader("NotionPageReader")
-
         # Reformat Id to match notion expectation
         id = source[-32:]
         formatted_id = f"{id[:8]}-{id[8:12]}-{id[12:16]}-{id[16:20]}-{id[20:]}"

+ 2 - 2
pyproject.toml

@@ -91,7 +91,7 @@ youtube-transcript-api = "^0.6.1"
 beautifulsoup4 = "^4.12.2"
 pypdf = "^3.11.0"
 pytube = "^15.0.0"
-llama-index = { version = "^0.7.21", optional = true }
+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 }
 # Torch 2.0.1 is not compatible with poetry (https://github.com/pytorch/pytorch/issues/100974)
@@ -118,7 +118,7 @@ isort = "^5.12.0"
 
 [tool.poetry.extras]
 streamlit = ["streamlit"]
-community = ["llama-index"]
+community = ["llama-hub"]
 opensource = ["sentence-transformers", "torch", "gpt4all"]
 elasticsearch = ["elasticsearch"]
 poe = ["fastapi-poe"]