From 7a6600be7aae4882b76c778a6cd24bbbeadb4288 Mon Sep 17 00:00:00 2001 From: Alexej Penner Date: Mon, 30 Oct 2023 15:25:44 +0100 Subject: [PATCH] Allow running on remote orchestrator --- .../src/local_testing_slackbot.py | 3 ++- .../src/pipelines/index_builder.py | 23 ++++++++++++++++--- 2 files changed, 22 insertions(+), 4 deletions(-) diff --git a/langchain-llamaindex-slackbot/src/local_testing_slackbot.py b/langchain-llamaindex-slackbot/src/local_testing_slackbot.py index f492a5ff..7bd8f8f8 100644 --- a/langchain-llamaindex-slackbot/src/local_testing_slackbot.py +++ b/langchain-llamaindex-slackbot/src/local_testing_slackbot.py @@ -77,7 +77,7 @@ def reply_in_thread(body: dict, say, context): thread_ts = event.get("thread_ts", None) or event["ts"] if context["bot_user_id"] in event["text"]: - logger.debug(f"Received message: {event['text']}") + logger.info(f"Received message: {event['text']}") if event.get("thread_ts", None): full_thread = [ f"{msg['text']}" @@ -107,6 +107,7 @@ def reply_in_thread(body: dict, say, context): question=event["text"], verbose=True, ) + logger.info(output) say(text=output, thread_ts=thread_ts) diff --git a/langchain-llamaindex-slackbot/src/pipelines/index_builder.py b/langchain-llamaindex-slackbot/src/pipelines/index_builder.py index f0275226..3c71e67c 100644 --- a/langchain-llamaindex-slackbot/src/pipelines/index_builder.py +++ b/langchain-llamaindex-slackbot/src/pipelines/index_builder.py @@ -11,17 +11,34 @@ # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express # or implied. See the License for the specific language governing # permissions and limitations under the License. - +import os from steps.index_generator import index_generator from steps.url_scraper import url_scraper from steps.web_url_loader import web_url_loader from zenml import pipeline +from zenml.config import DockerSettings pipeline_name = "zenml_docs_index_generation" +docker_settings = DockerSettings( + requirements=[ + "langchain==0.0.263", + "openai==0.27.2", + "slack-bolt==1.16.2", + "slack-sdk==3.20.0", + "fastapi", + "flask", + "uvicorn", + "gcsfs==2023.5.0", + "faiss-cpu==1.7.3", + "unstructured==0.5.7", + "tiktoken", + "bs4" + ], + environment={"OPENAI_API_KEY": os.getenv("OPENAI_API_KEY")} +) - -@pipeline(name=pipeline_name) +@pipeline(name=pipeline_name, settings={"docker": docker_settings}) def docs_to_index_pipeline( docs_url: str = "", repo_url: str = "",