openai

package
v0.1.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Dec 14, 2025 License: MIT Imports: 10 Imported by: 0

Documentation

Overview

Package openai provides an OpenAI provider implementation for Bucephalus.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type APIError

type APIError struct {
	StatusCode int
	Message    string
	Type       string
	Code       string
}

APIError represents an error from the OpenAI API.

func (*APIError) Error

func (e *APIError) Error() string

type Option

type Option func(*providerConfig)

Option configures the OpenAI provider.

func WithAPIKey

func WithAPIKey(key string) Option

WithAPIKey sets the API key.

func WithBaseURL

func WithBaseURL(url string) Option

WithBaseURL sets a custom base URL.

func WithHTTPClient

func WithHTTPClient(client *http.Client) Option

WithHTTPClient sets a custom HTTP client.

type Provider

type Provider struct {
	// contains filtered or unexported fields
}

Provider implements the OpenAI API.

func New

func New(opts ...Option) (*Provider, error)

New creates a new OpenAI provider.

func (*Provider) Call

func (p *Provider) Call(ctx context.Context, req *provider.Request) (*provider.Response, error)

Call implements provider.Provider.

func (*Provider) CallStream

func (p *Provider) CallStream(ctx context.Context, req *provider.Request) (provider.ResponseStream, error)

CallStream implements provider.StreamingProvider.

func (*Provider) Name

func (p *Provider) Name() string

Name returns the provider identifier.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL