Spaces:
Runtime error
Runtime error
Added system prompt
Browse files- app.py +11 -4
- config.json +2 -1
app.py
CHANGED
@@ -12,6 +12,7 @@ max_tags_count = config["MAX_TAGS_COUNT"]
|
|
12 |
max_attempts = config["MAX_ATTEMPS"]
|
13 |
wait_time = config["WAIT_TIME"]
|
14 |
chatgpt_url = config["CHATGPT_URL"]
|
|
|
15 |
|
16 |
def get_answer(question: str) -> Dict[str, Any]:
|
17 |
headers = {
|
@@ -19,10 +20,16 @@ def get_answer(question: str) -> Dict[str, Any]:
|
|
19 |
}
|
20 |
payload = {
|
21 |
'model': 'gpt-3.5-turbo',
|
22 |
-
'messages': [
|
23 |
-
|
24 |
-
|
25 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
26 |
}
|
27 |
|
28 |
try:
|
|
|
12 |
max_attempts = config["MAX_ATTEMPS"]
|
13 |
wait_time = config["WAIT_TIME"]
|
14 |
chatgpt_url = config["CHATGPT_URL"]
|
15 |
+
system_prompt = config["SYSTEM_PROMPT"]
|
16 |
|
17 |
def get_answer(question: str) -> Dict[str, Any]:
|
18 |
headers = {
|
|
|
20 |
}
|
21 |
payload = {
|
22 |
'model': 'gpt-3.5-turbo',
|
23 |
+
'messages': [
|
24 |
+
{
|
25 |
+
'role': 'system',
|
26 |
+
'content': system_prompt
|
27 |
+
},
|
28 |
+
{
|
29 |
+
'role': 'user',
|
30 |
+
'content': question
|
31 |
+
}
|
32 |
+
]
|
33 |
}
|
34 |
|
35 |
try:
|
config.json
CHANGED
@@ -3,5 +3,6 @@
|
|
3 |
"MAX_TAGS_COUNT": 5,
|
4 |
"MAX_ATTEMPS": 3,
|
5 |
"WAIT_TIME": 3,
|
6 |
-
"CHATGPT_URL": "https://free.churchless.tech/v1/chat/completions"
|
|
|
7 |
}
|
|
|
3 |
"MAX_TAGS_COUNT": 5,
|
4 |
"MAX_ATTEMPS": 3,
|
5 |
"WAIT_TIME": 3,
|
6 |
+
"CHATGPT_URL": "https://free.churchless.tech/v1/chat/completions",
|
7 |
+
"SYSTEM_PROMPT": "Your task is to give the most detailed answer to the question posed. At the beginning of the question, there are tags in square brackets specifying the subject of the question. It is necessary to answer in the language of the user's question"
|
8 |
}
|