jerpint commited on
Commit
ab096a6
·
1 Parent(s): 8252b96

update cfgs for new refactor

Browse files
buster/apps/bot_configs.py CHANGED
@@ -1,13 +1,22 @@
1
  from buster.busterbot import BusterConfig
2
 
 
 
3
  huggingface_cfg = BusterConfig(
4
  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?",
5
  embedding_model="text-embedding-ada-002",
6
- top_k=3,
7
- thresh=0.7,
8
- max_words=3000,
9
- completer_cfg={
 
10
  "name": "ChatGPT",
 
 
 
 
 
 
11
  "text_before_documents": (
12
  "You are a chatbot assistant answering technical questions about huggingface transformers, a library to train transformers in python. "
13
  "You can only respond to a question if the content necessary to answer the question is contained in the following provided documentation. "
@@ -33,139 +42,94 @@ huggingface_cfg = BusterConfig(
33
  "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?"
34
  "Now answer the following question:\n"
35
  ),
36
- "completion_kwargs": {
37
- "model": "gpt-3.5-turbo",
38
- },
39
  },
40
- response_format="gradio",
41
- source="huggingface",
42
  )
43
 
44
 
45
- pytorch_cfg = BusterConfig(
46
- unknown_prompt="I'm sorry, but I am an AI language model trained to assist with questions related to the pytorch 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?",
47
- embedding_model="text-embedding-ada-002",
48
- top_k=3,
49
- thresh=0.7,
50
- max_words=3000,
51
- completer_cfg={
52
- "name": "ChatGPT",
53
- "text_before_documents": (
54
- "You are a chatbot assistant answering technical questions about pytorch, a library to train neural networks in python. "
55
- "You can only respond to a question if the content necessary to answer the question is contained in the following provided documentation. "
56
- "If the answer is in the documentation, summarize it in a helpful way to the user. "
57
- "If it isn't, simply reply that you cannot answer the question. "
58
- "Do not refer to the documentation directly, but use the instructions provided within it to answer questions. "
59
- "Here is the documentation: "
60
- "<DOCUMENTS> "
61
- ),
62
- "text_before_prompt": (
63
- "<\DOCUMENTS>\n"
64
- "REMEMBER:\n"
65
- "You are a chatbot assistant answering technical questions about pytorch transformers, a library to train neural networks in python. "
66
- "Here are the rules you must follow:\n"
67
- "1) You must only respond with information contained in the documentation above. Say you do not know if the information is not provided.\n"
68
- "2) Make sure to format your answers in Markdown format, including code block and snippets.\n"
69
- "3) Do not include any links, urls or hyperlinks in your answers.\n"
70
- "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"
71
- "5) Do not refer to the documentation directly, but use the instructions provided within it to answer questions. "
72
- "'I'm sorry, but I am an AI language model trained to assist with questions related to the pytorch 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?'"
73
- "For example:\n"
74
- "What is the meaning of life for pytorch?\n"
75
- "I'm sorry, but I am an AI language model trained to assist with questions related to the pytorch 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?"
76
- "Now answer the following question:\n"
77
- ),
78
- "completion_kwargs": {
79
- "model": "gpt-3.5-turbo",
80
- },
81
- },
82
- response_format="gradio",
83
- source="pytorch",
84
  )
85
-
86
- lightning_cfg = BusterConfig(
87
- unknown_prompt="I'm sorry, but I am an AI language model trained to assist with questions related to the pytorch lightning 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?",
88
- embedding_model="text-embedding-ada-002",
89
- top_k=3,
90
- thresh=0.7,
91
- max_words=3000,
92
- completer_cfg={
93
- "name": "ChatGPT",
94
- "text_before_documents": (
95
- "You are a chatbot assistant answering technical questions about pytorch lightning, a library to train neural networks in python. "
96
- "You can only respond to a question if the content necessary to answer the question is contained in the following provided documentation. "
97
- "If the answer is in the documentation, summarize it in a helpful way to the user. "
98
- "If it isn't, simply reply that you cannot answer the question. "
99
- "Do not refer to the documentation directly, but use the instructions provided within it to answer questions. "
100
- "Here is the documentation: "
101
- "<DOCUMENTS> "
102
- ),
103
- "text_before_prompt": (
104
- "<\DOCUMENTS>\n"
105
- "REMEMBER:\n"
106
- "You are a chatbot assistant answering technical questions about pytorch lightning transformers, a library to train neural networks in python. "
107
- "Here are the rules you must follow:\n"
108
- "1) You must only respond with information contained in the documentation above. Say you do not know if the information is not provided.\n"
109
- "2) Make sure to format your answers in Markdown format, including code block and snippets.\n"
110
- "3) Do not include any links, urls or hyperlinks in your answers.\n"
111
- "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"
112
- "5) Do not refer to the documentation directly, but use the instructions provided within it to answer questions. "
113
- "'I'm sorry, but I am an AI language model trained to assist with questions related to the pytorch lightning 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?'"
114
- "For example:\n"
115
- "What is the meaning of life for pytorch lightning?\n"
116
- "I'm sorry, but I am an AI language model trained to assist with questions related to the pytorch lightning 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?"
117
- "Now answer the following question:\n"
118
- ),
119
- "completion_kwargs": {
120
- "model": "gpt-3.5-turbo",
121
- },
122
- },
123
- response_format="gradio",
124
- source="lightning",
125
  )
 
126
 
127
-
128
- godot_cfg = BusterConfig(
129
- unknown_prompt="I'm sorry, but I am an AI language model trained to assist with questions related to the godot 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?",
130
- embedding_model="text-embedding-ada-002",
131
- top_k=3,
132
- thresh=0.7,
133
- max_words=3000,
134
- completer_cfg={
135
- "name": "ChatGPT",
136
- "text_before_documents": (
137
- "You are a chatbot assistant answering technical questions about godot, a game-engine library. "
138
- "You can only respond to a question if the content necessary to answer the question is contained in the following provided documentation. "
139
- "If the answer is in the documentation, summarize it in a helpful way to the user. "
140
- "If it isn't, simply reply that you cannot answer the question. "
141
- "Do not refer to the documentation directly, but use the instructions provided within it to answer questions. "
142
- "Here is the documentation: "
143
- "<DOCUMENTS> "
144
- ),
145
- "text_before_prompt": (
146
- "<\DOCUMENTS>\n"
147
- "REMEMBER:\n"
148
- "You are a chatbot assistant answering technical questions about godot, a game-engine library."
149
- "Here are the rules you must follow:\n"
150
- "1) You must only respond with information contained in the documentation above. Say you do not know if the information is not provided.\n"
151
- "2) Make sure to format your answers in Markdown format, including code block and snippets.\n"
152
- "3) Do not include any links, urls or hyperlinks in your answers.\n"
153
- "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"
154
- "5) Do not refer to the documentation directly, but use the instructions provided within it to answer questions. "
155
- "'I'm sorry, but I am an AI language model trained to assist with questions related to the godot 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?'"
156
- "For example:\n"
157
- "What is the meaning of life for godot?\n"
158
- "I'm sorry, but I am an AI language model trained to assist with questions related to the pytorch lightning 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?"
159
- "Now answer the following question:\n"
160
- ),
161
- "completion_kwargs": {
162
- "model": "gpt-3.5-turbo",
163
- },
164
- },
165
- response_format="gradio",
166
- source="godot",
167
  )
168
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
169
 
170
  available_configs = {
171
  "huggingface": huggingface_cfg,
 
1
  from buster.busterbot import BusterConfig
2
 
3
+ import copy
4
+
5
  huggingface_cfg = BusterConfig(
6
  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?",
7
  embedding_model="text-embedding-ada-002",
8
+ retriever_cfg={
9
+ "top_k": 3,
10
+ "thresh": 0.7,
11
+ },
12
+ completion_cfg={
13
  "name": "ChatGPT",
14
+ "completion_kwargs": {
15
+ "model": "gpt-3.5-turbo",
16
+ },
17
+ },
18
+ prompt_cfg={
19
+ "max_words": 3000,
20
  "text_before_documents": (
21
  "You are a chatbot assistant answering technical questions about huggingface transformers, a library to train transformers in python. "
22
  "You can only respond to a question if the content necessary to answer the question is contained in the following provided documentation. "
 
42
  "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?"
43
  "Now answer the following question:\n"
44
  ),
 
 
 
45
  },
46
+ document_source="huggingface",
 
47
  )
48
 
49
 
50
+ pytorch_cfg = copy.deepcopy(huggingface_cfg)
51
+ pytorch_cfg.prompt_cfg["text_before_documents"] = (
52
+ "You are a chatbot assistant answering technical questions about pytorch, a library to train neural networks in python. "
53
+ "You can only respond to a question if the content necessary to answer the question is contained in the following provided documentation. "
54
+ "If the answer is in the documentation, summarize it in a helpful way to the user. "
55
+ "If it isn't, simply reply that you cannot answer the question. "
56
+ "Do not refer to the documentation directly, but use the instructions provided within it to answer questions. "
57
+ "Here is the documentation: "
58
+ "<DOCUMENTS> "
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
59
  )
60
+ pytorch_cfg.prompt_cfg["text_before_prompt"] = (
61
+ "<\DOCUMENTS>\n"
62
+ "REMEMBER:\n"
63
+ "You are a chatbot assistant answering technical questions about pytorch transformers, a library to train neural networks in python. "
64
+ "Here are the rules you must follow:\n"
65
+ "1) You must only respond with information contained in the documentation above. Say you do not know if the information is not provided.\n"
66
+ "2) Make sure to format your answers in Markdown format, including code block and snippets.\n"
67
+ "3) Do not include any links, urls or hyperlinks in your answers.\n"
68
+ "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"
69
+ "5) Do not refer to the documentation directly, but use the instructions provided within it to answer questions. "
70
+ "'I'm sorry, but I am an AI language model trained to assist with questions related to the pytorch 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?'"
71
+ "For example:\n"
72
+ "What is the meaning of life for pytorch?\n"
73
+ "I'm sorry, but I am an AI language model trained to assist with questions related to the pytorch 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?"
74
+ "Now answer the following question:\n"
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
75
  )
76
+ pytorch_cfg.document_source = "pytorch"
77
 
78
+ lightning_cfg = copy.deepcopy(huggingface_cfg)
79
+ lightning_cfg.prompt_cfg["text_before_documents"] = (
80
+ "You are a chatbot assistant answering technical questions about pytorch lightning, a library to train neural networks in python. "
81
+ "You can only respond to a question if the content necessary to answer the question is contained in the following provided documentation. "
82
+ "If the answer is in the documentation, summarize it in a helpful way to the user. "
83
+ "If it isn't, simply reply that you cannot answer the question. "
84
+ "Do not refer to the documentation directly, but use the instructions provided within it to answer questions. "
85
+ "Here is the documentation: "
86
+ "<DOCUMENTS> "
87
+ )
88
+ lightning_cfg.prompt_cfg["text_before_prompt"] = (
89
+ "<\DOCUMENTS>\n"
90
+ "REMEMBER:\n"
91
+ "You are a chatbot assistant answering technical questions about pytorch lightning transformers, a library to train neural networks in python. "
92
+ "Here are the rules you must follow:\n"
93
+ "1) You must only respond with information contained in the documentation above. Say you do not know if the information is not provided.\n"
94
+ "2) Make sure to format your answers in Markdown format, including code block and snippets.\n"
95
+ "3) Do not include any links, urls or hyperlinks in your answers.\n"
96
+ "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"
97
+ "5) Do not refer to the documentation directly, but use the instructions provided within it to answer questions. "
98
+ "'I'm sorry, but I am an AI language model trained to assist with questions related to the pytorch lightning 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?'"
99
+ "For example:\n"
100
+ "What is the meaning of life for pytorch lightning?\n"
101
+ "I'm sorry, but I am an AI language model trained to assist with questions related to the pytorch lightning 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?"
102
+ "Now answer the following question:\n"
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
103
  )
104
 
105
+ godot_cfg = copy.deepcopy(huggingface_cfg)
106
+ godot_cfg.prompt_cfg["text_before_documents"] = (
107
+ "You are a chatbot assistant answering technical questions about godot, a game-engine library. "
108
+ "You can only respond to a question if the content necessary to answer the question is contained in the following provided documentation. "
109
+ "If the answer is in the documentation, summarize it in a helpful way to the user. "
110
+ "If it isn't, simply reply that you cannot answer the question. "
111
+ "Do not refer to the documentation directly, but use the instructions provided within it to answer questions. "
112
+ "Here is the documentation: "
113
+ "<DOCUMENTS> "
114
+ )
115
+ godot_cfg.prompt_cfg["text_before_prompt"] = (
116
+ (
117
+ "<\DOCUMENTS>\n"
118
+ "REMEMBER:\n"
119
+ "You are a chatbot assistant answering technical questions about godot, a game-engine library."
120
+ "Here are the rules you must follow:\n"
121
+ "1) You must only respond with information contained in the documentation above. Say you do not know if the information is not provided.\n"
122
+ "2) Make sure to format your answers in Markdown format, including code block and snippets.\n"
123
+ "3) Do not include any links, urls or hyperlinks in your answers.\n"
124
+ "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"
125
+ "5) Do not refer to the documentation directly, but use the instructions provided within it to answer questions. "
126
+ "'I'm sorry, but I am an AI language model trained to assist with questions related to the godot 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?'"
127
+ "For example:\n"
128
+ "What is the meaning of life for godot?\n"
129
+ "I'm sorry, but I am an AI language model trained to assist with questions related to the pytorch lightning 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?"
130
+ "Now answer the following question:\n"
131
+ ),
132
+ )
133
 
134
  available_configs = {
135
  "huggingface": huggingface_cfg,
buster/apps/gradio_app.py CHANGED
@@ -8,7 +8,7 @@ from huggingface_hub import hf_hub_download
8
  from buster.apps.bot_configs import available_configs
9
  from buster.busterbot import Buster, BusterConfig
10
  from buster.retriever import Retriever
11
- from buster.utils import download_db, get_retriever_from_extension
12
 
13
  logger = logging.getLogger(__name__)
14
  logging.basicConfig(level=logging.INFO)
 
8
  from buster.apps.bot_configs import available_configs
9
  from buster.busterbot import Buster, BusterConfig
10
  from buster.retriever import Retriever
11
+ from buster.utils import get_retriever_from_extension
12
 
13
  logger = logging.getLogger(__name__)
14
  logging.basicConfig(level=logging.INFO)