Skip to main content

run

Function run 

Source
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 to GRADIUM_API_KEY env var.
  • gradium_base_url - Base URL for Gradium services. Falls back to GRADIUM_BASE_URL env var, then https://api.gradium.ai.
  • llm_base_url - Base URL for OpenAI-compatible LLM API. Falls back to LLM_BASE_URL env var, then OpenAI’s API.
  • llm_model_name - LLM model name. Resolution order: this parameter > LLM_MODEL env var > auto-detect.
  • llm_api_key - API key for LLM API. Resolution: this parameter > LLM_API_KEY env var > OPENAI_API_KEY env 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?;