genkit

package
v0.6.5 Latest Latest
Warning

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

Go to latest
Published: Apr 7, 2026 License: MIT Imports: 22 Imported by: 0

Documentation

Overview

Package genkit provides Genkit-backed implementations of provider.Provider.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Instance

func Instance(ctx context.Context) *gk.Genkit

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 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

func NewClaudeCodeProvider(workDir string) (provider.Provider, error)

NewClaudeCodeProvider creates a provider backed by the `claude` CLI.

func NewCodexCLIProvider added in v0.6.5

func NewCodexCLIProvider(workDir string) (provider.Provider, error)

NewCodexCLIProvider creates a provider backed by the `codex` CLI.

func NewCopilotCLIProvider added in v0.6.5

func NewCopilotCLIProvider(workDir string) (provider.Provider, error)

NewCopilotCLIProvider creates a provider backed by the `copilot` CLI.

func NewCursorCLIProvider added in v0.6.5

func NewCursorCLIProvider(workDir string) (provider.Provider, error)

NewCursorCLIProvider creates a provider backed by the `agent` CLI (Cursor).

func NewGeminiCLIProvider added in v0.6.5

func NewGeminiCLIProvider(workDir string) (provider.Provider, error)

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.

func NewOpenAIProvider

func NewOpenAIProvider(ctx context.Context, apiKey, model, baseURL string, maxTokens int) (provider.Provider, error)

NewOpenAIProvider creates a provider backed by Genkit's OpenAI plugin.

func NewVertexAIProvider

func NewVertexAIProvider(ctx context.Context, projectID, region, model, credentialsJSON string, maxTokens int) (provider.Provider, error)

NewVertexAIProvider creates a provider backed by Genkit's Vertex AI plugin.

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
	// 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
}

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

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

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

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

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

Jump to

Keyboard shortcuts

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