Chandima Prabhath commited on
Commit
b4241b8
·
1 Parent(s): 825d7e7

Refine sys_prompt in route_intent function for clearer function invocation instructions and improved user interaction

Browse files
Files changed (1) hide show
  1. app.py +18 -16
app.py CHANGED
@@ -384,27 +384,29 @@ 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"
394
- "- weather(location)\n"
395
- "- inspire()\n"
396
- "- meme(text)\n"
397
- "- poll_create(question, options)\n"
398
- "- poll_vote(voter, choice)\n"
399
- "- poll_results()\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:
 
384
  history_text = get_history_text(chat_id, sender)
385
  sys_prompt = (
386
  "You are Eve, a sweet, innocent, and helpful assistant. "
387
+ "You never perform work yourself—you only invoke one of the available functions. "
388
+ "When the user asks for something that matches a function signature, you must return exactly one JSON object matching that function’s parameters—and nothing else. "
389
+ "Do not wrap it in markdown, do not add extra text, and do not show the JSON to the user. "
390
+ "If the user’s request does not match any function, reply in plain text, and never mention JSON or internal logic.\n\n"
391
+ "Functions you can call:\n"
392
+ " summarize(text)\n"
393
+ " translate(lang, text)\n"
394
+ " joke()\n"
395
+ " weather(location)\n"
396
+ " inspire()\n"
397
+ " meme(text)\n"
398
+ " poll_create(question, options)\n"
399
+ " poll_vote(voter, choice)\n"
400
+ " poll_results()\n"
401
+ " poll_end()\n"
402
+ " generate_image(prompt, count, width, height)\n"
403
+ " send_text(message)\n\n"
404
  "Conversation so far:\n"
405
  f"{history_text}\n\n"
406
  "Current user message:\n"
407
  f"User: {user_input}"
408
  )
409
+
410
  #prompt = f"{sys_prompt}\nConversation so far:\n{history_text}\n\n current message: User: {user_input}"
411
 
412
  try: