Documentation
¶
Overview ¶
Package openai provides an OpenAI LLM provider for langrails.
Supports all OpenAI chat completion models including GPT-4o, GPT-4, o1, and GPT-3.5. Features include streaming, tool calling, structured output, and reasoning mode for o-series models.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Option ¶
Option configures the OpenAI provider.
func WithBaseURL ¶
WithBaseURL sets a custom base URL (useful for Azure OpenAI or proxies).
func WithHTTPClient ¶
WithHTTPClient sets a custom HTTP client.
type Provider ¶
type Provider struct {
// contains filtered or unexported fields
}
Provider implements langrails.Provider for OpenAI's API.
func (*Provider) Complete ¶
func (p *Provider) Complete(ctx context.Context, req *langrails.CompletionRequest) (*langrails.CompletionResponse, error)
Complete sends a completion request and returns the full response.
func (*Provider) Stream ¶
func (p *Provider) Stream(ctx context.Context, req *langrails.CompletionRequest) (<-chan langrails.StreamEvent, error)
Stream sends a completion request and returns a channel of streaming events.
Click to show internal directories.
Click to hide internal directories.