VoiceAgentClient
The main class for interacting with the Lokutor Voice Agent.
Constructor
| Parameter | Type | Description |
|---|---|---|
api_key | str | Required. Your Lokutor API Key. |
prompt | str | Required. The system prompt defining the AI’s persona. |
voice | VoiceStyle | Optional. Default is VoiceStyle.F1. |
language | Language | Optional. Default is Language.ENGLISH. |
server_url | str | Optional. Custom WebSocket URL. |
on_transcription | Callable | Callback for user speech transcriptions. |
on_response | Callable | Callback for AI text responses. |
on_error | Callable | Callback for error events. |
Methods
start_conversation()
Starts the conversation loop, automatically handling microphone input and speaker output. Blocks until the session is ended or interrupted.
disconnect()
Gracefully closes the connection to the Lokutor servers.
TTSClient
Dedicated client for converting text to high-quality streaming audio.
Constructor
Methods
synthesize(options)
Starts the text-to-speech synthesis process.
Parameters:
| Parameter | Type | Description |
|---|---|---|
text | str | Required. The text to speak. |
voice | VoiceStyle | Optional. |
language | Language | Optional. |
speed | float | Optional. Default is 1.05. |
steps | int | Optional. Synthesis quality (1-50). Default is 24. |
play | bool | Optional. Whether to play audio automatically. |
block | bool | Optional. Whether to wait for playback to finish. |
Enums
VoiceStyle
F1toF5: Female voices.M1toM5: Male voices.
Language
ENGLISHSPANISHFRENCHPORTUGUESEKOREAN