openai_builder

Function openai_builder 

Source
pub fn openai_builder(
    model: &str,
    api_key: Option<&str>,
) -> Result<OpenAIBuilder>
Expand description

Create an OpenAI agent builder

§Arguments

  • model - The model name to use
  • api_key - Optional API key from config. Resolution order:
    1. Non-empty api_key parameter (from config)
    2. OPENAI_API_KEY environment variable
    3. Client’s from_env() (requires env var to be set)

§Errors

Returns an error if client creation fails (invalid credentials or missing env var).

§Security

Error messages are sanitized to prevent potential API key exposure.