fix: dependencies (#416)

This commit is contained in:
cachho
2023-08-24 23:23:25 +02:00
committed by GitHub
parent d8d0e0e5d1
commit ed319531bf
6 changed files with 16 additions and 50 deletions

View File

@@ -63,6 +63,7 @@ app = OpenSourceApp()
- Here there is no need to setup any api keys. You just need to install embedchain package and these will get automatically installed. 📦
- Once you have imported and instantiated the app, every functionality from here onwards is the same for either type of app. 📚
- `OpenSourceApp` is opinionated. It uses the best open source embedding model and LLM on the market.
- extra dependencies are required for this app type. Install them with `pip install embedchain[opensource]`.
### CustomApp

View File

@@ -68,7 +68,7 @@ class CustomApp(EmbedChain):
return CustomApp._get_azure_openai_answer(prompt, config)
except ImportError as e:
raise ImportError(e.msg) from None
raise ModuleNotFoundError(e.msg) from None
@staticmethod
def _get_openai_answer(prompt: str, config: ChatConfig) -> str:

View File

@@ -43,8 +43,8 @@ class OpenSourceApp(EmbedChain):
try:
from gpt4all import GPT4All
except ModuleNotFoundError:
raise ValueError(
"The GPT4All python package is not installed. Please install it with `pip install GPT4All`"
raise ModuleNotFoundError(
"The GPT4All python package is not installed. Please install it with `pip install embedchain[opensource]`" # noqa E501
) from None
return GPT4All(model)

View File

@@ -50,4 +50,10 @@ class OpenSourceAppConfig(BaseAppConfig):
:returns: The default embedding function
"""
return embedding_functions.SentenceTransformerEmbeddingFunction(model_name="all-MiniLM-L6-v2")
try:
return embedding_functions.SentenceTransformerEmbeddingFunction(model_name="all-MiniLM-L6-v2")
except ValueError as e:
print(e)
raise ModuleNotFoundError(
"The open source app requires extra dependencies. Install with `pip install embedchain[opensource]`"
) from None

View File

@@ -91,6 +91,10 @@ beautifulsoup4 = "^4.12.2"
pypdf = "^3.11.0"
pytube = "^15.0.0"
llama-index = { version = "^0.7.21", 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)
gpt4all = { version = "^1.0.8", optional = true }
elasticsearch = { version = "^8.9.0", optional = true }
flask = "^2.3.3"
twilio = "^8.5.0"
@@ -110,6 +114,7 @@ isort = "^5.12.0"
[tool.poetry.extras]
streamlit = ["streamlit"]
community = ["llama-index"]
opensource = ["sentence-transformers", "torch", "gpt4all"]
elasticsearch = ["elasticsearch"]
[tool.poetry.group.docs.dependencies]

View File

@@ -1,46 +0,0 @@
import setuptools
with open("README.md", "r", encoding="utf-8") as fh:
long_description = fh.read()
setuptools.setup(
name="embedchain",
version="0.0.41",
author="Taranjeet Singh",
author_email="reachtotj@gmail.com",
description="embedchain is a framework to easily create LLM powered bots over any dataset", # noqa:E501
long_description=long_description,
long_description_content_type="text/markdown",
url="https://github.com/embedchain/embedchain",
packages=setuptools.find_packages(),
classifiers=[
"Programming Language :: Python :: 3",
"License :: OSI Approved :: Apache Software License",
"Operating System :: OS Independent",
],
python_requires=">=3.8",
py_modules=["embedchain"],
install_requires=[
"langchain>=0.0.205",
"requests",
"openai",
"chromadb>=0.4.2",
"youtube-transcript-api",
"beautifulsoup4",
"pypdf",
"pytube",
"lxml",
"gpt4all",
"sentence_transformers",
"docx2txt",
"pydantic==1.10.8",
"replicate==0.9.0",
"duckduckgo-search==3.8.4",
],
extras_require={
"dev": ["black", "ruff", "isort", "pytest"],
"community": ["llama-index==0.7.21"],
"elasticsearch": ["elasticsearch>=8.9.0"],
"whatsapp": ["twilio==8.5.0", "flask==1.1.2"],
},
)