From dc31714ec55cfee195682f357c27b8db529af8ca Mon Sep 17 00:00:00 2001 From: Tyler Hutcherson Date: Thu, 30 Nov 2023 15:22:13 -0500 Subject: [PATCH] templates[patch]: Rag redis template dependency update (#13614) - **Description:** Update RAG Redis template readme and dependencies. --- templates/rag-redis/README.md | 27 +++++++++++++++------------ templates/rag-redis/pyproject.toml | 2 +- 2 files changed, 16 insertions(+), 13 deletions(-) diff --git a/templates/rag-redis/README.md b/templates/rag-redis/README.md index c22bded4560..faf8dc94905 100644 --- a/templates/rag-redis/README.md +++ b/templates/rag-redis/README.md @@ -1,15 +1,19 @@ # rag-redis -This template performs RAG using Redis and OpenAI on financial 10k filings docs (for Nike). +This template performs RAG using Redis (vector database) and OpenAI (LLM) on financial 10k filings docs for Nike. It relies on the sentence transformer `all-MiniLM-L6-v2` for embedding chunks of the pdf and user questions. ## Environment Setup -Set the `OPENAI_API_KEY` environment variable to access the OpenAI models. +Set the `OPENAI_API_KEY` environment variable to access the [OpenAI](https://platform.openai.com) models: -The following Redis environment variables need to be set: +```bash +export OPENAI_API_KEY= +``` + +Set the following [Redis](https://redis.com/try-free) environment variables: ```bash export REDIS_HOST = @@ -33,10 +37,10 @@ We use a variety of environment variables to configure this application ## Usage -To use this package, you should first have the LangChain CLI installed: +To use this package, you should first have the LangChain CLI and Pydantic installed in a Python virtual environment: ```shell -pip install -U langchain-cli +pip install -U langchain-cli pydantic==1.10.13 ``` To create a new LangChain project and install this as the only package, you can do: @@ -46,21 +50,20 @@ langchain app new my-app --package rag-redis ``` If you want to add this to an existing project, you can just run: - ```shell langchain app add rag-redis ``` -And add the following code to your `server.py` file: +And add the following code snippet to your `app/server.py` file: ```python from rag_redis.chain import chain as rag_redis_chain add_routes(app, rag_redis_chain, path="/rag-redis") ``` -(Optional) Let's now configure LangSmith. -LangSmith will help us trace, monitor and debug LangChain applications. -LangSmith is currently in private beta, you can sign up [here](https://smith.langchain.com/). +(Optional) Let's now configure LangSmith. +LangSmith will help us trace, monitor and debug LangChain applications. +LangSmith is currently in private beta, you can sign up [here](https://smith.langchain.com/). If you don't have access, you can skip this section @@ -76,11 +79,11 @@ If you are inside this directory, then you can spin up a LangServe instance dire langchain serve ``` -This will start the FastAPI app with a server is running locally at +This will start the FastAPI app with a server is running locally at [http://localhost:8000](http://localhost:8000) We can see all templates at [http://127.0.0.1:8000/docs](http://127.0.0.1:8000/docs) -We can access the playground at [http://127.0.0.1:8000/rag-redis/playground](http://127.0.0.1:8000/rag-redis/playground) +We can access the playground at [http://127.0.0.1:8000/rag-redis/playground](http://127.0.0.1:8000/rag-redis/playground) We can access the template from code with: diff --git a/templates/rag-redis/pyproject.toml b/templates/rag-redis/pyproject.toml index e734ae49e1f..fd1adc2989f 100644 --- a/templates/rag-redis/pyproject.toml +++ b/templates/rag-redis/pyproject.toml @@ -36,7 +36,7 @@ export_attr = "chain" [tool.templates-hub] use-case = "rag" author = "Redis" -integrations = ["OpenAI", "Redis"] +integrations = ["OpenAI", "Redis", "HuggingFace"] tags = ["vectordbs"] [tool.poe.tasks.start]