async-openai icon indicating copy to clipboard operation
async-openai copied to clipboard

chore: add with_headers method

Open b0xtch opened this issue 1 year ago • 2 comments

Support custom headers required for observability applications

    let client = Client::with_config(
        OpenAIConfig::default()
            .with_api_base(api_base)
            .with_headers(HashMap::from([(
                "Helicone-Auth".to_string(),
                format!("Bearer {}", config_env_var("HELICONE_API_KEY")?),
            )])),
    );

b0xtch avatar Jul 19 '24 20:07 b0xtch

Thanks for the PR, I'll leave review seperately

64bit avatar Jul 24 '24 17:07 64bit

Hey, any raeson this is not merged yet ?

vitorfdl avatar Apr 08 '25 00:04 vitorfdl

Thanks for the PR!

The latest release has with_header method to enable this behaviour without custom deserialization implementation:

https://docs.rs/async-openai/0.31.0-alpha.7/async_openai/config/struct.OpenAIConfig.html#method.with_header, hence closing.

64bit avatar Nov 16 '25 00:11 64bit