training

package
v0.9.0 Latest Latest
Warning

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

Go to latest
Published: Jul 22, 2026 License: MIT Imports: 6 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Consolidate

func Consolidate(feedbacks []Feedback, maxItems int) string

Consolidate filters feedbacks with Rating < 0, deduplicates by exact Comment match, and returns a human-readable string of up to maxItems advice lines. Returns empty string if no negative feedbacks or maxItems <= 0.

func LoadAdvice

func LoadAdvice(dir, agentRole string) (string, error)

LoadAdvice loads the consolidated advice for an agent role from the training directory. Returns empty string if the file does not exist or is empty.

func WriteAdvice

func WriteAdvice(dir, agentRole, advice string) error

WriteAdvice writes the consolidated advice for an agent role to the training directory.

Types

type Feedback

type Feedback struct {
	Iteration int
	AgentRole string
	Rating    int
	Comment   string
}

Feedback stores a single human feedback entry for one training iteration.

type FileStore

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

FileStore implements Store on the local filesystem. Layout:

<dir>/<lowercase(agentRole)>.json          — raw feedback entries
<dir>/<lowercase(agentRole)>_advice.json   — consolidated advice (written by Crew.Train)

func NewFileStore

func NewFileStore(dir string) *FileStore

NewFileStore creates a FileStore rooted at dir. The directory is created on first write if it does not exist.

func (*FileStore) List

func (fs *FileStore) List() ([]string, error)

List returns all agent roles that have stored feedback data.

func (*FileStore) Load

func (fs *FileStore) Load(agentRole string) ([]Feedback, error)

Load retrieves all stored feedback entries for a given agent role.

func (*FileStore) Save

func (fs *FileStore) Save(agentRole string, feedbacks []Feedback) error

Save persists feedback entries for a given agent role as JSON.

type Store

type Store interface {
	Save(agentRole string, feedbacks []Feedback) error
	Load(agentRole string) ([]Feedback, error)
	List() ([]string, error)
}

Store persists per-agent training feedback data.

Jump to

Keyboard shortcuts

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