You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
* updated requirements.txt for 5-min-rag-no-gpu
* add style.css file for 5-min-rag-no-gpu
* add Streamlit config folder for 5-min-rag-no-gpu
* updated README.md for 5-min-rag-no-gpu
* updated UI and certain deprecated models and functions in main.py for 5-min-rag-no-gpu
This implementation is tied to the [YouTube video on NVIDIA Developer](https://youtu.be/N_OOfkEWcOk).
3
+
This is a tutorial for how to build your own generic RAG chatbot. It is intended as a foundation for building more complex, domain-specific RAG bots. Note that no GPU is needed to run this as it is using NIMs from the NVIDIA catalog.
4
4
5
-
This is a simple standalone implementation showing a minimal RAG pipeline that uses models available from [NVIDIA API Catalog](https://catalog.ngc.nvidia.com/ai-foundation-models).
6
-
The catalog enables you to experience state-of-the-art LLMs accelerated by NVIDIA.
7
-
Developers get free credits for 10K requests to any of the models.
5
+
## Acknowledgements
8
6
9
-
The example uses an [integration package to LangChain](https://python.langchain.com/docs/integrations/providers/nvidia) to access the models.
10
-
NVIDIA engineers develop, test, and maintain the open source integration.
11
-
This example uses a simple [Streamlit](https://streamlit.io/) based user interface and has a one-file implementation.
12
-
Because the example uses the models from the NVIDIA API Catalog, you do not need a GPU to run the example.
7
+
- This implementation is based on [Rag in 5 Minutes](https://github.com/NVIDIA/GenerativeAIExamples/tree/4e86d75c813bcc41d4e92e430019053920d08c94/community/5_mins_rag_no_gpu), with changes primarily made to the UI.
8
+
- Alyssa Sawyer also contributed to updating and further developing this repo during her intern project, [Resume RAG Bot](https://github.com/alysawyer/resume-rag-nv), at NVIDIA.
13
9
14
-
###Steps
10
+
## Steps
15
11
16
12
1. Create a python virtual environment and activate it:
17
13
@@ -20,10 +16,10 @@ Because the example uses the models from the NVIDIA API Catalog, you do not need
20
16
source genai/bin/activate
21
17
```
22
18
23
-
1. From the root of this repository, `GenerativeAIExamples`, install the requirements:
19
+
1. From the root of this repository, install the requirements:
1. Add your NVIDIA API key as an environment variable:
@@ -32,17 +28,15 @@ Because the example uses the models from the NVIDIA API Catalog, you do not need
32
28
export NVIDIA_API_KEY="nvapi-*"
33
29
```
34
30
35
-
If you don't already have an API key, visit the [NVIDIA API Catalog](https://build.ngc.nvidia.com/explore/), select on any model, then click on `Get API Key`.
31
+
If you don't already have an API key, visit the [NVIDIA API Catalog](https://build.ngc.nvidia.com/explore/), select on any model, then click on `Get API Key`.
36
32
37
33
1. Run the example using Streamlit:
38
34
39
35
```console
40
-
streamlit run community/5_mins_rag_no_gpu/main.py
36
+
streamlit run main.py
41
37
```
42
38
43
39
1. Test the deployed example by going to `http://<host_ip>:8501` in a web browser.
44
40
45
-
Click **Browse Files** and select your knowledge source.
46
-
After selecting, click **Upload!** to complete the ingestion process.
47
-
48
-
You are all set now! Try out queries related to the knowledge base using text from the user interface.
41
+
Click **Browse Files** and select the documents for your knowledge base.
42
+
After selecting, click **Upload!** to complete the ingestion process.
st.markdown('''Manually looking through vast amounts of data can be tedious and time-consuming. This chatbot can expedite that process by providing a platform to query your documents.''')
45
+
st.warning("This is a proof of concept, and any output from the AI agent should be used in conjunction with the original data.", icon="⚠️")
46
+
47
+
############################################
48
+
# Component #1 - Document Loader
49
+
############################################
30
50
31
-
# Component #1 - Document Upload
32
51
withst.sidebar:
52
+
st.subheader("Upload Your Documents")
53
+
33
54
DOCS_DIR=os.path.abspath("./uploaded_docs")
55
+
56
+
# Make dir to store uploaded documents
34
57
ifnotos.path.exists(DOCS_DIR):
35
58
os.makedirs(DOCS_DIR)
59
+
60
+
# Define form on Streamlit page for uploading files to KB
36
61
st.subheader("Add to the Knowledge Base")
37
62
withst.form("my-form", clear_on_submit=True):
38
63
uploaded_files=st.file_uploader("Upload a file to the Knowledge Base:", accept_multiple_files=True)
("system", "You are a helpful AI assistant named Envie. If provided with context, use it to inform your responses. If no context is available, use your general knowledge to provide a helpful response."),
153
+
("system", "You are a helpful AI assistant. Use the provided contextto inform your responses. If no context is available, please state that."),
94
154
("human", "{input}")
95
155
])
96
156
157
+
# Define simple prompt chain
97
158
chain=prompt_template|llm|StrOutputParser()
98
159
99
-
user_input=st.chat_input("Can you tell me what NVIDIA is known for?")
160
+
# Display an example query for user
161
+
user_query=st.chat_input("Please summarize these documents.")
0 commit comments