refactor: use llama hub instead of llama index (#592)
This commit is contained in:
@@ -2,7 +2,7 @@ import logging
|
|||||||
import os
|
import os
|
||||||
|
|
||||||
try:
|
try:
|
||||||
from llama_index import download_loader
|
from llama_hub.notion.base import NotionPageReader
|
||||||
except ImportError:
|
except ImportError:
|
||||||
raise ImportError(
|
raise ImportError(
|
||||||
"Notion requires extra dependencies. Install with `pip install --upgrade embedchain[community]`"
|
"Notion requires extra dependencies. Install with `pip install --upgrade embedchain[community]`"
|
||||||
@@ -19,8 +19,6 @@ class NotionLoader(BaseLoader):
|
|||||||
def load_data(self, source):
|
def load_data(self, source):
|
||||||
"""Load data from a PDF file."""
|
"""Load data from a PDF file."""
|
||||||
|
|
||||||
NotionPageReader = download_loader("NotionPageReader")
|
|
||||||
|
|
||||||
# Reformat Id to match notion expectation
|
# Reformat Id to match notion expectation
|
||||||
id = source[-32:]
|
id = source[-32:]
|
||||||
formatted_id = f"{id[:8]}-{id[8:12]}-{id[12:16]}-{id[16:20]}-{id[20:]}"
|
formatted_id = f"{id[:8]}-{id[8:12]}-{id[12:16]}-{id[16:20]}-{id[20:]}"
|
||||||
|
|||||||
@@ -91,7 +91,7 @@ youtube-transcript-api = "^0.6.1"
|
|||||||
beautifulsoup4 = "^4.12.2"
|
beautifulsoup4 = "^4.12.2"
|
||||||
pypdf = "^3.11.0"
|
pypdf = "^3.11.0"
|
||||||
pytube = "^15.0.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 }
|
sentence-transformers = { version = "^2.2.2", optional = true }
|
||||||
torch = { version = ">=2.0.0, !=2.0.1", 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)
|
# 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]
|
[tool.poetry.extras]
|
||||||
streamlit = ["streamlit"]
|
streamlit = ["streamlit"]
|
||||||
community = ["llama-index"]
|
community = ["llama-hub"]
|
||||||
opensource = ["sentence-transformers", "torch", "gpt4all"]
|
opensource = ["sentence-transformers", "torch", "gpt4all"]
|
||||||
elasticsearch = ["elasticsearch"]
|
elasticsearch = ["elasticsearch"]
|
||||||
poe = ["fastapi-poe"]
|
poe = ["fastapi-poe"]
|
||||||
|
|||||||
Reference in New Issue
Block a user