DeriveBamlClient

Derive Macro DeriveBamlClient 

Source
#[derive(DeriveBamlClient)]
{
    // Attributes available to this derive:
    #[baml]
}
Expand description

Derive macro for automatically implementing LLM client configuration

§Attributes

  • #[baml(provider = "OpenAI", model = "...")] - OpenAI client
  • #[baml(provider = "Anthropic", model = "...")] - Anthropic client
  • #[baml(provider = "Custom", base_url = "...", model = "...")] - Custom endpoint

§Example

#[derive(BamlClient)]
#[baml(provider = "OpenAI", model = "gpt-4o-mini")]
struct OpenAIClient;

// Usage:
let client = OpenAIClient::new(api_key);