Spaces:
Runtime error
Runtime error
Use this repo for deploying HF spaces (#68)
Browse filesWe used to maintain a separate repo for buster's HF space. Now we use this repo to deploy directly.
* update prompt engineering
* add HF spaces metadata
* update to latest python
* add data to the repo with git LFS
- .gitignore +4 -4
- README.md +12 -1
- buster/apps/gradio_app.py +26 -11
- buster/data/document_embeddings_huggingface.tar.gz +3 -0
- db_to_csv.ipynb → buster/notebooks/db_to_csv.ipynb +0 -0
.gitignore
CHANGED
|
@@ -1,11 +1,11 @@
|
|
| 1 |
-
# Project specific stuff
|
| 2 |
-
buster/data/
|
| 3 |
-
|
| 4 |
# Byte-compiled / optimized / DLL files
|
| 5 |
__pycache__/
|
| 6 |
*.py[cod]
|
| 7 |
*$py.class
|
| 8 |
|
|
|
|
|
|
|
|
|
|
| 9 |
albenchmark/data/
|
| 10 |
|
| 11 |
# Ignore notebooks by default
|
|
@@ -137,4 +137,4 @@ dmypy.json
|
|
| 137 |
.pyre/
|
| 138 |
|
| 139 |
# VSCode
|
| 140 |
-
.vscode/
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
# Byte-compiled / optimized / DLL files
|
| 2 |
__pycache__/
|
| 3 |
*.py[cod]
|
| 4 |
*$py.class
|
| 5 |
|
| 6 |
+
# Macos
|
| 7 |
+
*.DS_Store*
|
| 8 |
+
|
| 9 |
albenchmark/data/
|
| 10 |
|
| 11 |
# Ignore notebooks by default
|
|
|
|
| 137 |
.pyre/
|
| 138 |
|
| 139 |
# VSCode
|
| 140 |
+
.vscode/
|
README.md
CHANGED
|
@@ -1,3 +1,14 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
# Buster, the QA documentation chatbot!
|
| 2 |
|
| 3 |
Buster is a question-answering chatbot that can be tuned to specific documentations. You can try it [here](https://huggingface.co/spaces/jerpint/buster), where it will answer questions about [🤗 Transformers](https://huggingface.co/docs/transformers/index).
|
|
@@ -23,7 +34,7 @@ We send the prompt to the [OpenAI API](https://beta.openai.com/docs/api-referenc
|
|
| 23 |
### Currently used models
|
| 24 |
|
| 25 |
- For embeddings: "text-embedding-ada-002"
|
| 26 |
-
- For completion: "text-davinci-003"
|
| 27 |
|
| 28 |
### Livestream
|
| 29 |
|
|
|
|
| 1 |
+
---
|
| 2 |
+
title: Buster
|
| 3 |
+
emoji: 🤖
|
| 4 |
+
colorFrom: red
|
| 5 |
+
colorTo: blue
|
| 6 |
+
sdk: gradio
|
| 7 |
+
app_file: buster/apps/gradio_app.py
|
| 8 |
+
python_version: 3.10.8
|
| 9 |
+
pinned: false
|
| 10 |
+
---
|
| 11 |
+
|
| 12 |
# Buster, the QA documentation chatbot!
|
| 13 |
|
| 14 |
Buster is a question-answering chatbot that can be tuned to specific documentations. You can try it [here](https://huggingface.co/spaces/jerpint/buster), where it will answer questions about [🤗 Transformers](https://huggingface.co/docs/transformers/index).
|
|
|
|
| 34 |
### Currently used models
|
| 35 |
|
| 36 |
- For embeddings: "text-embedding-ada-002"
|
| 37 |
+
- For completion: We support both "text-davinci-003" and "gpt-3.5-turbo"
|
| 38 |
|
| 39 |
### Livestream
|
| 40 |
|
buster/apps/gradio_app.py
CHANGED
|
@@ -1,9 +1,14 @@
|
|
|
|
|
|
|
|
|
|
|
| 1 |
import gradio as gr
|
| 2 |
|
| 3 |
from buster.buster import Buster, BusterConfig
|
| 4 |
|
|
|
|
|
|
|
| 5 |
buster_cfg = BusterConfig(
|
| 6 |
-
documents_file=
|
| 7 |
unknown_prompt="I'm sorry, but I am an AI language model trained to assist with questions related to the huggingface transformers library. I cannot answer that question as it is not relevant to the library or its usage. Is there anything else I can assist you with?",
|
| 8 |
embedding_model="text-embedding-ada-002",
|
| 9 |
top_k=3,
|
|
@@ -11,18 +16,28 @@ buster_cfg = BusterConfig(
|
|
| 11 |
max_words=3000,
|
| 12 |
completer_cfg={
|
| 13 |
"name": "ChatGPT",
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 14 |
"text_before_prompt": (
|
| 15 |
-
""
|
| 16 |
-
""
|
| 17 |
-
"
|
| 18 |
-
"
|
| 19 |
-
"
|
| 20 |
-
"
|
| 21 |
-
"
|
| 22 |
-
"
|
| 23 |
-
"
|
|
|
|
|
|
|
|
|
|
|
|
|
| 24 |
),
|
| 25 |
-
"text_before_documents": "Only use these documents as reference:\n",
|
| 26 |
"completion_kwargs": {
|
| 27 |
"model": "gpt-3.5-turbo",
|
| 28 |
},
|
|
|
|
| 1 |
+
import os
|
| 2 |
+
import pathlib
|
| 3 |
+
|
| 4 |
import gradio as gr
|
| 5 |
|
| 6 |
from buster.buster import Buster, BusterConfig
|
| 7 |
|
| 8 |
+
DATA_DIR = pathlib.Path(__file__).parent.parent.resolve() / "data" # points to ../data/
|
| 9 |
+
|
| 10 |
buster_cfg = BusterConfig(
|
| 11 |
+
documents_file=os.path.join(DATA_DIR, "document_embeddings_huggingface.tar.gz"),
|
| 12 |
unknown_prompt="I'm sorry, but I am an AI language model trained to assist with questions related to the huggingface transformers library. I cannot answer that question as it is not relevant to the library or its usage. Is there anything else I can assist you with?",
|
| 13 |
embedding_model="text-embedding-ada-002",
|
| 14 |
top_k=3,
|
|
|
|
| 16 |
max_words=3000,
|
| 17 |
completer_cfg={
|
| 18 |
"name": "ChatGPT",
|
| 19 |
+
"text_before_documents": (
|
| 20 |
+
"You are a chatbot assistant answering technical questions about huggingface transformers, a library to train transformers in python. "
|
| 21 |
+
"You can only respond to a question if the content necessary to answer the question is contained in the following provided documentation. "
|
| 22 |
+
"If it isn't, simply reply that you cannot answer the question. "
|
| 23 |
+
"Here is the documentation: "
|
| 24 |
+
"<BEGIN_DOCUMENTATION> "
|
| 25 |
+
),
|
| 26 |
"text_before_prompt": (
|
| 27 |
+
"<\END_DOCUMENTATION>\n"
|
| 28 |
+
"REMINDER:\n"
|
| 29 |
+
"You are a chatbot assistant answering technical questions about huggingface transformers, a library to train transformers in python. "
|
| 30 |
+
"Here are the rules you must follow:\n"
|
| 31 |
+
"1) You must only respond with information contained in the documentation above. Say you do not know if the information is not provided.\n"
|
| 32 |
+
"2) Make sure to format your answers in Markdown format, including code block and snippets.\n"
|
| 33 |
+
"3) Do not include any links to urls or hyperlinks in your answers.\n"
|
| 34 |
+
"4) If you do not know the answer to a question, or if it is completely irrelevant to the library usage, simply reply with:\n"
|
| 35 |
+
"'I'm sorry, but I am an AI language model trained to assist with questions related to the huggingface transformers library. I cannot answer that question as it is not relevant to the library or its usage. Is there anything else I can assist you with?'"
|
| 36 |
+
"For example:\n"
|
| 37 |
+
"What is the meaning of life for huggingface?\n"
|
| 38 |
+
"I'm sorry, but I am an AI language model trained to assist with questions related to the huggingface transformers library. I cannot answer that question as it is not relevant to the library or its usage. Is there anything else I can assist you with?"
|
| 39 |
+
"Now answer the following question:\n"
|
| 40 |
),
|
|
|
|
| 41 |
"completion_kwargs": {
|
| 42 |
"model": "gpt-3.5-turbo",
|
| 43 |
},
|
buster/data/document_embeddings_huggingface.tar.gz
ADDED
|
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
version https://git-lfs.github.com/spec/v1
|
| 2 |
+
oid sha256:19453cb9ec85e644306af7dcc6fcad79cbb842d15a2087a66ddf48b5cbd9fbc9
|
| 3 |
+
size 46918939
|
db_to_csv.ipynb → buster/notebooks/db_to_csv.ipynb
RENAMED
|
File without changes
|