pub async fn run(
gradium_api_key: Option<&str>,
gradium_base_url: Option<&str>,
llm_base_url: Option<&str>,
llm_model_name: Option<&str>,
llm_api_key: Option<&str>,
max_completion_tokens: Option<u32>,
session_config: Option<SessionConfig>,
io_format: IoFormat,
) -> Result<(SessionInputHandle, SessionOutputHandle)>Expand description
Create clients and start a session in one call.
This is a convenience function that combines client creation and session start.
For multiple sessions, use GradbotClients directly to reuse clients.
§Arguments
gradium_api_key- API key for Gradium STT/TTS services. Defaults toGRADIUM_API_KEYenv var.gradium_base_url- Base URL for Gradium services. Falls back toGRADIUM_BASE_URLenv var, thenhttps://api.gradium.ai.llm_base_url- Base URL for OpenAI-compatible LLM API. Falls back toLLM_BASE_URLenv var, then OpenAI’s API.llm_model_name- LLM model name. Resolution order: this parameter >LLM_MODELenv var > auto-detect.llm_api_key- API key for LLM API. Resolution: this parameter >LLM_API_KEYenv var >OPENAI_API_KEYenv var.max_completion_tokens- Maximum tokens for LLM responses. Defaults to 4096.session_config- Initial session configuration.io_format- Audio format pair for input decoding and output encoding.
§Example
ⓘ
let (input, mut output) = gradbot::run(
None, None, None, None, None, None,
Some(config),
IoFormat { input: decoder::Format::pcm(24000), output: encoder::Format::OggOpus },
).await?;