Spaces:
Running
Running
Chandima Prabhath
commited on
Commit
·
825d7e7
1
Parent(s):
be34418
Enhance route_intent function prompt for improved user interaction and clarity on JSON response format
Browse files
app.py
CHANGED
@@ -383,7 +383,11 @@ ACTION_HANDLERS = {
|
|
383 |
def route_intent(user_input: str, chat_id: str, sender: str):
|
384 |
history_text = get_history_text(chat_id, sender)
|
385 |
sys_prompt = (
|
386 |
-
"You are Eve
|
|
|
|
|
|
|
|
|
387 |
"- summarize(text)\n"
|
388 |
"- translate(lang, text)\n"
|
389 |
"- joke()\n"
|
@@ -396,14 +400,15 @@ def route_intent(user_input: str, chat_id: str, sender: str):
|
|
396 |
"- poll_end()\n"
|
397 |
"- generate_image(prompt, count, width, height)\n"
|
398 |
"- send_text(message)\n\n"
|
399 |
-
"
|
400 |
-
"
|
401 |
-
"
|
|
|
402 |
)
|
403 |
-
prompt = f"{sys_prompt}\nConversation so far:\n{history_text}\n\n current message: User: {user_input}"
|
404 |
|
405 |
try:
|
406 |
-
raw = generate_llm(
|
407 |
except LLMBadRequestError:
|
408 |
# Clear history on HTTP 400 from the LLM
|
409 |
clear_history(chat_id, sender)
|
|
|
383 |
def route_intent(user_input: str, chat_id: str, sender: str):
|
384 |
history_text = get_history_text(chat_id, sender)
|
385 |
sys_prompt = (
|
386 |
+
"You are Eve, a sweet, innocent, and helpful assistant. "
|
387 |
+
"When you want to invoke a function, return exactly one JSON object matching the function signature—"
|
388 |
+
"do not include that JSON in your chat reply. "
|
389 |
+
"Otherwise, reply in plain text, and never mention JSON or function internals.\n\n"
|
390 |
+
"Available functions:\n"
|
391 |
"- summarize(text)\n"
|
392 |
"- translate(lang, text)\n"
|
393 |
"- joke()\n"
|
|
|
400 |
"- poll_end()\n"
|
401 |
"- generate_image(prompt, count, width, height)\n"
|
402 |
"- send_text(message)\n\n"
|
403 |
+
"Conversation so far:\n"
|
404 |
+
f"{history_text}\n\n"
|
405 |
+
"Current user message:\n"
|
406 |
+
f"User: {user_input}"
|
407 |
)
|
408 |
+
#prompt = f"{sys_prompt}\nConversation so far:\n{history_text}\n\n current message: User: {user_input}"
|
409 |
|
410 |
try:
|
411 |
+
raw = generate_llm(sys_prompt)
|
412 |
except LLMBadRequestError:
|
413 |
# Clear history on HTTP 400 from the LLM
|
414 |
clear_history(chat_id, sender)
|