Spaces:
Running
Running
Chandima Prabhath
commited on
Commit
·
869bca1
1
Parent(s):
8a6c511
Update FUNCTION_SCHEMA to include width and height parameters for generate_image; enhance user guidance in route_intent function.
Browse files
app.py
CHANGED
@@ -311,9 +311,11 @@ FUNCTION_SCHEMA = {
|
|
311 |
"poll_vote": {"description":"Vote poll", "params":["choice"]},
|
312 |
"poll_results": {"description":"Show poll results", "params":[]},
|
313 |
"poll_end": {"description":"End poll", "params":[]},
|
314 |
-
"generate_image": {
|
315 |
-
|
316 |
-
|
|
|
|
|
317 |
|
318 |
class IntentDispatcher:
|
319 |
def __init__(self):
|
@@ -414,7 +416,9 @@ def route_intent(user_input, chat_id, sender):
|
|
414 |
"You are Eve. You can either chat or call one of these functions:\n"
|
415 |
+ "\n".join(f"- {n}: {f['description']}" for n,f in FUNCTION_SCHEMA.items())
|
416 |
+ "\n\nTo call a function, return JSON with \"action\":\"<name>\", plus its parameters.\n"
|
417 |
-
"
|
|
|
|
|
418 |
"Return only raw JSON."
|
419 |
)
|
420 |
prompt = (
|
|
|
311 |
"poll_vote": {"description":"Vote poll", "params":["choice"]},
|
312 |
"poll_results": {"description":"Show poll results", "params":[]},
|
313 |
"poll_end": {"description":"End poll", "params":[]},
|
314 |
+
"generate_image": {
|
315 |
+
"description":"Generate images",
|
316 |
+
"params":["prompt","count","width","height"]
|
317 |
+
},
|
318 |
+
"send_text": {"description":"Send plain text", "params":["message"]}}
|
319 |
|
320 |
class IntentDispatcher:
|
321 |
def __init__(self):
|
|
|
416 |
"You are Eve. You can either chat or call one of these functions:\n"
|
417 |
+ "\n".join(f"- {n}: {f['description']}" for n,f in FUNCTION_SCHEMA.items())
|
418 |
+ "\n\nTo call a function, return JSON with \"action\":\"<name>\", plus its parameters.\n"
|
419 |
+
+ "Here’s an example for generating images:\n"
|
420 |
+
+ " {\"action\":\"generate_image\",\"prompt\":\"a red fox\",\"count\":3,\"width\":512,\"height\":512}\n"
|
421 |
+
+ "Otherwise return JSON with \"action\":\"send_text\",\"message\":\"...\".\n"
|
422 |
"Return only raw JSON."
|
423 |
)
|
424 |
prompt = (
|