OpenAI LLM provider.
Wraps the OpenAI chat completions API with automatic Req client configuration, Bearer token auth, and JSON encoding.
Example
provider = ExAgent.Providers.OpenAI.new(api_key: "sk-...")
ExAgent.Provider.chat(provider, messages)
Summary
Types
@type t() :: %ExAgent.Providers.OpenAI{ api_key: String.t(), base_url: String.t(), max_tokens: integer() | nil, model: String.t(), req: Req.Request.t() | nil, system_prompt: String.t() | nil, temperature: float() | nil, tools: [ExAgent.Tool.t()] }
Functions
Creates a new OpenAI provider with validated options and initialized Req client.
Options
:api_key(required) - OpenAI API key:model- Model name (default:"gpt-4o"):base_url- API base URL (default:"https://api.openai.com/v1"):system_prompt- System prompt to prepend to messages:tools- List ofExAgent.Toolstructs