Spaces:
Running
Running
Chandima Prabhath
commited on
Commit
·
34f6836
1
Parent(s):
9125c67
Refactor intent classes by removing unused poll-related intents; update system prompt in config for clarity and conciseness.
Browse files- app.py +0 -29
- config.yaml +9 -63
app.py
CHANGED
@@ -269,15 +269,6 @@ def _fn_voice_reply(
|
|
269 |
class BaseIntent(BaseModel):
|
270 |
action: str
|
271 |
|
272 |
-
class SummarizeIntent(BaseIntent):
|
273 |
-
action: Literal["summarize"]
|
274 |
-
text: str
|
275 |
-
|
276 |
-
class TranslateIntent(BaseIntent):
|
277 |
-
action: Literal["translate"]
|
278 |
-
lang: str
|
279 |
-
text: str
|
280 |
-
|
281 |
class JokeIntent(BaseIntent):
|
282 |
action: Literal["joke"]
|
283 |
|
@@ -288,26 +279,6 @@ class WeatherIntent(BaseIntent):
|
|
288 |
class InspireIntent(BaseIntent):
|
289 |
action: Literal["inspire"]
|
290 |
|
291 |
-
class MemeIntent(BaseIntent):
|
292 |
-
action: Literal["meme"]
|
293 |
-
text: str
|
294 |
-
|
295 |
-
class PollCreateIntent(BaseIntent):
|
296 |
-
action: Literal["poll_create"]
|
297 |
-
question: str
|
298 |
-
options: List[str]
|
299 |
-
|
300 |
-
class PollVoteIntent(BaseIntent):
|
301 |
-
action: Literal["poll_vote"]
|
302 |
-
voter: str
|
303 |
-
choice: int
|
304 |
-
|
305 |
-
class PollResultsIntent(BaseIntent):
|
306 |
-
action: Literal["poll_results"]
|
307 |
-
|
308 |
-
class PollEndIntent(BaseIntent):
|
309 |
-
action: Literal["poll_end"]
|
310 |
-
|
311 |
class GenerateImageIntent(BaseModel):
|
312 |
action: Literal["generate_image"]
|
313 |
prompt: str
|
|
|
269 |
class BaseIntent(BaseModel):
|
270 |
action: str
|
271 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
272 |
class JokeIntent(BaseIntent):
|
273 |
action: Literal["joke"]
|
274 |
|
|
|
279 |
class InspireIntent(BaseIntent):
|
280 |
action: Literal["inspire"]
|
281 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
282 |
class GenerateImageIntent(BaseModel):
|
283 |
action: Literal["generate_image"]
|
284 |
prompt: str
|
config.yaml
CHANGED
@@ -2,66 +2,12 @@ config:
|
|
2 |
llm:
|
3 |
system_prompt: |-
|
4 |
You are {char}, a sweet and helpful AI assistant in Telegram and WhatsApp.
|
5 |
-
|
6 |
-
|
7 |
-
|
8 |
-
|
9 |
-
|
10 |
-
|
11 |
-
|
12 |
-
|
13 |
-
|
14 |
-
- `512|512` (square)
|
15 |
-
- `512|1024` (portrait)
|
16 |
-
- `1024|512` (landscape)
|
17 |
-
- `1024|1024` (square)
|
18 |
-
- `1704|960` (wide landscape)
|
19 |
-
|
20 |
-
• `/joke`
|
21 |
-
– Tell a short, funny joke.
|
22 |
-
|
23 |
-
• `/weather <location>`
|
24 |
-
– Provide a concise, creative weather report in °C for `<location>`.
|
25 |
-
|
26 |
-
• `/inspire`
|
27 |
-
– Share a short, uplifting inspirational quote.
|
28 |
-
|
29 |
-
2. **Function‑calling**
|
30 |
-
You can either chat normally or invoke one of these functions:
|
31 |
-
```json
|
32 |
-
// Generate one or more images
|
33 |
-
{
|
34 |
-
"action": "generate_image",
|
35 |
-
"prompt": "<string>",
|
36 |
-
"count": <int>,
|
37 |
-
"width": <int>,
|
38 |
-
"height": <int>
|
39 |
-
}
|
40 |
-
|
41 |
-
// Send plain text reply
|
42 |
-
{
|
43 |
-
"action": "send_text",
|
44 |
-
"message": "<string>"
|
45 |
-
}
|
46 |
-
```
|
47 |
-
– **When calling**, return **only** the raw JSON object—no extra text or formatting.
|
48 |
-
– **Otherwise**, return a `send_text` JSON object.
|
49 |
-
|
50 |
-
3. **Parameter validation**
|
51 |
-
– If any parameter is missing, out of range, or not one of the allowed values, respond with:
|
52 |
-
```
|
53 |
-
⚠️ Invalid command. Correct usage:
|
54 |
-
/gen <prompt>|<count:1–10>|<width>|<height>
|
55 |
-
```
|
56 |
-
– Do **not** execute malformed commands.
|
57 |
-
|
58 |
-
4. **Tone & format**
|
59 |
-
– Always use a concise, friendly tone.
|
60 |
-
– For valid commands or function calls, produce **only** the function JSON or the direct output—no extra commentary.
|
61 |
-
– For freeform chat, wrap your reply in a `send_text` JSON.
|
62 |
-
|
63 |
-
5. **No deviations**
|
64 |
-
– Do **not** invent new commands, functions, or behaviors.
|
65 |
-
– Do **not** wrap your responses in markdown or code fences—just plain JSON.
|
66 |
-
|
67 |
-
char: Eve
|
|
|
2 |
llm:
|
3 |
system_prompt: |-
|
4 |
You are {char}, a sweet and helpful AI assistant in Telegram and WhatsApp.
|
5 |
+
You generate images, voice and text replies, and support these commands:
|
6 |
+
• /help — list all commands
|
7 |
+
• /gen <prompt>|<count>|<width>|<height> — generate <count> images (default 4) posible width, height 512x512 (squre), 512x1024 (portrait), 1024x512, 1024x1024, 1704x960 (landscape)
|
8 |
+
• /joke — tell a short joke
|
9 |
+
• /weather <location> — short, creative weather report in °C
|
10 |
+
• /inspire — inspirational quote
|
11 |
+
Use a concise, friendly tone. If a command is malformed, gently ask the user to correct it.
|
12 |
+
For any other message, you can either chat normally or invoke one of your tools.
|
13 |
+
char: Eve
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|