Documentation
¶
Overview ¶
Package api provides ExecutorV2 implementations backed by remote AI APIs (OpenAI, Anthropic, Google AI) instead of local CLI processes.
Index ¶
- Constants
- type AnthropicExecutor
- func (e *AnthropicExecutor) Close() error
- func (e *AnthropicExecutor) Info() types.ExecutorInfo
- func (e *AnthropicExecutor) IsAlive() types.HealthStatus
- func (e *AnthropicExecutor) Send(ctx context.Context, msg types.Message) (*types.Response, error)
- func (e *AnthropicExecutor) SendStream(ctx context.Context, msg types.Message, onChunk func(types.Chunk)) (*types.Response, error)
- type GoogleAIExecutor
- func (e *GoogleAIExecutor) Close() error
- func (e *GoogleAIExecutor) Info() types.ExecutorInfo
- func (e *GoogleAIExecutor) IsAlive() types.HealthStatus
- func (e *GoogleAIExecutor) Send(ctx context.Context, msg types.Message) (*types.Response, error)
- func (e *GoogleAIExecutor) SendStream(ctx context.Context, msg types.Message, onChunk func(types.Chunk)) (*types.Response, error)
- type OpenAIExecutor
- func (e *OpenAIExecutor) Close() error
- func (e *OpenAIExecutor) Info() types.ExecutorInfo
- func (e *OpenAIExecutor) IsAlive() types.HealthStatus
- func (e *OpenAIExecutor) Send(ctx context.Context, msg types.Message) (*types.Response, error)
- func (e *OpenAIExecutor) SendStream(ctx context.Context, msg types.Message, onChunk func(types.Chunk)) (*types.Response, error)
Constants ¶
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 ¶
func (e *AnthropicExecutor) Info() types.ExecutorInfo
Info returns static metadata about this executor.
func (*AnthropicExecutor) IsAlive ¶
func (e *AnthropicExecutor) IsAlive() types.HealthStatus
IsAlive reports whether the executor is still operational.
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 ¶
func (e *GoogleAIExecutor) Info() types.ExecutorInfo
Info returns static metadata about this executor.
func (*GoogleAIExecutor) IsAlive ¶
func (e *GoogleAIExecutor) IsAlive() types.HealthStatus
IsAlive reports whether the executor is still operational.
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.