openai

package
v0.9.1 Latest Latest
Warning

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

Go to latest
Published: Apr 10, 2026 License: MIT Imports: 13 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Config

type Config struct {
	BaseURL string
	APIKey  string
}

Config configures the OpenAI provider.

type Provider

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

Provider implements providers.ProviderAdapter for OpenAI chat completions.

func New

func New(cfg Config) *Provider

New returns an OpenAI provider.

func (*Provider) API

func (p *Provider) API() string

API returns provider key.

func (*Provider) ListModels

func (p *Provider) ListModels(ctx context.Context) ([]ai.Model, error)

ListModels fetches available models from the OpenAI API.

func (*Provider) Stream

func (p *Provider) Stream(goCtx context.Context, model ai.Model, ctx ai.Context, opts ai.StreamOptions) (providers.AssistantEventStream, error)

Stream starts OpenAI chat completion stream.

func (*Provider) StreamSimple

func (p *Provider) StreamSimple(goCtx context.Context, model ai.Model, ctx ai.Context, opts ai.SimpleStreamOptions) (providers.AssistantEventStream, error)

StreamSimple delegates to Stream with mapped options.

Jump to

Keyboard shortcuts

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