openai

package
v0.4.0 Latest Latest
Warning

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

Go to latest
Published: Jul 20, 2026 License: MIT Imports: 9 Imported by: 0

Documentation

Overview

Package openai is an Engine that speaks the OpenAI chat-completions wire format, which OpenAI, Azure OpenAI, Ollama, vLLM, LM Studio, and most gateways accept.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Engine

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

Engine is an OpenAI-compatible chat-completions engine.

func New

func New(baseURL, model string, opts ...Option) *Engine

New builds an engine for baseURL (e.g. "https://api.openai.com/v1") using model as the default when a Request does not name one.

func (*Engine) Complete

func (e *Engine) Complete(ctx context.Context, req agents.Request) (*agents.Response, error)

Complete implements agents.Engine.

type Option

type Option func(*Engine)

Option configures an Engine.

func WithAPIKey

func WithAPIKey(key string) Option

WithAPIKey sets the bearer token. Local servers (Ollama, LM Studio) run keyless, so it may be empty.

func WithHTTPClient

func WithHTTPClient(c *http.Client) Option

WithHTTPClient replaces the default client (for a custom timeout or transport).

Jump to

Keyboard shortcuts

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