llm

package
v1.0.0 Latest Latest
Warning

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

Go to latest
Published: Apr 18, 2026 License: MIT Imports: 15 Imported by: 0

Documentation

Overview

Package llm implements the LLM port using Ollama as the backend.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Adapter

type Adapter struct {
	// contains filtered or unexported fields
}

Adapter implements ports.LLM via Ollama.

func New

func New(host, model, modelsDir string) *Adapter

New creates a new Ollama adapter.

func (*Adapter) ClearRetryContext

func (o *Adapter) ClearRetryContext()

ClearRetryContext clears the retry context after commit or abort.

func (*Adapter) DecideCommit

func (o *Adapter) DecideCommit(instruction, gitStatus, untracked, modified, deleted string) (domain.CommitIntent, error)

DecideCommit asks the LLM what files to stage based on instruction and git status.

func (*Adapter) DetectSecrets

func (o *Adapter) DetectSecrets(files []string) ([]domain.SecretDetection, error)

DetectSecrets checks files for secrets using regex patterns.

func (*Adapter) EnsureOllama

func (o *Adapter) EnsureOllama() (bool, error)

EnsureOllama starts Ollama if not running. Returns true if started by us.

func (*Adapter) GenerateChangelog

func (o *Adapter) GenerateChangelog(commits, previousChangelog, outputFile string) (string, error)

GenerateChangelog generates changelog from commits and returns it.

func (*Adapter) GenerateChunkMessage

func (o *Adapter) GenerateChunkMessage(chunk domain.DiffChunk) (string, error)

GenerateChunkMessage generates a commit message for a single diff chunk.

func (*Adapter) InterpretGitOp

func (o *Adapter) InterpretGitOp(op, instruction string, context map[string]string) (map[string]string, error)

InterpretGitOp interprets a natural language instruction for a git operation. Returns concrete args as a map (e.g. {"branch": "feat/login"}).

func (*Adapter) InterpretReleaseIntent

func (o *Adapter) InterpretReleaseIntent(instruction, releases, branches, currentBranch string) (*domain.ReleaseIntent, error)

InterpretReleaseIntent interprets user's release intent.

func (*Adapter) IsAvailable

func (o *Adapter) IsAvailable() bool

IsAvailable checks if Ollama is reachable.

func (*Adapter) PolishChangelog

func (o *Adapter) PolishChangelog(chunks []string) (string, error)

PolishChangelog polishes the final changelog from chunks.

func (*Adapter) PreWarm

func (o *Adapter) PreWarm() error

PreWarm loads the model into memory with a minimal request.

func (*Adapter) ResolveModel

func (o *Adapter) ResolveModel() error

ResolveModel checks if the configured model is available; falls back to first available.

func (*Adapter) SetRetryContext

func (o *Adapter) SetRetryContext(previousMessage string)

SetRetryContext stores the previous rejected message for retry flow.

func (*Adapter) Stop

func (o *Adapter) Stop()

Stop leaves Ollama running for next use (no kill on shutdown).

func (*Adapter) VerifySecrets

func (o *Adapter) VerifySecrets(diff string, findings []domain.SecretDetection) (bool, error)

VerifySecrets uses the LLM to verify if regex findings are real secrets.

Jump to

Keyboard shortcuts

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