Spaces:
Running
Running
Update routes.py
Browse files
routes.py
CHANGED
@@ -101,7 +101,33 @@ def send_query(query_request: QueryRequest):
|
|
101 |
"""
|
102 |
Processes a query and returns the bot's response along with any web sources.
|
103 |
"""
|
|
|
104 |
try:
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
105 |
response, web_sources = trainer.get_response(
|
106 |
query_request.query, query_request.bot_id, query_request.chat_id
|
107 |
)
|
|
|
101 |
"""
|
102 |
Processes a query and returns the bot's response along with any web sources.
|
103 |
"""
|
104 |
+
prompt_type = query_request.prompt_type
|
105 |
try:
|
106 |
+
# Assign the prompt template based on the prompt type.
|
107 |
+
if prompt_type == "university":
|
108 |
+
prompt_template = PromptTemplates.get_university_chatbot_prompt()
|
109 |
+
elif prompt_type == "quiz_solving":
|
110 |
+
prompt_template = PromptTemplates.get_quiz_solving_prompt()
|
111 |
+
elif prompt_type == "assignment_solving":
|
112 |
+
prompt_template = PromptTemplates.get_assignment_solving_prompt()
|
113 |
+
elif prompt_type == "paper_solving":
|
114 |
+
prompt_template = PromptTemplates.get_paper_solving_prompt()
|
115 |
+
elif prompt_type == "quiz_creation":
|
116 |
+
prompt_template = PromptTemplates.get_quiz_creation_prompt()
|
117 |
+
elif prompt_type == "assignment_creation":
|
118 |
+
prompt_template = PromptTemplates.get_assignment_creation_prompt()
|
119 |
+
elif prompt_type == "paper_creation":
|
120 |
+
prompt_template = PromptTemplates.get_paper_creation_prompt()
|
121 |
+
elif prompt_type == "check_quiz":
|
122 |
+
prompt_template = PromptTemplates.get_check_quiz_prompt()
|
123 |
+
elif prompt_type == "check_assignment":
|
124 |
+
prompt_template = PromptTemplates.get_check_assignment_prompt()
|
125 |
+
elif prompt_type == "check_paper":
|
126 |
+
prompt_template = PromptTemplates.get_check_paper_prompt()
|
127 |
+
else:
|
128 |
+
# Default prompt template if prompt_type is not recognized.
|
129 |
+
prompt_template = PromptTemplates.get_quiz_solving_prompt()
|
130 |
+
trainer.set_custom_prompt_template(bot_id, prompt_template)
|
131 |
response, web_sources = trainer.get_response(
|
132 |
query_request.query, query_request.bot_id, query_request.chat_id
|
133 |
)
|