Class VoiceConfig
The one idea that makes this "easy"
Voice settings inherit from your chat settings. If easyai.properties already
configures a provider and key for EasyAI.chat(), then forListening() and
forSpeaking() reuse that same provider, key and base URL — so adding voice to an app
usually costs zero new configuration. You only write an easyai.stt.* or
easyai.tts.* key when you want voice to differ from chat.
Resolution order (first non-null wins)
| Setting | Listening (forListening()) | Speaking (forSpeaking()) |
|---|---|---|
| provider | easyai.stt.provider → easyai.provider → "openai" |
easyai.tts.provider → easyai.provider → "openai" |
| API key | easyai.stt.api-key → easyai.api-key |
easyai.tts.api-key → easyai.api-key |
| base URL | easyai.stt.base-url → easyai.base-url |
easyai.tts.base-url → easyai.base-url |
| model | easyai.stt.model-name → "whisper-1" |
easyai.tts.model-name → "tts-1" |
| extra | easyai.stt.language (ISO-639-1, optional) |
easyai.tts.voice → "alloy" |
Choosing a model name
The defaults are OpenAI's own ("whisper-1",
"tts-1"). Deliberately, nothing is guessed from the base URL. If you
point the base URL at another OpenAI-compatible service, name its model explicitly — for Groq,
for instance, easyai.stt.model-name=whisper-large-v3. A wrong model name fails loudly at
the provider, which is easier to debug than a library quietly picking a different one.
Analogy: a household's utility accounts. The lights and the heating bill to the same account unless you deliberately open a second one — and nobody rewires the house to guess which supplier you meant.
- See Also:
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic final classFluent builder forVoiceConfig; see the class documentation for defaults. -
Field Summary
Fields -
Method Summary
Modifier and TypeMethodDescriptionapiKey()baseUrl()static VoiceConfig.Builderbuilder()static VoiceConfigLoad the transcription (speech → text) configuration fromeasyai.properties, falling back to the chat settings as described in the class documentation.static VoiceConfigLoad the synthesis (text → speech) configuration fromeasyai.properties, falling back to the chat settings as described in the class documentation.language()provider()toString()voice()
-
Field Details
-
DEFAULT_TRANSCRIPTION_MODEL
Default transcription model (whisper-1— OpenAI's own).- See Also:
-
DEFAULT_SPEECH_MODEL
Default speech-synthesis model (tts-1— OpenAI's own).- See Also:
-
DEFAULT_VOICE
Default synthesis voice (alloy).- See Also:
-
-
Method Details
-
provider
- Returns:
- the provider id, e.g.
"openai"(also covers any OpenAI-compatible endpoint).
-
apiKey
- Returns:
- the API key, or
nullif none was configured.
-
baseUrl
- Returns:
- the base URL override, or
nullto use the provider's default.
-
modelName
- Returns:
- the model name to call (never
nullonce loaded from properties).
-
language
- Returns:
- the expected spoken language as an ISO-639-1 code, or
nullto auto-detect.
-
voice
- Returns:
- the synthesis voice name, or
nullfor the provider's default.
-
toBuilder
- Returns:
- a builder pre-filled with this configuration, for making a modified copy.
-
builder
- Returns:
- a new, empty builder.
-
forListening
Load the transcription (speech → text) configuration fromeasyai.properties, falling back to the chat settings as described in the class documentation.- Returns:
- settings for
EasyAI.listen()
-
forSpeaking
Load the synthesis (text → speech) configuration fromeasyai.properties, falling back to the chat settings as described in the class documentation.- Returns:
- settings for
EasyAI.speak()
-
toString
-