gpt4o

package
v0.14.0 Latest Latest
Warning

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

Go to latest
Published: Apr 16, 2026 License: MIT Imports: 11 Imported by: 0

Documentation

Overview

Package gpt4o implements engine.Engine for OpenAI GPT-4o vision understanding.

GPT-4o accepts text and image inputs via the Chat Completions API and returns text responses. Auth: Authorization: Bearer {api_key}, env OPENAI_API_KEY.

Supported models: gpt-4o, gpt-4o-mini, gpt-4-turbo.

Index

Constants

View Source
const (
	ModelGPT4o     = "gpt-4o"
	ModelGPT4oMini = "gpt-4o-mini"
	ModelGPT4Turbo = "gpt-4-turbo"
)

Model constants.

Variables

View Source
var (
	ErrMissingAPIKey = errors.New("gpt4o: missing API key (set Config.APIKey or OPENAI_API_KEY)")
	ErrMissingPrompt = errors.New("gpt4o: missing prompt in workflow graph")
)

Functions

func ConfigSchema

func ConfigSchema() []engine.ConfigField

ConfigSchema returns the configuration fields for the GPT-4o engine.

func ModelsByCapability

func ModelsByCapability() map[string][]string

ModelsByCapability returns known GPT-4o models grouped by capability.

Types

type Config

type Config struct {
	APIKey     string
	BaseURL    string // default: https://api.openai.com/v1
	Model      string // default: gpt-4o
	HTTPClient *http.Client
	MaxTokens  int // default: 4096
}

Config configures the GPT-4o vision engine.

type Engine

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

Engine implements engine.Engine for GPT-4o vision understanding.

func New

func New(cfg Config) *Engine

New creates a GPT-4o vision engine instance.

func (*Engine) Capabilities

func (e *Engine) Capabilities() engine.Capability

Capabilities implements engine.Describer.

func (*Engine) Execute

func (e *Engine) Execute(ctx context.Context, g workflow.Graph) (engine.Result, error)

Execute analyses text and/or images via the OpenAI Chat Completions API.

Jump to

Keyboard shortcuts

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