openai

package
v1.0.0 Latest Latest
Warning

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

Go to latest
Published: Jan 13, 2026 License: MIT Imports: 17 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func ListModels

func ListModels(ctx context.Context, cfg config.ProviderConfig) ([]provider.ModelInfo, error)

func SetOpenAIBaseURL

func SetOpenAIBaseURL(url string)

SetOpenAIBaseURL overrides the OpenAI API base URL.

func SetOpenAIHTTPClientFactory

func SetOpenAIHTTPClientFactory(factory func() *http.Client)

SetOpenAIHTTPClientFactory overrides the HTTP client factory used for OpenAI list models.

Types

type Model

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

Model adapts OpenAI's chat completions to the ADK model.LLM interface.

func NewOpenAIModel

func NewOpenAIModel(apiKey string, modelName string) (*Model, error)

NewOpenAIModel creates a model.LLM adapter backed by OpenAI chat completions.

func NewOpenAIModelWithClient

func NewOpenAIModelWithClient(apiKey string, modelName string, client *http.Client) (*Model, error)

NewOpenAIModelWithClient creates a model.LLM adapter with a custom HTTP client.

func (*Model) GenerateContent

func (m *Model) GenerateContent(
	ctx context.Context,
	req *model.LLMRequest,
	stream bool,
) iter.Seq2[*model.LLMResponse, error]

func (*Model) Name

func (m *Model) Name() string

type OptOptionsSetter

type OptOptionsSetter func(o *Options)

func WithClient

func WithClient(opt *http.Client) OptOptionsSetter

type Options

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

func NewOptions

func NewOptions(
	apiKey string,
	model string,
	options ...OptOptionsSetter,
) Options

func (*Options) Validate

func (o *Options) Validate() error

type Provider

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

func NewProvider

func NewProvider(apiKey string, model string) (*Provider, error)

func NewProviderWithClient

func NewProviderWithClient(apiKey string, model string, client *http.Client) (*Provider, error)

NewProviderWithClient creates an OpenAI provider with a custom HTTP client.

func (*Provider) GenerateCommand

func (p *Provider) GenerateCommand(ctx context.Context, prompt string) (string, error)

func (*Provider) Name

func (p *Provider) Name() string

Jump to

Keyboard shortcuts

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