Package com.tnsai.tools.media
Class ChatterboxTools
java.lang.Object
com.tnsai.tools.media.ChatterboxTools
Function-shape Chatterbox TTS tool — open-source text-to-speech with
emotion control + 23-language support. Replaces legacy
ChatterboxTTSTool's speak branch. The legacy
ChatterboxStreamingTool (WebSocket-based real-time streaming)
and the clone operation (voice cloning from 5-second samples)
are intentionally deferred — both add transport / file-handling
complexity for marginal value over the basic synthesis.
| Method | Endpoint | Idempotent |
|---|---|---|
chatterboxTts(java.lang.String, java.lang.String, double, java.lang.String) | POST {endpoint}/tts | true (deterministic synthesis for same input) |
Defaults to a local Chatterbox server at http://localhost:8000
— set CHATTERBOX_API_URL for a different endpoint and
CHATTERBOX_API_KEY when the deployment requires auth.
- Since:
- 0.5.7 (Phase 2 batch 35 — built-in tool migration to function shape, see #188)
-
Constructor Summary
ConstructorsConstructorDescriptionDefault constructor — picks CHATTERBOX_API_URL + CHATTERBOX_API_KEY from env.ChatterboxTools(String apiUrl, String apiKey) Explicit-credentials constructor (apiKey may be null for unauthenticated local servers).ChatterboxTools(String apiUrl, String apiKey, okhttp3.OkHttpClient http, com.fasterxml.jackson.databind.ObjectMapper mapper) Full constructor for tests / shared HTTP. -
Method Summary
Modifier and TypeMethodDescriptionchatterboxTts(String text, String voice, double emotion, String language)
-
Constructor Details
-
ChatterboxTools
public ChatterboxTools()Default constructor — picks CHATTERBOX_API_URL + CHATTERBOX_API_KEY from env. -
ChatterboxTools
Explicit-credentials constructor (apiKey may be null for unauthenticated local servers). -
ChatterboxTools
public ChatterboxTools(String apiUrl, String apiKey, okhttp3.OkHttpClient http, com.fasterxml.jackson.databind.ObjectMapper mapper) Full constructor for tests / shared HTTP.
-
-
Method Details
-
chatterboxTts
@Tool(name="chatterbox_tts", description="Synthesize speech from {text} via a Chatterbox TTS server. {voice} picks the voice profile (default \"default\"); {emotion} clamps to [0.0, 1.0] (0 = monotone, 1 = dramatic; default 0.5); {language} is an ISO-639 code (default \"en\" \u2014 Chatterbox multilingual model supports 23 languages including \"tr\"). Returns base64-encoded audio bytes. Max text length 10,000 chars. Defaults to a local server at http://localhost:8000.", keywords={"chatterbox","tts","text-to-speech","voice","speech","audio","multilingual"}, idempotent=true) public String chatterboxTts(@ToolParam(description="Text to synthesize (max 10,000 chars)") String text, @ToolParam(description="Voice profile name (default \"default\")",required=false,defaultValue="default") String voice, @ToolParam(description="Emotion intensity (0.0..1.0); 0 \u2192 default 0.5",required=false,defaultValue="0.5") double emotion, @ToolParam(description="ISO-639 language code (default \"en\")",required=false,defaultValue="en") String language) throws IOException - Throws:
IOException
-