openai

package
v1.4.316 Latest Latest
Warning

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

Go to latest
Published: Sep 20, 2025 License: MIT Imports: 21 Imported by: 0

Documentation

Index

Constants

View Source
const ImageGenerationResponseType = "image_generation_call"

ImageGenerationResponseType is the type used for image generation calls in responses

View Source
const ImageGenerationToolType = "image_generation"
View Source
const MaxAudioFileSize int64 = 25 * 1024 * 1024

MaxAudioFileSize defines the maximum allowed size for audio uploads (25MB).

Variables

AllowedTranscriptionModels lists the models supported for transcription.

View Source
var ImageGenerationSupportedModels = []string{
	"gpt-4o",
	"gpt-4o-mini",
	"gpt-4.1",
	"gpt-4.1-mini",
	"gpt-4.1-nano",
	"o3",
}

ImageGenerationSupportedModels lists all models that support image generation

Functions

This section is empty.

Types

type Client

type Client struct {
	*plugins.PluginBase
	ApiKey              *plugins.SetupQuestion
	ApiBaseURL          *plugins.SetupQuestion
	ApiClient           *openai.Client
	ImplementsResponses bool // Whether this provider supports the Responses API
}

func NewClient

func NewClient() (ret *Client)

func NewClientCompatible

func NewClientCompatible(vendorName string, defaultBaseUrl string, configureCustom func() error) (ret *Client)

func NewClientCompatibleNoSetupQuestions

func NewClientCompatibleNoSetupQuestions(vendorName string, configureCustom func() error) (ret *Client)

func NewClientCompatibleWithResponses

func NewClientCompatibleWithResponses(vendorName string, defaultBaseUrl string, implementsResponses bool, configureCustom func() error) (ret *Client)

func (*Client) ListModels

func (o *Client) ListModels() (ret []string, err error)

func (*Client) NeedsRawMode

func (o *Client) NeedsRawMode(modelName string) bool

func (*Client) Send

func (o *Client) Send(ctx context.Context, msgs []*chat.ChatCompletionMessage, opts *domain.ChatOptions) (ret string, err error)

func (*Client) SendStream

func (o *Client) SendStream(
	msgs []*chat.ChatCompletionMessage, opts *domain.ChatOptions, channel chan string,
) (err error)

func (*Client) SetResponsesAPIEnabled added in v1.4.257

func (o *Client) SetResponsesAPIEnabled(enabled bool)

SetResponsesAPIEnabled configures whether to use the Responses API

func (*Client) TranscribeFile added in v1.4.291

func (o *Client) TranscribeFile(ctx context.Context, filePath, model string, split bool) (string, error)

TranscribeFile transcribes the given audio file using the specified model. If the file exceeds the size limit, it can optionally be split into chunks using ffmpeg.

type MessageConversionResult

type MessageConversionResult struct {
	Role            string
	Content         string
	MultiContent    []chat.ChatMessagePart
	HasMultiContent bool
}

MessageConversionResult holds the common conversion result

Jump to

Keyboard shortcuts

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