api

package
v0.0.0-...-0d510b1 Latest Latest
Warning

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

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

Documentation

Overview

Package api provides ExecutorV2 implementations backed by remote AI APIs (OpenAI, Anthropic, Google AI) instead of local CLI processes.

Index

Constants

View Source
const (
	DefaultOpenAIModel    = "gpt-4o"
	DefaultAnthropicModel = "claude-sonnet-4-5-20250929"
	DefaultGoogleAIModel  = "gemini-2.0-flash"

	// DefaultTimeout is the maximum time allowed for a single API call.
	DefaultTimeout = 5 * time.Minute
)

Variables

This section is empty.

Functions

This section is empty.

Types

type AnthropicExecutor

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

AnthropicExecutor sends prompts to the Anthropic Messages API.

func NewAnthropic

func NewAnthropic(apiKey, model string) (*AnthropicExecutor, error)

NewAnthropic creates a new AnthropicExecutor. apiKey must be non-empty; if model is empty, DefaultAnthropicModel is used.

func (*AnthropicExecutor) Close

func (e *AnthropicExecutor) Close() error

Close permanently shuts down the executor.

func (*AnthropicExecutor) Info

Info returns static metadata about this executor.

func (*AnthropicExecutor) IsAlive

func (e *AnthropicExecutor) IsAlive() types.HealthStatus

IsAlive reports whether the executor is still operational.

func (*AnthropicExecutor) Send

Send sends a single message to the Anthropic API and returns the full response.

func (*AnthropicExecutor) SendStream

func (e *AnthropicExecutor) SendStream(ctx context.Context, msg types.Message, onChunk func(types.Chunk)) (*types.Response, error)

SendStream streams a message and invokes onChunk for each text delta.

type GoogleAIExecutor

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

GoogleAIExecutor sends prompts to the Google AI (Gemini) API.

func NewGoogleAI

func NewGoogleAI(apiKey, model string) (*GoogleAIExecutor, error)

NewGoogleAI creates a new GoogleAIExecutor. apiKey must be non-empty; if model is empty, DefaultGoogleAIModel ("gemini-2.0-flash") is used.

func (*GoogleAIExecutor) Close

func (e *GoogleAIExecutor) Close() error

Close permanently shuts down the executor.

func (*GoogleAIExecutor) Info

Info returns static metadata about this executor.

func (*GoogleAIExecutor) IsAlive

func (e *GoogleAIExecutor) IsAlive() types.HealthStatus

IsAlive reports whether the executor is still operational.

func (*GoogleAIExecutor) Send

Send sends a single message to the Google AI API and returns the full response.

func (*GoogleAIExecutor) SendStream

func (e *GoogleAIExecutor) SendStream(ctx context.Context, msg types.Message, onChunk func(types.Chunk)) (*types.Response, error)

SendStream streams content from the Google AI API, invoking onChunk for each partial response.

type OpenAIExecutor

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

OpenAIExecutor sends prompts to the OpenAI Chat Completions API.

func NewOpenAI

func NewOpenAI(apiKey, model string) (*OpenAIExecutor, error)

NewOpenAI creates a new OpenAIExecutor. apiKey must be non-empty; if model is empty, DefaultOpenAIModel ("gpt-4o") is used.

func (*OpenAIExecutor) Close

func (e *OpenAIExecutor) Close() error

Close permanently shuts down the executor. Subsequent calls to Send or SendStream will return an error.

func (*OpenAIExecutor) Info

func (e *OpenAIExecutor) Info() types.ExecutorInfo

Info returns static metadata about this executor.

func (*OpenAIExecutor) IsAlive

func (e *OpenAIExecutor) IsAlive() types.HealthStatus

IsAlive reports whether the executor is still operational.

func (*OpenAIExecutor) Send

Send sends a single message to the OpenAI API and returns the full response.

func (*OpenAIExecutor) SendStream

func (e *OpenAIExecutor) SendStream(ctx context.Context, msg types.Message, onChunk func(types.Chunk)) (*types.Response, error)

SendStream sends a message and invokes onChunk for each streaming delta. The final accumulated Response is returned after streaming completes.

Jump to

Keyboard shortcuts

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