Add voice_choice_prompt and text_choice_prompt tools to API and UI. Implement state management and parameter definitions for user selection prompts, enhancing user interaction and experience.
This commit is contained in:
@@ -168,6 +168,70 @@ class DuplexPipeline:
|
||||
"required": ["msg"],
|
||||
},
|
||||
},
|
||||
"voice_choice_prompt": {
|
||||
"name": "voice_choice_prompt",
|
||||
"description": "Speak a question and show options on client side, then wait for selection",
|
||||
"parameters": {
|
||||
"type": "object",
|
||||
"properties": {
|
||||
"question": {"type": "string", "description": "Question text to show"},
|
||||
"options": {
|
||||
"type": "array",
|
||||
"description": "Selectable options (string or object with id/label/value)",
|
||||
"minItems": 2,
|
||||
"items": {
|
||||
"anyOf": [
|
||||
{"type": "string"},
|
||||
{
|
||||
"type": "object",
|
||||
"properties": {
|
||||
"id": {"type": "string"},
|
||||
"label": {"type": "string"},
|
||||
"value": {"type": "string"},
|
||||
},
|
||||
"required": ["label"],
|
||||
},
|
||||
]
|
||||
},
|
||||
},
|
||||
"voice_text": {
|
||||
"type": "string",
|
||||
"description": "Optional voice text. Falls back to question when omitted.",
|
||||
},
|
||||
},
|
||||
"required": ["question", "options"],
|
||||
},
|
||||
},
|
||||
"text_choice_prompt": {
|
||||
"name": "text_choice_prompt",
|
||||
"description": "Show a text-only choice prompt on client side and wait for selection",
|
||||
"parameters": {
|
||||
"type": "object",
|
||||
"properties": {
|
||||
"question": {"type": "string", "description": "Question text to show"},
|
||||
"options": {
|
||||
"type": "array",
|
||||
"description": "Selectable options (string or object with id/label/value)",
|
||||
"minItems": 2,
|
||||
"items": {
|
||||
"anyOf": [
|
||||
{"type": "string"},
|
||||
{
|
||||
"type": "object",
|
||||
"properties": {
|
||||
"id": {"type": "string"},
|
||||
"label": {"type": "string"},
|
||||
"value": {"type": "string"},
|
||||
},
|
||||
"required": ["label"],
|
||||
},
|
||||
]
|
||||
},
|
||||
},
|
||||
},
|
||||
"required": ["question", "options"],
|
||||
},
|
||||
},
|
||||
}
|
||||
_DEFAULT_CLIENT_EXECUTORS = frozenset({
|
||||
"turn_on_camera",
|
||||
@@ -176,6 +240,8 @@ class DuplexPipeline:
|
||||
"decrease_volume",
|
||||
"voice_message_prompt",
|
||||
"text_msg_prompt",
|
||||
"voice_choice_prompt",
|
||||
"text_choice_prompt",
|
||||
})
|
||||
|
||||
def __init__(
|
||||
|
||||
Reference in New Issue
Block a user