Help us shape the future of Go! Take the 2026 Go Developer Survey

ai

package
v0.12.1 Latest Latest
Warning

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

Go to latest
Published: Mar 25, 2026 License: MIT Imports: 4 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type AIClient

type AIClient interface {
	GetCommitMessage(ctx context.Context, prompt string) (string, error)
	SanitizeResponse(message, commitType string) string
	ProviderName() string
	MaybeSummarizeDiff(diff string, maxLength int) (string, bool)
}

AIClient defines the interface for AI providers.

type BaseAIClient

type BaseAIClient struct {
	Provider string
}

func (*BaseAIClient) MaybeSummarizeDiff

func (b *BaseAIClient) MaybeSummarizeDiff(diff string, maxLength int) (string, bool)

func (*BaseAIClient) ProviderName

func (b *BaseAIClient) ProviderName() string

func (*BaseAIClient) SanitizeResponse

func (b *BaseAIClient) SanitizeResponse(message, commitType string) string

type StreamingAIClient added in v0.9.0

type StreamingAIClient interface {
	StreamCommitMessage(ctx context.Context, prompt string, onDelta func(delta string)) (final string, err error)
}

StreamingAIClient is an optional interface that providers can implement to stream text deltas while generating the message. Implementations should call onDelta with incremental text (may be per-token or per-chunk) and return the final full text when the stream finishes.

Jump to

Keyboard shortcuts

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