openai

package
v1.1.2 Latest Latest
Warning

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

Go to latest
Published: Nov 26, 2025 License: Apache-2.0 Imports: 10 Imported by: 5 modules, 3 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type OpenAIProvider

type OpenAIProvider struct {
	providers.BaseProvider
	// contains filtered or unexported fields
}

OpenAIProvider implements the Provider interface for OpenAI

func NewOpenAIProvider

func NewOpenAIProvider(id, model, baseURL string, defaults providers.ProviderDefaults, includeRawOutput bool) *OpenAIProvider

NewOpenAIProvider creates a new OpenAI provider

func (*OpenAIProvider) CalculateCost

func (p *OpenAIProvider) CalculateCost(tokensIn, tokensOut, cachedTokens int) types.CostInfo

CalculateCost calculates detailed cost breakdown including optional cached tokens

func (*OpenAIProvider) GetMultimodalCapabilities

func (p *OpenAIProvider) GetMultimodalCapabilities() providers.MultimodalCapabilities

GetMultimodalCapabilities returns OpenAI's multimodal capabilities

func (*OpenAIProvider) Predict

Predict sends a predict request to OpenAI

func (*OpenAIProvider) PredictMultimodal

PredictMultimodal performs a predict request with multimodal content

func (*OpenAIProvider) PredictMultimodalStream

func (p *OpenAIProvider) PredictMultimodalStream(ctx context.Context, req providers.PredictionRequest) (<-chan providers.StreamChunk, error)

PredictMultimodalStream performs a streaming predict request with multimodal content

func (*OpenAIProvider) PredictStream

func (p *OpenAIProvider) PredictStream(ctx context.Context, req providers.PredictionRequest) (<-chan providers.StreamChunk, error)

PredictStream streams a predict response from OpenAI

type OpenAIToolProvider

type OpenAIToolProvider struct {
	*OpenAIProvider
}

OpenAIToolProvider extends OpenAIProvider with tool support

func NewOpenAIToolProvider

func NewOpenAIToolProvider(id, model, baseURL string, defaults providers.ProviderDefaults, includeRawOutput bool, additionalConfig map[string]interface{}) *OpenAIToolProvider

NewOpenAIToolProvider creates a new OpenAI provider with tool support

func (*OpenAIToolProvider) BuildTooling

func (p *OpenAIToolProvider) BuildTooling(descriptors []*providers.ToolDescriptor) (interface{}, error)

BuildTooling converts tool descriptors to OpenAI format

func (*OpenAIToolProvider) PredictMultimodalWithTools

func (p *OpenAIToolProvider) PredictMultimodalWithTools(ctx context.Context, req providers.PredictionRequest, tools interface{}, toolChoice string) (providers.PredictionResponse, []types.MessageToolCall, error)

PredictMultimodalWithTools implements providers.MultimodalToolSupport interface for OpenAIToolProvider This allows combining multimodal content (images) with tool calls in a single request

func (*OpenAIToolProvider) PredictWithTools

func (p *OpenAIToolProvider) PredictWithTools(ctx context.Context, req providers.PredictionRequest, tools interface{}, toolChoice string) (providers.PredictionResponse, []types.MessageToolCall, error)

PredictWithTools performs a prediction request with tool support

Jump to

Keyboard shortcuts

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