chat
Signature:
Speech.chat(
*,
config: ChatConfig | None = None,
**kwargs: Any,
) -> TaskHandle[None]
Description:
Start a voice conversation task.
Parameters:
Parameter | Type | Default | Description |
|---|---|---|---|
|
|
| Speech chat configuration; uses default configuration when |
|
| - | Optional configuration parameters. |
ChatConfig field descriptions:
Field | Type | Default | Description |
|---|---|---|---|
|
|
| Reply voice ID; available voices can be obtained via |
|
|
| Role prompt; uses default prompt when |
|
|
| Welcome message at the start of the conversation; no welcome message is set when |
|
|
| Conversation playback volume, range |
Optional configuration parameters:
Parameter | Type | Default | Description |
|---|---|---|---|
|
|
| Interruption detection duration in ms. |
|
|
| Keywords that trigger interruption. |
|
|
| Whether to enable face tracking during conversation. |
|
|
| Whether to log conversation subtitles. |
Returns:
TaskHandle[None], see Section "Tasks and Subscriptions / TaskHandle"
Raises:
ValueError: Invalid configuration parameters.
RuntimeError: Failed to start speech chat task.
Example:
from boosteros.brain import Speech
from boosteros.brain.speech import ChatConfig
from boosteros.robots.booster import BoosterRobot
robot = BoosterRobot()
speech = Speech(robot)
handle = speech.chat(
config=ChatConfig(
system_prompt="You are a weather forecast assistant who can query weather forecasts across the country with reliable information sources.",
welcome_msg="Hello, I am a weather forecast assistant. Which city's weather would you like to query?",
volume=0.1,
),
enable_subtitle_log=True,
)
try:
print("Speech chat started, press Ctrl+C to exit")
status = handle.wait()
except KeyboardInterrupt:
print("\nStopping speech chat...")
handle.cancel()
handle.wait(timeout=5.0)