Documentation
¶
Overview ¶
Package genkit provides Genkit-backed implementations of provider.Provider.
Index ¶
- func Instance(ctx context.Context) *gk.Genkit
- func NewACPProvider(name, binPath string, args []string, workDir string) (provider.Provider, error)
- func NewAnthropicFoundryProvider(ctx context.Context, resource, model, apiKey, entraToken string, maxTokens int) (provider.Provider, error)
- func NewAnthropicProvider(ctx context.Context, apiKey, model, baseURL string, maxTokens int) (provider.Provider, error)
- func NewAzureOpenAIProvider(ctx context.Context, ...) (provider.Provider, error)
- func NewBedrockProvider(ctx context.Context, ...) (provider.Provider, error)
- func NewClaudeCodeProvider(workDir string) (provider.Provider, error)
- func NewCodexCLIProvider(workDir string) (provider.Provider, error)
- func NewCopilotCLIProvider(workDir string) (provider.Provider, error)
- func NewCursorCLIProvider(workDir string) (provider.Provider, error)
- func NewGeminiCLIProvider(workDir string) (provider.Provider, error)
- func NewGoogleAIProvider(ctx context.Context, apiKey, model string, maxTokens int) (provider.Provider, error)
- func NewOllamaProvider(ctx context.Context, model, serverAddress string, maxTokens int) (provider.Provider, error)
- func NewOpenAICompatibleProvider(ctx context.Context, providerName, apiKey, model, baseURL string, ...) (provider.Provider, error)
- func NewOpenAIProvider(ctx context.Context, apiKey, model, baseURL string, maxTokens int) (provider.Provider, error)
- func NewVertexAIProvider(ctx context.Context, projectID, region, model, credentialsJSON string, ...) (provider.Provider, error)
- type CLIAdapter
- type ClaudeCodeAdapter
- func (ClaudeCodeAdapter) Binary() string
- func (ClaudeCodeAdapter) DetectPrompt(output string) bool
- func (ClaudeCodeAdapter) DetectResponseEnd(output string) bool
- func (ClaudeCodeAdapter) HealthCheckArgs() []string
- func (ClaudeCodeAdapter) Name() string
- func (ClaudeCodeAdapter) NonInteractiveArgs(msg string) []string
- func (ClaudeCodeAdapter) ParseResponse(raw string) string
- func (ClaudeCodeAdapter) ParseStreamEvent(line string) (string, bool)
- func (ClaudeCodeAdapter) StreamingArgs(msg string) []string
- func (ClaudeCodeAdapter) SupportsInteractivePTY() bool
- type CodexCLIAdapter
- func (CodexCLIAdapter) Binary() string
- func (CodexCLIAdapter) DetectPrompt(output string) bool
- func (CodexCLIAdapter) DetectResponseEnd(output string) bool
- func (CodexCLIAdapter) HealthCheckArgs() []string
- func (CodexCLIAdapter) Name() string
- func (CodexCLIAdapter) NonInteractiveArgs(msg string) []string
- func (CodexCLIAdapter) ParseResponse(raw string) string
- func (CodexCLIAdapter) ParseStreamEvent(_ string) (string, bool)
- func (CodexCLIAdapter) StreamingArgs(_ string) []string
- func (CodexCLIAdapter) SupportsInteractivePTY() bool
- type CopilotCLIAdapter
- func (CopilotCLIAdapter) Binary() string
- func (CopilotCLIAdapter) DetectPrompt(output string) bool
- func (CopilotCLIAdapter) DetectResponseEnd(output string) bool
- func (CopilotCLIAdapter) HealthCheckArgs() []string
- func (CopilotCLIAdapter) Name() string
- func (CopilotCLIAdapter) NonInteractiveArgs(msg string) []string
- func (CopilotCLIAdapter) ParseResponse(raw string) string
- func (CopilotCLIAdapter) ParseStreamEvent(_ string) (string, bool)
- func (CopilotCLIAdapter) StreamingArgs(_ string) []string
- func (CopilotCLIAdapter) SupportsInteractivePTY() bool
- type CursorCLIAdapter
- func (CursorCLIAdapter) Binary() string
- func (CursorCLIAdapter) DetectPrompt(output string) bool
- func (CursorCLIAdapter) DetectResponseEnd(output string) bool
- func (CursorCLIAdapter) HealthCheckArgs() []string
- func (CursorCLIAdapter) Name() string
- func (CursorCLIAdapter) NonInteractiveArgs(msg string) []string
- func (CursorCLIAdapter) ParseResponse(raw string) string
- func (CursorCLIAdapter) ParseStreamEvent(_ string) (string, bool)
- func (CursorCLIAdapter) StreamingArgs(_ string) []string
- func (CursorCLIAdapter) SupportsInteractivePTY() bool
- type GeminiCLIAdapter
- func (GeminiCLIAdapter) Binary() string
- func (GeminiCLIAdapter) DetectPrompt(output string) bool
- func (GeminiCLIAdapter) DetectResponseEnd(output string) bool
- func (GeminiCLIAdapter) HealthCheckArgs() []string
- func (GeminiCLIAdapter) Name() string
- func (GeminiCLIAdapter) NonInteractiveArgs(msg string) []string
- func (GeminiCLIAdapter) ParseResponse(raw string) string
- func (GeminiCLIAdapter) ParseStreamEvent(line string) (string, bool)
- func (GeminiCLIAdapter) StreamingArgs(msg string) []string
- func (GeminiCLIAdapter) SupportsInteractivePTY() bool
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func Instance ¶
Instance returns the shared Genkit instance, initializing it lazily on first call. This instance has no plugins and is used for mock/test model definitions. Production providers use per-factory Genkit instances initialized with their specific plugin.
func NewACPProvider ¶ added in v0.6.13
NewACPProvider creates a provider that drives an ACP-compliant agent binary.
func NewAnthropicFoundryProvider ¶
func NewAnthropicFoundryProvider(ctx context.Context, resource, model, apiKey, entraToken string, maxTokens int) (provider.Provider, error)
NewAnthropicFoundryProvider creates a provider for Anthropic on Azure AI Foundry.
func NewAnthropicProvider ¶
func NewAnthropicProvider(ctx context.Context, apiKey, model, baseURL string, maxTokens int) (provider.Provider, error)
NewAnthropicProvider creates a provider backed by Genkit's Anthropic plugin.
func NewAzureOpenAIProvider ¶
func NewAzureOpenAIProvider(ctx context.Context, resource, deploymentName, apiVersion, apiKey, entraToken string, maxTokens int) (provider.Provider, error)
NewAzureOpenAIProvider creates a provider for Azure OpenAI Service.
func NewBedrockProvider ¶
func NewBedrockProvider(ctx context.Context, region, model, accessKeyID, secretAccessKey, sessionToken, baseURL string, maxTokens int) (provider.Provider, error)
NewBedrockProvider creates a provider for AWS Bedrock using an OpenAI-compatible endpoint. Wraps existing Bedrock implementation as a provider.Provider until a native Genkit plugin is available.
func NewClaudeCodeProvider ¶ added in v0.6.5
NewClaudeCodeProvider creates a provider backed by the `claude` CLI.
func NewCodexCLIProvider ¶ added in v0.6.5
NewCodexCLIProvider creates a provider backed by the `codex` CLI.
func NewCopilotCLIProvider ¶ added in v0.6.5
NewCopilotCLIProvider creates a provider backed by the `copilot` CLI.
func NewCursorCLIProvider ¶ added in v0.6.5
NewCursorCLIProvider creates a provider backed by the `agent` CLI (Cursor).
func NewGeminiCLIProvider ¶ added in v0.6.5
NewGeminiCLIProvider creates a provider backed by the `gemini` CLI.
func NewGoogleAIProvider ¶
func NewGoogleAIProvider(ctx context.Context, apiKey, model string, maxTokens int) (provider.Provider, error)
NewGoogleAIProvider creates a provider backed by Genkit's Google AI plugin (Gemini API).
func NewOllamaProvider ¶
func NewOllamaProvider(ctx context.Context, model, serverAddress string, maxTokens int) (provider.Provider, error)
NewOllamaProvider creates a provider backed by Genkit's Ollama plugin.
func NewOpenAICompatibleProvider ¶
func NewOpenAICompatibleProvider(ctx context.Context, providerName, apiKey, model, baseURL string, maxTokens int) (provider.Provider, error)
NewOpenAICompatibleProvider creates a provider for OpenAI-compatible endpoints. Used for OpenRouter, Copilot, Cohere, HuggingFace, llama.cpp, etc.
Types ¶
type CLIAdapter ¶ added in v0.6.5
type CLIAdapter interface {
// Name returns the provider type name (e.g. "claude_code").
Name() string
// Binary returns the binary name to execute (e.g. "claude").
Binary() string
// NonInteractiveArgs returns CLI args for single-shot (non-interactive) mode.
NonInteractiveArgs(msg string) []string
// StreamingArgs returns CLI args for streaming JSON output mode.
// Returns nil if the tool doesn't support structured streaming — falls back
// to NonInteractiveArgs with line-by-line stdout reading.
StreamingArgs(msg string) []string
// HealthCheckArgs returns args for a quick health check invocation.
HealthCheckArgs() []string
// DetectPrompt returns true when the CLI output indicates it is ready for input.
DetectPrompt(output string) bool
// DetectResponseEnd returns true when the CLI output indicates the response is complete.
DetectResponseEnd(output string) bool
// ParseResponse cleans raw PTY output into plain response text.
ParseResponse(raw string) string
// ParseStreamEvent parses a line of streaming JSON output into text content.
// Returns the text content and true if the line contained assistant text,
// or empty string and false if the line should be skipped.
ParseStreamEvent(line string) (string, bool)
// SupportsInteractivePTY returns true if the tool's interactive TUI is
// compatible with vt10x screen reading. Tools that return false skip the
// interactive path and go straight to JSON streaming or non-interactive exec.
SupportsInteractivePTY() bool
}
CLIAdapter defines per-tool behavior for driving a CLI via PTY.
type ClaudeCodeAdapter ¶ added in v0.6.5
type ClaudeCodeAdapter struct{}
ClaudeCodeAdapter drives the `claude` CLI.
func (ClaudeCodeAdapter) Binary ¶ added in v0.6.5
func (ClaudeCodeAdapter) Binary() string
func (ClaudeCodeAdapter) DetectPrompt ¶ added in v0.6.5
func (ClaudeCodeAdapter) DetectPrompt(output string) bool
func (ClaudeCodeAdapter) DetectResponseEnd ¶ added in v0.6.5
func (ClaudeCodeAdapter) DetectResponseEnd(output string) bool
func (ClaudeCodeAdapter) HealthCheckArgs ¶ added in v0.6.5
func (ClaudeCodeAdapter) HealthCheckArgs() []string
func (ClaudeCodeAdapter) Name ¶ added in v0.6.5
func (ClaudeCodeAdapter) Name() string
func (ClaudeCodeAdapter) NonInteractiveArgs ¶ added in v0.6.5
func (ClaudeCodeAdapter) NonInteractiveArgs(msg string) []string
func (ClaudeCodeAdapter) ParseResponse ¶ added in v0.6.5
func (ClaudeCodeAdapter) ParseResponse(raw string) string
func (ClaudeCodeAdapter) ParseStreamEvent ¶ added in v0.6.7
func (ClaudeCodeAdapter) ParseStreamEvent(line string) (string, bool)
func (ClaudeCodeAdapter) StreamingArgs ¶ added in v0.6.7
func (ClaudeCodeAdapter) StreamingArgs(msg string) []string
func (ClaudeCodeAdapter) SupportsInteractivePTY ¶ added in v0.6.12
func (ClaudeCodeAdapter) SupportsInteractivePTY() bool
type CodexCLIAdapter ¶ added in v0.6.5
type CodexCLIAdapter struct{}
CodexCLIAdapter drives the `codex` CLI.
func (CodexCLIAdapter) Binary ¶ added in v0.6.5
func (CodexCLIAdapter) Binary() string
func (CodexCLIAdapter) DetectPrompt ¶ added in v0.6.5
func (CodexCLIAdapter) DetectPrompt(output string) bool
func (CodexCLIAdapter) DetectResponseEnd ¶ added in v0.6.5
func (CodexCLIAdapter) DetectResponseEnd(output string) bool
func (CodexCLIAdapter) HealthCheckArgs ¶ added in v0.6.5
func (CodexCLIAdapter) HealthCheckArgs() []string
func (CodexCLIAdapter) Name ¶ added in v0.6.5
func (CodexCLIAdapter) Name() string
func (CodexCLIAdapter) NonInteractiveArgs ¶ added in v0.6.5
func (CodexCLIAdapter) NonInteractiveArgs(msg string) []string
func (CodexCLIAdapter) ParseResponse ¶ added in v0.6.5
func (CodexCLIAdapter) ParseResponse(raw string) string
func (CodexCLIAdapter) ParseStreamEvent ¶ added in v0.6.7
func (CodexCLIAdapter) ParseStreamEvent(_ string) (string, bool)
func (CodexCLIAdapter) StreamingArgs ¶ added in v0.6.7
func (CodexCLIAdapter) StreamingArgs(_ string) []string
func (CodexCLIAdapter) SupportsInteractivePTY ¶ added in v0.6.12
func (CodexCLIAdapter) SupportsInteractivePTY() bool
type CopilotCLIAdapter ¶ added in v0.6.5
type CopilotCLIAdapter struct{}
CopilotCLIAdapter drives the `copilot` CLI.
func (CopilotCLIAdapter) Binary ¶ added in v0.6.5
func (CopilotCLIAdapter) Binary() string
func (CopilotCLIAdapter) DetectPrompt ¶ added in v0.6.5
func (CopilotCLIAdapter) DetectPrompt(output string) bool
func (CopilotCLIAdapter) DetectResponseEnd ¶ added in v0.6.5
func (CopilotCLIAdapter) DetectResponseEnd(output string) bool
func (CopilotCLIAdapter) HealthCheckArgs ¶ added in v0.6.5
func (CopilotCLIAdapter) HealthCheckArgs() []string
func (CopilotCLIAdapter) Name ¶ added in v0.6.5
func (CopilotCLIAdapter) Name() string
func (CopilotCLIAdapter) NonInteractiveArgs ¶ added in v0.6.5
func (CopilotCLIAdapter) NonInteractiveArgs(msg string) []string
func (CopilotCLIAdapter) ParseResponse ¶ added in v0.6.5
func (CopilotCLIAdapter) ParseResponse(raw string) string
func (CopilotCLIAdapter) ParseStreamEvent ¶ added in v0.6.7
func (CopilotCLIAdapter) ParseStreamEvent(_ string) (string, bool)
func (CopilotCLIAdapter) StreamingArgs ¶ added in v0.6.7
func (CopilotCLIAdapter) StreamingArgs(_ string) []string
Copilot uses non-interactive fallback for now — interactive PTY response extraction needs refinement for Copilot's specific screen layout.
func (CopilotCLIAdapter) SupportsInteractivePTY ¶ added in v0.6.12
func (CopilotCLIAdapter) SupportsInteractivePTY() bool
SupportsInteractivePTY returns true — Copilot uses vt10x with screen-diff extraction.
type CursorCLIAdapter ¶ added in v0.6.5
type CursorCLIAdapter struct{}
CursorCLIAdapter drives the `agent` binary (Cursor's agent CLI).
func (CursorCLIAdapter) Binary ¶ added in v0.6.5
func (CursorCLIAdapter) Binary() string
func (CursorCLIAdapter) DetectPrompt ¶ added in v0.6.5
func (CursorCLIAdapter) DetectPrompt(output string) bool
func (CursorCLIAdapter) DetectResponseEnd ¶ added in v0.6.5
func (CursorCLIAdapter) DetectResponseEnd(output string) bool
func (CursorCLIAdapter) HealthCheckArgs ¶ added in v0.6.5
func (CursorCLIAdapter) HealthCheckArgs() []string
func (CursorCLIAdapter) Name ¶ added in v0.6.5
func (CursorCLIAdapter) Name() string
func (CursorCLIAdapter) NonInteractiveArgs ¶ added in v0.6.5
func (CursorCLIAdapter) NonInteractiveArgs(msg string) []string
func (CursorCLIAdapter) ParseResponse ¶ added in v0.6.5
func (CursorCLIAdapter) ParseResponse(raw string) string
func (CursorCLIAdapter) ParseStreamEvent ¶ added in v0.6.7
func (CursorCLIAdapter) ParseStreamEvent(_ string) (string, bool)
func (CursorCLIAdapter) StreamingArgs ¶ added in v0.6.7
func (CursorCLIAdapter) StreamingArgs(_ string) []string
func (CursorCLIAdapter) SupportsInteractivePTY ¶ added in v0.6.12
func (CursorCLIAdapter) SupportsInteractivePTY() bool
type GeminiCLIAdapter ¶ added in v0.6.5
type GeminiCLIAdapter struct{}
GeminiCLIAdapter drives the `gemini` CLI.
func (GeminiCLIAdapter) Binary ¶ added in v0.6.5
func (GeminiCLIAdapter) Binary() string
func (GeminiCLIAdapter) DetectPrompt ¶ added in v0.6.5
func (GeminiCLIAdapter) DetectPrompt(output string) bool
func (GeminiCLIAdapter) DetectResponseEnd ¶ added in v0.6.5
func (GeminiCLIAdapter) DetectResponseEnd(output string) bool
func (GeminiCLIAdapter) HealthCheckArgs ¶ added in v0.6.5
func (GeminiCLIAdapter) HealthCheckArgs() []string
func (GeminiCLIAdapter) Name ¶ added in v0.6.5
func (GeminiCLIAdapter) Name() string
func (GeminiCLIAdapter) NonInteractiveArgs ¶ added in v0.6.5
func (GeminiCLIAdapter) NonInteractiveArgs(msg string) []string
func (GeminiCLIAdapter) ParseResponse ¶ added in v0.6.5
func (GeminiCLIAdapter) ParseResponse(raw string) string
func (GeminiCLIAdapter) ParseStreamEvent ¶ added in v0.6.7
func (GeminiCLIAdapter) ParseStreamEvent(line string) (string, bool)
func (GeminiCLIAdapter) StreamingArgs ¶ added in v0.6.7
func (GeminiCLIAdapter) StreamingArgs(msg string) []string
func (GeminiCLIAdapter) SupportsInteractivePTY ¶ added in v0.6.12
func (GeminiCLIAdapter) SupportsInteractivePTY() bool