From 3d2d855e2f3162680f81a16a4daf89cf39673564 Mon Sep 17 00:00:00 2001 From: Dev Khant Date: Tue, 5 Sep 2023 10:50:46 +0530 Subject: [PATCH 1/8] Lint and formatting fixes --- embedchain/__init__.py | 3 +-- embedchain/bots/__init__.py | 7 +++---- embedchain/bots/base.py | 3 +-- embedchain/bots/whatsapp.py | 5 +++-- embedchain/config/__init__.py | 3 +-- embedchain/config/apps/CustomAppConfig.py | 3 +-- embedchain/utils.py | 3 +-- 7 files changed, 11 insertions(+), 16 deletions(-) diff --git a/embedchain/__init__.py b/embedchain/__init__.py index 7fd6ce441b..50ea5954d8 100644 --- a/embedchain/__init__.py +++ b/embedchain/__init__.py @@ -6,5 +6,4 @@ from embedchain.apps.CustomApp import CustomApp # noqa: F401 from embedchain.apps.Llama2App import Llama2App # noqa: F401 from embedchain.apps.OpenSourceApp import OpenSourceApp # noqa: F401 -from embedchain.apps.PersonApp import (PersonApp, # noqa: F401 - PersonOpenSourceApp) +from embedchain.apps.PersonApp import PersonApp, PersonOpenSourceApp # noqa: F401 diff --git a/embedchain/bots/__init__.py b/embedchain/bots/__init__.py index b7f4d5a007..958c00d54e 100644 --- a/embedchain/bots/__init__.py +++ b/embedchain/bots/__init__.py @@ -1,4 +1,3 @@ -from embedchain.bots.poe import PoeBot -from embedchain.bots.whatsapp import WhatsAppBot -# TODO: fix discord import -# from embedchain.bots.discord import DiscordBot \ No newline at end of file +from embedchain.bots.poe import PoeBot # noqa: F401 +from embedchain.bots.whatsapp import WhatsAppBot # noqa: F401 +from embedchain.bots.discord import DiscordBot # noqa: F401 diff --git a/embedchain/bots/base.py b/embedchain/bots/base.py index 48cfb71c7c..e4747eb4f6 100644 --- a/embedchain/bots/base.py +++ b/embedchain/bots/base.py @@ -1,7 +1,6 @@ from embedchain import CustomApp from embedchain.config import AddConfig, CustomAppConfig, QueryConfig -from embedchain.helper_classes.json_serializable import ( - JSONSerializable, register_deserializable) +from embedchain.helper_classes.json_serializable import JSONSerializable, register_deserializable from embedchain.models import EmbeddingFunctions, Providers diff --git a/embedchain/bots/whatsapp.py b/embedchain/bots/whatsapp.py index cd9d1eaf67..2d24118356 100644 --- a/embedchain/bots/whatsapp.py +++ b/embedchain/bots/whatsapp.py @@ -3,6 +3,9 @@ import signal import sys +from flask import Flask, request +from twilio.twiml.messaging_response import MessagingResponse + from embedchain.helper_classes.json_serializable import register_deserializable from .base import BaseBot @@ -11,8 +14,6 @@ @register_deserializable class WhatsAppBot(BaseBot): def __init__(self): - from flask import Flask, request - from twilio.twiml.messaging_response import MessagingResponse super().__init__() def handle_message(self, message): diff --git a/embedchain/config/__init__.py b/embedchain/config/__init__.py index fc8bc45099..684b63fa7e 100644 --- a/embedchain/config/__init__.py +++ b/embedchain/config/__init__.py @@ -5,5 +5,4 @@ from .BaseConfig import BaseConfig # noqa: F401 from .ChatConfig import ChatConfig # noqa: F401 from .QueryConfig import QueryConfig # noqa: F401 -from .vectordbs.ElasticsearchDBConfig import \ - ElasticsearchDBConfig # noqa: F401 +from .vectordbs.ElasticsearchDBConfig import ElasticsearchDBConfig # noqa: F401 diff --git a/embedchain/config/apps/CustomAppConfig.py b/embedchain/config/apps/CustomAppConfig.py index d6dfe4864d..ed59e7adcc 100644 --- a/embedchain/config/apps/CustomAppConfig.py +++ b/embedchain/config/apps/CustomAppConfig.py @@ -5,8 +5,7 @@ from embedchain.config.vectordbs import ElasticsearchDBConfig from embedchain.helper_classes.json_serializable import register_deserializable -from embedchain.models import (EmbeddingFunctions, Providers, VectorDatabases, - VectorDimensions) +from embedchain.models import EmbeddingFunctions, Providers, VectorDatabases, VectorDimensions from .BaseAppConfig import BaseAppConfig diff --git a/embedchain/utils.py b/embedchain/utils.py index b04b0957c1..ee7542069a 100644 --- a/embedchain/utils.py +++ b/embedchain/utils.py @@ -128,8 +128,7 @@ def detect_datatype(source: Any) -> DataType: formatted_source = format_source(str(source), 30) if url: - from langchain.document_loaders.youtube import \ - ALLOWED_NETLOCK as YOUTUBE_ALLOWED_NETLOCS + from langchain.document_loaders.youtube import ALLOWED_NETLOCK as YOUTUBE_ALLOWED_NETLOCS if url.netloc in YOUTUBE_ALLOWED_NETLOCS: logging.debug(f"Source of `{formatted_source}` detected as `youtube_video`.") From b4b7f3b044a7e088f2e17994e9ebfe9fde80b3cb Mon Sep 17 00:00:00 2001 From: Dev Khant Date: Tue, 5 Sep 2023 11:35:49 +0530 Subject: [PATCH 2/8] lazy import for whatsapp bot --- embedchain/bots/__init__.py | 4 +++- embedchain/bots/whatsapp.py | 13 +++++++------ 2 files changed, 10 insertions(+), 7 deletions(-) diff --git a/embedchain/bots/__init__.py b/embedchain/bots/__init__.py index 958c00d54e..34cef58f26 100644 --- a/embedchain/bots/__init__.py +++ b/embedchain/bots/__init__.py @@ -1,3 +1,5 @@ from embedchain.bots.poe import PoeBot # noqa: F401 from embedchain.bots.whatsapp import WhatsAppBot # noqa: F401 -from embedchain.bots.discord import DiscordBot # noqa: F401 + +# TODO: fix discord import +# from embedchain.bots.discord import DiscordBot diff --git a/embedchain/bots/whatsapp.py b/embedchain/bots/whatsapp.py index 2d24118356..25c919c778 100644 --- a/embedchain/bots/whatsapp.py +++ b/embedchain/bots/whatsapp.py @@ -2,9 +2,7 @@ import logging import signal import sys - -from flask import Flask, request -from twilio.twiml.messaging_response import MessagingResponse +import importlib from embedchain.helper_classes.json_serializable import register_deserializable @@ -14,6 +12,9 @@ @register_deserializable class WhatsAppBot(BaseBot): def __init__(self): + self.flask = importlib.import_module("flask") + self.tiwlio = importlib.import_module("twilio") + super().__init__() def handle_message(self, message): @@ -42,7 +43,7 @@ def ask_bot(self, message): return response def start(self, host="0.0.0.0", port=5000, debug=True): - app = Flask(__name__) + app = self.flask.Flask(__name__) def signal_handler(sig, frame): logging.info("\nGracefully shutting down the WhatsAppBot...") @@ -52,9 +53,9 @@ def signal_handler(sig, frame): @app.route("/chat", methods=["POST"]) def chat(): - incoming_message = request.values.get("Body", "").lower() + incoming_message = self.flask.request.values.get("Body", "").lower() response = self.handle_message(incoming_message) - twilio_response = MessagingResponse() + twilio_response = self.twilio.twiml.messaging_response.MessagingResponse() twilio_response.message(response) return str(twilio_response) From 65305a9ae102b0e6c4fae007ca8cec78dd9f7831 Mon Sep 17 00:00:00 2001 From: Dev Khant Date: Tue, 5 Sep 2023 21:14:18 +0530 Subject: [PATCH 3/8] more formatting fixes --- tests/helper_classes/test_json_serializable.py | 3 +-- tests/llm/test_chat.py | 9 ++++----- tests/llm/test_query.py | 8 ++++---- tests/vectordb/test_chroma_db.py | 2 -- 4 files changed, 9 insertions(+), 13 deletions(-) diff --git a/tests/helper_classes/test_json_serializable.py b/tests/helper_classes/test_json_serializable.py index 36b0f0458b..48abea9402 100644 --- a/tests/helper_classes/test_json_serializable.py +++ b/tests/helper_classes/test_json_serializable.py @@ -3,8 +3,7 @@ from embedchain import App from embedchain.config import AppConfig -from embedchain.helper_classes.json_serializable import ( - JSONSerializable, register_deserializable) +from embedchain.helper_classes.json_serializable import JSONSerializable, register_deserializable class TestJsonSerializable(unittest.TestCase): diff --git a/tests/llm/test_chat.py b/tests/llm/test_chat.py index cb50a89533..ec6df90e86 100644 --- a/tests/llm/test_chat.py +++ b/tests/llm/test_chat.py @@ -1,4 +1,3 @@ - import os import unittest from unittest.mock import patch, MagicMock @@ -88,8 +87,8 @@ def test_chat_with_where_in_params(self): self.assertEqual(answer, "Test answer") _args, kwargs = mock_retrieve.call_args - self.assertEqual(kwargs.get('input_query'), "Test query") - self.assertEqual(kwargs.get('where'), {"attribute": "value"}) + self.assertEqual(kwargs.get("input_query"), "Test query") + self.assertEqual(kwargs.get("where"), {"attribute": "value"}) mock_answer.assert_called_once() @patch("chromadb.api.models.Collection.Collection.add", MagicMock) @@ -120,6 +119,6 @@ def test_chat_with_where_in_chat_config(self): self.assertEqual(answer, "Test answer") _args, kwargs = mock_database_query.call_args - self.assertEqual(kwargs.get('input_query'), "Test query") - self.assertEqual(kwargs.get('where'), {"attribute": "value"}) + self.assertEqual(kwargs.get("input_query"), "Test query") + self.assertEqual(kwargs.get("where"), {"attribute": "value"}) mock_answer.assert_called_once() diff --git a/tests/llm/test_query.py b/tests/llm/test_query.py index 55bbb7660a..e16ebc90bc 100644 --- a/tests/llm/test_query.py +++ b/tests/llm/test_query.py @@ -109,8 +109,8 @@ def test_query_with_where_in_params(self): self.assertEqual(answer, "Test answer") _args, kwargs = mock_retrieve.call_args - self.assertEqual(kwargs.get('input_query'), "Test query") - self.assertEqual(kwargs.get('where'), {"attribute": "value"}) + self.assertEqual(kwargs.get("input_query"), "Test query") + self.assertEqual(kwargs.get("where"), {"attribute": "value"}) mock_answer.assert_called_once() @patch("chromadb.api.models.Collection.Collection.add", MagicMock) @@ -142,6 +142,6 @@ def test_query_with_where_in_query_config(self): self.assertEqual(answer, "Test answer") _args, kwargs = mock_database_query.call_args - self.assertEqual(kwargs.get('input_query'), "Test query") - self.assertEqual(kwargs.get('where'), {"attribute": "value"}) + self.assertEqual(kwargs.get("input_query"), "Test query") + self.assertEqual(kwargs.get("where"), {"attribute": "value"}) mock_answer.assert_called_once() diff --git a/tests/vectordb/test_chroma_db.py b/tests/vectordb/test_chroma_db.py index 3188289bcf..91a386bbec 100644 --- a/tests/vectordb/test_chroma_db.py +++ b/tests/vectordb/test_chroma_db.py @@ -7,7 +7,6 @@ from embedchain import App from embedchain.config import AppConfig, ChromaDbConfig -from embedchain.models import EmbeddingFunctions, Providers from embedchain.vectordb.chroma_db import ChromaDB @@ -86,7 +85,6 @@ def test_init_with_host_and_port_log_level(self, mock_client): """ Test if the `App` instance is initialized without a config that does not contain default hosts and ports. """ - config = AppConfig(log_level="DEBUG") _app = App(config=AppConfig(collect_metrics=False)) From f72ae893d4d31a3ea1c1de1de98081520bc95766 Mon Sep 17 00:00:00 2001 From: Dev Khant Date: Tue, 5 Sep 2023 21:32:48 +0530 Subject: [PATCH 4/8] Handle if no module found for whatsapp --- embedchain/bots/whatsapp.py | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/embedchain/bots/whatsapp.py b/embedchain/bots/whatsapp.py index 25c919c778..6baad15fc1 100644 --- a/embedchain/bots/whatsapp.py +++ b/embedchain/bots/whatsapp.py @@ -12,9 +12,14 @@ @register_deserializable class WhatsAppBot(BaseBot): def __init__(self): - self.flask = importlib.import_module("flask") - self.tiwlio = importlib.import_module("twilio") - + try: + self.flask = importlib.import_module("flask") + self.twilio = importlib.import_module("twilio") + except ModuleNotFoundError: + raise ModuleNotFoundError( + "The required dependencies for Whatsapp are not installed." + 'Please install with `pip install "embedchain[whatsapp]"`' + ) from None super().__init__() def handle_message(self, message): From 657ff28947b6f8e1159ee7e98698f2f0fe94defc Mon Sep 17 00:00:00 2001 From: cachho Date: Tue, 5 Sep 2023 23:24:55 +0200 Subject: [PATCH 5/8] chore: linting --- embedchain/__init__.py | 3 ++- embedchain/apps/App.py | 3 ++- embedchain/apps/OpenSourceApp.py | 3 ++- embedchain/apps/PersonApp.py | 3 ++- embedchain/bots/base.py | 3 ++- embedchain/bots/whatsapp.py | 2 +- embedchain/llm/antrophic_llm.py | 3 +-- embedchain/llm/azure_openai_llm.py | 3 +-- embedchain/llm/base_llm.py | 8 +++----- embedchain/llm/gpt4all_llm.py | 3 +-- embedchain/llm/llama2_llm.py | 3 +-- embedchain/llm/openai_llm.py | 3 +-- embedchain/llm/vertex_ai_llm.py | 3 +-- embedchain/utils.py | 3 ++- tests/helper_classes/test_json_serializable.py | 3 ++- tests/llm/test_chat.py | 2 +- 16 files changed, 25 insertions(+), 26 deletions(-) diff --git a/embedchain/__init__.py b/embedchain/__init__.py index ae8045d241..2ae5c9f6b7 100644 --- a/embedchain/__init__.py +++ b/embedchain/__init__.py @@ -6,6 +6,7 @@ from embedchain.apps.CustomApp import CustomApp # noqa: F401 from embedchain.apps.Llama2App import Llama2App # noqa: F401 from embedchain.apps.OpenSourceApp import OpenSourceApp # noqa: F401 -from embedchain.apps.PersonApp import PersonApp, PersonOpenSourceApp # noqa: F401 +from embedchain.apps.PersonApp import (PersonApp, # noqa: F401 + PersonOpenSourceApp) from embedchain.vectordb.chroma_db import ChromaDB # noqa: F401 from embedchain.vectordb.elasticsearch_db import ElasticsearchDB # noqa: F401 diff --git a/embedchain/apps/App.py b/embedchain/apps/App.py index 3788850de9..0ee8a67694 100644 --- a/embedchain/apps/App.py +++ b/embedchain/apps/App.py @@ -1,6 +1,7 @@ from typing import Optional -from embedchain.config import AppConfig, BaseEmbedderConfig, BaseLlmConfig, ChromaDbConfig +from embedchain.config import (AppConfig, BaseEmbedderConfig, BaseLlmConfig, + ChromaDbConfig) from embedchain.embedchain import EmbedChain from embedchain.embedder.openai_embedder import OpenAiEmbedder from embedchain.helper_classes.json_serializable import register_deserializable diff --git a/embedchain/apps/OpenSourceApp.py b/embedchain/apps/OpenSourceApp.py index 463d08c39d..f701cd5b04 100644 --- a/embedchain/apps/OpenSourceApp.py +++ b/embedchain/apps/OpenSourceApp.py @@ -1,7 +1,8 @@ import logging from typing import Optional -from embedchain.config import BaseEmbedderConfig, BaseLlmConfig, ChromaDbConfig, OpenSourceAppConfig +from embedchain.config import (BaseEmbedderConfig, BaseLlmConfig, + ChromaDbConfig, OpenSourceAppConfig) from embedchain.embedchain import EmbedChain from embedchain.embedder.gpt4all_embedder import GPT4AllEmbedder from embedchain.helper_classes.json_serializable import register_deserializable diff --git a/embedchain/apps/PersonApp.py b/embedchain/apps/PersonApp.py index bf2949fa36..971c7e352f 100644 --- a/embedchain/apps/PersonApp.py +++ b/embedchain/apps/PersonApp.py @@ -4,7 +4,8 @@ from embedchain.apps.OpenSourceApp import OpenSourceApp from embedchain.config import BaseLlmConfig from embedchain.config.apps.BaseAppConfig import BaseAppConfig -from embedchain.config.llm.base_llm_config import DEFAULT_PROMPT, DEFAULT_PROMPT_WITH_HISTORY +from embedchain.config.llm.base_llm_config import (DEFAULT_PROMPT, + DEFAULT_PROMPT_WITH_HISTORY) from embedchain.helper_classes.json_serializable import register_deserializable diff --git a/embedchain/bots/base.py b/embedchain/bots/base.py index 5a14e67812..0b47a2e852 100644 --- a/embedchain/bots/base.py +++ b/embedchain/bots/base.py @@ -1,7 +1,8 @@ from embedchain import CustomApp from embedchain.config import AddConfig, CustomAppConfig, LlmConfig from embedchain.embedder.openai_embedder import OpenAiEmbedder -from embedchain.helper_classes.json_serializable import JSONSerializable, register_deserializable +from embedchain.helper_classes.json_serializable import ( + JSONSerializable, register_deserializable) from embedchain.llm.openai_llm import OpenAiLlm from embedchain.vectordb.chroma_db import ChromaDB diff --git a/embedchain/bots/whatsapp.py b/embedchain/bots/whatsapp.py index 6baad15fc1..298d6140bb 100644 --- a/embedchain/bots/whatsapp.py +++ b/embedchain/bots/whatsapp.py @@ -1,8 +1,8 @@ import argparse +import importlib import logging import signal import sys -import importlib from embedchain.helper_classes.json_serializable import register_deserializable diff --git a/embedchain/llm/antrophic_llm.py b/embedchain/llm/antrophic_llm.py index b996e2be1e..90950fa6d2 100644 --- a/embedchain/llm/antrophic_llm.py +++ b/embedchain/llm/antrophic_llm.py @@ -2,9 +2,8 @@ from typing import Optional from embedchain.config import BaseLlmConfig -from embedchain.llm.base_llm import BaseLlm - from embedchain.helper_classes.json_serializable import register_deserializable +from embedchain.llm.base_llm import BaseLlm @register_deserializable diff --git a/embedchain/llm/azure_openai_llm.py b/embedchain/llm/azure_openai_llm.py index 4ced9ca16e..40703446a3 100644 --- a/embedchain/llm/azure_openai_llm.py +++ b/embedchain/llm/azure_openai_llm.py @@ -2,9 +2,8 @@ from typing import Optional from embedchain.config import BaseLlmConfig -from embedchain.llm.base_llm import BaseLlm - from embedchain.helper_classes.json_serializable import register_deserializable +from embedchain.llm.base_llm import BaseLlm @register_deserializable diff --git a/embedchain/llm/base_llm.py b/embedchain/llm/base_llm.py index 1317801786..ef49239237 100644 --- a/embedchain/llm/base_llm.py +++ b/embedchain/llm/base_llm.py @@ -3,14 +3,12 @@ from langchain.memory import ConversationBufferMemory from langchain.schema import BaseMessage -from embedchain.helper_classes.json_serializable import JSONSerializable from embedchain.config import BaseLlmConfig from embedchain.config.llm.base_llm_config import ( - DEFAULT_PROMPT, - DEFAULT_PROMPT_WITH_HISTORY_TEMPLATE, - DOCS_SITE_PROMPT_TEMPLATE, -) + DEFAULT_PROMPT, DEFAULT_PROMPT_WITH_HISTORY_TEMPLATE, + DOCS_SITE_PROMPT_TEMPLATE) +from embedchain.helper_classes.json_serializable import JSONSerializable class BaseLlm(JSONSerializable): diff --git a/embedchain/llm/gpt4all_llm.py b/embedchain/llm/gpt4all_llm.py index 1624ae9f8a..36ea325b5c 100644 --- a/embedchain/llm/gpt4all_llm.py +++ b/embedchain/llm/gpt4all_llm.py @@ -1,9 +1,8 @@ from typing import Iterable, Optional, Union from embedchain.config import BaseLlmConfig -from embedchain.llm.base_llm import BaseLlm - from embedchain.helper_classes.json_serializable import register_deserializable +from embedchain.llm.base_llm import BaseLlm @register_deserializable diff --git a/embedchain/llm/llama2_llm.py b/embedchain/llm/llama2_llm.py index 6a2d90a6e2..42ec1eff2f 100644 --- a/embedchain/llm/llama2_llm.py +++ b/embedchain/llm/llama2_llm.py @@ -4,9 +4,8 @@ from langchain.llms import Replicate from embedchain.config import BaseLlmConfig -from embedchain.llm.base_llm import BaseLlm - from embedchain.helper_classes.json_serializable import register_deserializable +from embedchain.llm.base_llm import BaseLlm @register_deserializable diff --git a/embedchain/llm/openai_llm.py b/embedchain/llm/openai_llm.py index 320079f756..f22b271fd9 100644 --- a/embedchain/llm/openai_llm.py +++ b/embedchain/llm/openai_llm.py @@ -3,9 +3,8 @@ import openai from embedchain.config import BaseLlmConfig -from embedchain.llm.base_llm import BaseLlm - from embedchain.helper_classes.json_serializable import register_deserializable +from embedchain.llm.base_llm import BaseLlm @register_deserializable diff --git a/embedchain/llm/vertex_ai_llm.py b/embedchain/llm/vertex_ai_llm.py index b1d47ad6a6..a5a9927a0f 100644 --- a/embedchain/llm/vertex_ai_llm.py +++ b/embedchain/llm/vertex_ai_llm.py @@ -2,9 +2,8 @@ from typing import Optional from embedchain.config import BaseLlmConfig -from embedchain.llm.base_llm import BaseLlm - from embedchain.helper_classes.json_serializable import register_deserializable +from embedchain.llm.base_llm import BaseLlm @register_deserializable diff --git a/embedchain/utils.py b/embedchain/utils.py index 059019d775..43c5ef694e 100644 --- a/embedchain/utils.py +++ b/embedchain/utils.py @@ -128,7 +128,8 @@ def detect_datatype(source: Any) -> DataType: formatted_source = format_source(str(source), 30) if url: - from langchain.document_loaders.youtube import ALLOWED_NETLOCK as YOUTUBE_ALLOWED_NETLOCS + from langchain.document_loaders.youtube import \ + ALLOWED_NETLOCK as YOUTUBE_ALLOWED_NETLOCS if url.netloc in YOUTUBE_ALLOWED_NETLOCS: logging.debug(f"Source of `{formatted_source}` detected as `youtube_video`.") diff --git a/tests/helper_classes/test_json_serializable.py b/tests/helper_classes/test_json_serializable.py index 48abea9402..36b0f0458b 100644 --- a/tests/helper_classes/test_json_serializable.py +++ b/tests/helper_classes/test_json_serializable.py @@ -3,7 +3,8 @@ from embedchain import App from embedchain.config import AppConfig -from embedchain.helper_classes.json_serializable import JSONSerializable, register_deserializable +from embedchain.helper_classes.json_serializable import ( + JSONSerializable, register_deserializable) class TestJsonSerializable(unittest.TestCase): diff --git a/tests/llm/test_chat.py b/tests/llm/test_chat.py index ec6df90e86..a5340b0798 100644 --- a/tests/llm/test_chat.py +++ b/tests/llm/test_chat.py @@ -1,6 +1,6 @@ import os import unittest -from unittest.mock import patch, MagicMock +from unittest.mock import MagicMock, patch from embedchain import App from embedchain.config import AppConfig, BaseLlmConfig From 4dc02138b67214e732583a002532c5fad7bc85ad Mon Sep 17 00:00:00 2001 From: cachho Date: Tue, 5 Sep 2023 23:30:51 +0200 Subject: [PATCH 6/8] fix: typo --- embedchain/bots/whatsapp.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/embedchain/bots/whatsapp.py b/embedchain/bots/whatsapp.py index 298d6140bb..7ee60201a9 100644 --- a/embedchain/bots/whatsapp.py +++ b/embedchain/bots/whatsapp.py @@ -17,7 +17,7 @@ def __init__(self): self.twilio = importlib.import_module("twilio") except ModuleNotFoundError: raise ModuleNotFoundError( - "The required dependencies for Whatsapp are not installed." + "The required dependencies for Whatsapp are not installed. " 'Please install with `pip install "embedchain[whatsapp]"`' ) from None super().__init__() From 8529d0e963c970be8784f9a012629d4b328a9f8f Mon Sep 17 00:00:00 2001 From: cachho Date: Tue, 5 Sep 2023 23:31:33 +0200 Subject: [PATCH 7/8] chore: added upgrade instruction --- embedchain/bots/whatsapp.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/embedchain/bots/whatsapp.py b/embedchain/bots/whatsapp.py index 7ee60201a9..f7997ab276 100644 --- a/embedchain/bots/whatsapp.py +++ b/embedchain/bots/whatsapp.py @@ -18,7 +18,7 @@ def __init__(self): except ModuleNotFoundError: raise ModuleNotFoundError( "The required dependencies for Whatsapp are not installed. " - 'Please install with `pip install "embedchain[whatsapp]"`' + 'Please install with `pip install --upgrade "embedchain[whatsapp]"`' ) from None super().__init__() From d5d6da26682a466e75a032306024ae87056d9b49 Mon Sep 17 00:00:00 2001 From: cachho Date: Tue, 5 Sep 2023 23:31:54 +0200 Subject: [PATCH 8/8] style: capitalization --- embedchain/bots/whatsapp.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/embedchain/bots/whatsapp.py b/embedchain/bots/whatsapp.py index f7997ab276..4cdd1a94c9 100644 --- a/embedchain/bots/whatsapp.py +++ b/embedchain/bots/whatsapp.py @@ -17,7 +17,7 @@ def __init__(self): self.twilio = importlib.import_module("twilio") except ModuleNotFoundError: raise ModuleNotFoundError( - "The required dependencies for Whatsapp are not installed. " + "The required dependencies for WhatsApp are not installed. " 'Please install with `pip install --upgrade "embedchain[whatsapp]"`' ) from None super().__init__()