https://github.com/hwchase17/conversation-qa-gradio
https://github.com/hwchase17/conversation-qa-gradio
Last synced: 8 months ago
JSON representation
- Host: GitHub
- URL: https://github.com/hwchase17/conversation-qa-gradio
- Owner: hwchase17
- Created: 2023-07-17T19:27:03.000Z (almost 3 years ago)
- Default Branch: master
- Last Pushed: 2023-07-18T00:15:32.000Z (almost 3 years ago)
- Last Synced: 2025-04-04T20:09:48.075Z (about 1 year ago)
- Language: Python
- Size: 20.5 KB
- Stars: 51
- Watchers: 3
- Forks: 8
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
- awesome-data-science-resources - Conversation QA Gradio
README
# LangChain <> Gradio Custom QA Over Docs Bot
This repo shows how to create a Chatbot over your documents using LangChain and Gradio.
Importantly, this has an emphasis on using some of the lower level components of LangChain rather than a predefined chain.
This also uses:
- Cohere for embeddings
- ChromaDB for a vectorstore
- OpenAI for a text generation model
## Setup
To setup, please install requirements with `pip install -r requirements.txt`
Then, set various environment variables:
```shell
export OPENAI_API_KEY=...
export COHERE_API_KEY=
```
## Ingest
First, we need to ingest data.
For this example, we will work with a state of the union address (`state_of_the_union.txt`).
You can modify the code in `ingest.py` to ingest anything you want.
To ingest, run `python ingest.py`
## Chat
Now we can chat with this data! In order to do that, run `python app.py`.
This will spin up a Gradio application that you can chat with in the frontend.
For details on how to customize the chatbot, see the code in `app.py`.
The code in `app.py` should be well commented so you can understand what is going on.