types

package
v1.5.1 Latest Latest
Warning

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

Go to latest
Published: Oct 22, 2025 License: MIT Imports: 2 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var CommitPrompt = `` /* 762-byte string literal not displayed */

CommitPrompt is the base instruction template sent to LLM providers before appending repository changes and optional style guidance.

Functions

func BuildCommitPrompt added in v1.3.23

func BuildCommitPrompt(changes string, opts *GenerationOptions) string

BuildCommitPrompt constructs the prompt that will be sent to the LLM, applying any optional tone/style instructions before appending the repository changes.

func GetSupportedProviderStrings added in v1.3.22

func GetSupportedProviderStrings() []string

GetSupportedProviderStrings returns the human-friendly names for providers.

Types

type Choice

type Choice struct {
	Message      Message `json:"message"`
	Index        int     `json:"index"`
	FinishReason string  `json:"finish_reason"`
}

Choice details a single response option returned by Grok.

type Config

type Config struct {
	GrokAPI string                `json:"grok_api"`
	Repos   map[string]RepoConfig `json:"repos"`
}

Config stores CLI-level configuration including named repositories.

type GenerationOptions added in v1.3.23

type GenerationOptions struct {
	// StyleInstruction contains optional tone/style guidance appended to the base prompt.
	StyleInstruction string
	// Attempt records the 1-indexed attempt number for this generation request.
	// Attempt > 1 signals that the LLM should provide an alternative output.
	Attempt int
}

GenerationOptions controls how commit messages should be produced by LLM providers.

type GrokRequest

type GrokRequest struct {
	Messages    []Message `json:"messages"`
	Model       string    `json:"model"`
	Stream      bool      `json:"stream"`
	Temperature float64   `json:"temperature"`
}

GrokRequest represents a chat completion request sent to X.AI's API.

type GrokResponse

type GrokResponse struct {
	Message Message   `json:"message,omitempty"`
	Choices []Choice  `json:"choices,omitempty"`
	Id      string    `json:"id,omitempty"`
	Object  string    `json:"object,omitempty"`
	Created int64     `json:"created,omitempty"`
	Model   string    `json:"model,omitempty"`
	Usage   UsageInfo `json:"usage,omitempty"`
}

GrokResponse contains the relevant fields parsed from X.AI responses.

type LLMProvider added in v1.3.22

type LLMProvider string

LLMProvider identifies the large language model backend used to author commit messages.

const (
	ProviderOpenAI LLMProvider = "OpenAI"
	ProviderClaude LLMProvider = "Claude"
	ProviderGemini LLMProvider = "Gemini"
	ProviderGrok   LLMProvider = "Grok"
	ProviderGroq   LLMProvider = "Groq"
	ProviderOllama LLMProvider = "Ollama"
)

func GetSupportedProviders added in v1.3.22

func GetSupportedProviders() []LLMProvider

GetSupportedProviders returns all available provider enums.

func ParseLLMProvider added in v1.3.22

func ParseLLMProvider(s string) (LLMProvider, bool)

ParseLLMProvider converts a string into an LLMProvider enum when supported.

func (LLMProvider) IsValid added in v1.3.22

func (p LLMProvider) IsValid() bool

IsValid reports whether the provider is part of the supported set.

func (LLMProvider) String added in v1.3.22

func (p LLMProvider) String() string

String returns the provider identifier as a plain string.

type Message

type Message struct {
	Role    string `json:"role"`
	Content string `json:"content"`
}

Message captures the role/content pairs exchanged with Grok.

type RepoConfig

type RepoConfig struct {
	Path    string `json:"path"`
	LastRun string `json:"last_run"`
}

RepoConfig tracks metadata for a configured Git repository.

type UsageInfo

type UsageInfo struct {
	PromptTokens     int `json:"prompt_tokens"`
	CompletionTokens int `json:"completion_tokens"`
	TotalTokens      int `json:"total_tokens"`
}

UsageInfo reports token usage statistics from Grok responses.

Jump to

Keyboard shortcuts

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