finetune

package
v0.0.3 Latest Latest
Warning

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

Go to latest
Published: Sep 27, 2026 License: MIT Imports: 13 Imported by: 0

Documentation

Overview

Package finetune exports completed task I/O pairs as JSONL files suitable for LLM fine-tuning. It supports OpenAI and Anthropic fine-tuning formats, optional quality filtering via pkg/eval, and prompt anonymization.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type ExportConfig

type ExportConfig struct {
	WorkDir    string
	OutputPath string
	Format     Format

	// MinQuality is a 0-100 quality threshold. Pairs scored below this are skipped.
	// Set to 0 to disable quality filtering.
	MinQuality int

	// Anonymize strips absolute file paths and the project directory name from prompts and outputs.
	Anonymize bool

	// Eval provider settings — required when MinQuality > 0.
	EvalProvider provider.Provider
	EvalModel    string
	EvalTimeout  time.Duration
}

ExportConfig holds all parameters for a fine-tune export run.

type ExportResult

type ExportResult struct {
	Total      int     // candidate pairs found
	Exported   int     // pairs written to the JSONL file
	Skipped    int     // pairs skipped (low quality or missing output)
	AvgQuality float64 // average quality score (1-10) of exported pairs; 0 if no scoring
	Tokens     int     // estimated total tokens across all exported pairs
}

ExportResult summarises the outcome of an export run.

func Export

func Export(ctx context.Context, plan *pm.Plan, goal, instructions string, cfg ExportConfig) (*ExportResult, error)

Export scans the completed tasks in the plan, reconstructs each I/O pair, and writes them as JSONL to cfg.OutputPath. It returns a summary.

type Format

type Format string

Format is the JSONL serialization format for fine-tuning data.

const (
	FormatOpenAI    Format = "openai"
	FormatAnthropic Format = "anthropic"
)

Jump to

Keyboard shortcuts

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