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

reflection

package
v0.2.6 Latest Latest
Warning

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

Go to latest
Published: Oct 26, 2026 License: Apache-2.0 Imports: 7 Imported by: 0

Documentation

Index

Constants

View Source
const (
	VerdictPass = "pass"
	VerdictFail = "fail"
)
View Source
const VerdictTool = "review_verdict"

Variables

This section is empty.

Functions

This section is empty.

Types

type Judge

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

func NewJudge

func NewJudge(caller ModelCaller, base model.ToolCallingChatModel, prompt string) (Judge, error)

func (Judge) Rule

func (j Judge) Rule(ctx context.Context, brief string) (Verdict, error)

type ModelCaller

type ModelCaller interface {
	// usage can be present inside the call itself.
	Call(ctx context.Context, model model.ToolCallingChatModel, msgs []*schema.Message, opts ...model.Option) (*schema.Message, error)
}

type Off

type Off struct{}

Off never reviews and makes no model call. It returns the zero Verdict, which means no review ran.

func (Off) AfterIteration

func (Off) AfterIteration(context.Context, []*schema.Message, []*schema.Message) (Verdict, error)

func (Off) AtFinish

func (Off) AtFinish(context.Context, []*schema.Message, string) (Verdict, error)

type OnFinish

type OnFinish struct {
	Off
	// contains filtered or unexported fields
}

func NewOnFinish

func NewOnFinish(judge Judge) OnFinish

func (OnFinish) AtFinish

func (r OnFinish) AtFinish(ctx context.Context, task []*schema.Message, answer string) (Verdict, error)

type OnIteration

type OnIteration struct {
	Off
	// contains filtered or unexported fields
}

OnIteration judges every iteration against the task. The judge sees the task and only that iteration, written out as text, so it needs none of the run's tools and is not anchored on the whole history.

func NewOnIteration

func NewOnIteration(judge Judge) OnIteration

func (OnIteration) AfterIteration

func (r OnIteration) AfterIteration(ctx context.Context, task, iteration []*schema.Message) (Verdict, error)

type Verdict

type Verdict struct {
	Verdict    string  `json:"verdict"`
	Reason     string  `json:"reason"`
	Hint       string  `json:"hint"`
	Confidence float64 `json:"confidence"`
}

func (Verdict) Failed

func (v Verdict) Failed() bool

Jump to

Keyboard shortcuts

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