Spaces:
Runtime error
Runtime error
KonradSzafer
commited on
Commit
•
beb9ff9
1
Parent(s):
799264a
remove readme
Browse files
README.md
DELETED
@@ -1,110 +0,0 @@
|
|
1 |
-
# Hugging Face Documentation Question Answering System
|
2 |
-
|
3 |
-
A multi-interface Q&A system that uses Hugging Face's LLM and Retrieval Augmented Generation (RAG) to deliver answers based on Hugging Face documentation. Operable as an API, Discord bot, or Gradio app, it also provides links to the documentation used to formulate each answer.
|
4 |
-
|
5 |
-
# Example
|
6 |
-
![Example](./assets/example.png)
|
7 |
-
|
8 |
-
# Table of Contents
|
9 |
-
- [Setting up](#setting-up)
|
10 |
-
- [Running](#running)
|
11 |
-
- [Gradio](#gradio)
|
12 |
-
- [API](#api-serving)
|
13 |
-
- [Discord Bot](#discord-bot)
|
14 |
-
- [Indexes](#indexes-list)
|
15 |
-
- [Development instructions](#development-instructions)
|
16 |
-
|
17 |
-
## Setting up
|
18 |
-
|
19 |
-
To execute any of the available interfaces, specify the required parameters in the `.env` file based on the `.env.example` located in the `config/` directory. Alternatively, you can set these as environment variables:
|
20 |
-
|
21 |
-
- `QUESTION_ANSWERING_MODEL_ID` - (str) A string that specifies either the model ID from the Hugging Face Hub or the directory containing the model weights
|
22 |
-
- `EMBEDDING_MODEL_ID` - (str) embedding model ID from the Hugging Face Hub. We recommend using the `hkunlp/instructor-large`
|
23 |
-
- `INDEX_REPO_ID` - (str) Repository ID from the Hugging Face Hub where the index is stored. List of the most actual indexes can be found in this section: [Indexes](#indexes-list)
|
24 |
-
- `PROMPT_TEMPLATE_NAME` - (str) Name of the model prompt template used for question answering, templates are stored in the `config/api/prompt_templates` directory
|
25 |
-
- `USE_DOCS_FOR_CONTEXT` - (bool) Use retrieved documents as a context for a given query
|
26 |
-
- `NUM_RELEVANT_DOCS` - (int) Number of documents used for the previous feature
|
27 |
-
- `ADD_SOURCES_TO_RESPONSE` - (bool) Include sources of the retrieved documents used as a context for a given query
|
28 |
-
- `USE_MESSAGES_IN_CONTEXT` - (bool) Use chat history for conversational experience
|
29 |
-
- `DEBUG` - (bool) Provides additional logging
|
30 |
-
|
31 |
-
Install the necessary dependencies from the requirements file:
|
32 |
-
|
33 |
-
```bash
|
34 |
-
pip install -r requirements.txt
|
35 |
-
```
|
36 |
-
|
37 |
-
## Running
|
38 |
-
|
39 |
-
### Gradio
|
40 |
-
|
41 |
-
After completing all steps as described in the [Setting up](#setting-up) section, run:
|
42 |
-
|
43 |
-
```bash
|
44 |
-
python3 app.py
|
45 |
-
```
|
46 |
-
|
47 |
-
### API Serving
|
48 |
-
|
49 |
-
By default, the API is served at `http://0.0.0.0:8000`. To launch it, complete all the steps outlined in the [Setting up](#setting-up) section, then execute the following command:
|
50 |
-
|
51 |
-
```bash
|
52 |
-
python3 -m api
|
53 |
-
```
|
54 |
-
|
55 |
-
### Discord Bot
|
56 |
-
|
57 |
-
To interact with the system as a Discord bot, add additional required environment variables from the `Discord bot` section of the `.env.example` file in the `config/` directory.
|
58 |
-
|
59 |
-
- `DISCORD_TOKEN` - (str) API key for the bot application
|
60 |
-
- `QA_SERVICE_URL` - (str) URL of the API service. We recommend using: `http://0.0.0.0:8000`
|
61 |
-
- `NUM_LAST_MESSAGES` - (int) Number of messages used for context in conversations
|
62 |
-
- `USE_NAMES_IN_CONTEXT` - (bool) Include usernames in the conversation context
|
63 |
-
- `ENABLE_COMMANDS` - (bool) Allow commands, e.g., channel cleanup
|
64 |
-
- `DEBUG` - (bool) Provides additional logging
|
65 |
-
|
66 |
-
After completing all steps, run:
|
67 |
-
|
68 |
-
```bash
|
69 |
-
python3 -m bot
|
70 |
-
```
|
71 |
-
|
72 |
-
<!-- ### Running in a Docker
|
73 |
-
|
74 |
-
Tu run API and bot in a Docker container, run the following command:
|
75 |
-
|
76 |
-
```bash
|
77 |
-
./run_docker.sh
|
78 |
-
``` -->
|
79 |
-
|
80 |
-
## Indexes List
|
81 |
-
|
82 |
-
The following list contains the most current indexes that can be used for the system:
|
83 |
-
- [All Hugging Face repositories over 50 Stars - 512-Character Chunks](https://huggingface.co/datasets/KonradSzafer/index-instructor-large-512-m512-all_repos_above_50_stars)
|
84 |
-
- [All Hugging Face repositories over 50 Stars - 812-Character Chunks](KonradSzafer/index-instructor-large-812-m512-all_repos_above_50_stars)
|
85 |
-
|
86 |
-
## Development Instructions
|
87 |
-
|
88 |
-
We use `Python 3.10`
|
89 |
-
|
90 |
-
To install all necessary Python packages, run the following command:
|
91 |
-
|
92 |
-
```bash
|
93 |
-
pip install -r requirements.txt
|
94 |
-
```
|
95 |
-
We use the pipreqsnb to generate the requirements.txt file. To install pipreqsnb, run the following command:
|
96 |
-
|
97 |
-
```bash
|
98 |
-
pip install pipreqsnb
|
99 |
-
```
|
100 |
-
To generate the requirements.txt file, run the following command:
|
101 |
-
|
102 |
-
```bash
|
103 |
-
pipreqsnb --force .
|
104 |
-
```
|
105 |
-
|
106 |
-
To run unit tests, you can use the following command:
|
107 |
-
|
108 |
-
```bash
|
109 |
-
pytest -o "testpaths=tests" --noconftest
|
110 |
-
```
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|