An open API service indexing awesome lists of open source software.

https://github.com/drbenjamin/rag-on-snow

LLM utilizing RAG on Snowflake.
https://github.com/drbenjamin/rag-on-snow

llm rag snowflake streamlit

Last synced: about 2 months ago
JSON representation

LLM utilizing RAG on Snowflake.

Awesome Lists containing this project

README

          

# RAG on Snow

This application stores unstructured data from documents and other sources like
images and video in a Snowflake DB utilizing Langchain to query this data. The
application is built using Streamlit and uses `StreamlitChatMessageHistory` for
memory of the Snowflake Cortex generated embeddings.

## Langchain implementation (langchain-snowrag)

[Tutorial on Medium](https://medium.com/snowflake/integrating-langchain-with-snowflake-cortex-0367f934f1c1).
See the [documentation](https://docs.snowflake.com/user-guide/snowflake-cortex/vector-embeddings#snowflake-python-connector)
on Snowflake for more information.

## Setup

First create an environment using the `environment.yml` file:

```bash
# Creating a conda environment
conda env create --file environment.yml

# Activate the environment
conda activate snowrag
```

Now configure the Streamlit app in the `.streamlit/secrets.toml` file:

```toml
# Configuring LLM
[LLM]
LLM_CHATBOT_NAME = ""
LLM_SYSTEM = "Please write a short answer."
LLM_SYSTEM_PLUS = "Prioritize the most relevant information from the similarity search!"
LLM_ASSISTANT = "How can I help?"
LLM_USER_EXAMPLE = ""
LLM_ASSISTANT_EXAMPLE = "<>assistant_example>"

# Configuring Snowflake
[snowflake]
user = ""
account = ""
private_key_file = ""
role = ""
warehouse = ""
database = ""
schema = ""

# Configuring MinIO storage
[MinIO]
endpoint = "http://127.0.0.1:9000"
bucket = ""
access_key = ""
secret_key = ""
```

## Streamlit web app

Just run the following code:

```bash
# Running the Streamlit app
python -m streamlit run snowrag.py

# Checking the Streamlit app
lsof -i :8501
```