File size: 1,556 Bytes
f8a66c4
ea4e986
 
 
 
f8a66c4
 
ea4e986
f8a66c4
ea4e986
f8a66c4
 
ea4e986
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
---
title: DnD QA Bot
emoji: 🗡️
colorFrom: purple
colorTo: yellow
sdk: streamlit
sdk_version: 1.19.0
app_file: main.py
license: agpl-3.0
python: 3.10.9
---

# 🗡️D&D Spell QA Bot🗡️

This is a chatbot that can answer questions about **Dungeon and Dragons spells** based on this [database](https://www.aidedd.org/dnd-filters/spells-5e.php) and built with LangChain and OpenAI API. Usefull to find informations quickly instead of browsing through 50 pages of PDF.
The creator of this bot is **[Corentin Meyer (@corentinm_py)](https://twitter.com/corentinm_py)**.  
💪 This bot it based on Notion Question-Answering demo from [LangChain](https://github.com/hwchase17/langchain)

# 🌲 Environment Setup

In order to set your environment up to run the code here, first install all requirements and then launch streamlit app:

```shell
python -m venv .venv
source .venv/bin/activate
pip install -r requirements.txt
streamlit run main.py
```

Then set your OpenAI API key (if you don't have one, get one [here](https://beta.openai.com/playground))

```shell
export OPENAI_API_KEY=....
```

## 🚀 Code to deploy on StreamLit

The code to run the StreamLit app is in `main.py`.
Note that when setting up your StreamLit app you should make sure to add `OPENAI_API_KEY` as a secret environment variable.

## 🧑 Reproduce the embedding and stuff

Run the following command to ingest the data.

```shell
python ingest.py
```

Boom! Now you're done, and you can ask it questions like:

```shell
python qa.py "What's the size of tsunami spell ?"
```