Documentation
¶
Index ¶
- func AccuracyMatch(output, expected any) float64
- func EM(prediction string, answersList []string) float64
- func F1(prediction string, answersList []string) float64
- func F1Score(output, expected interface{}) float64
- func HotPotF1(prediction string, answersList []string) float64
- func NewSemanticF1(ctx context.Context) *semanticF1
- func StringSimilarity(output, expected any) float64
- type Candidate
- type CoproOptimizer
- type CritiqueNOptimizer
- type Evaluator
- type Example
- type Metric
- type OptimizeOption
- type OptimizeOptions
- type OptimizeResult
- type OptimizeStep
- type Optimizer
- type Option
- type Options
- type Strategy
- type TemplateModifier
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func AccuracyMatch ¶
AccuracyMatch checks if outputs exactly match
func F1Score ¶
func F1Score(output, expected interface{}) float64
F1Score calculates F1 score for classification tasks
func HotPotF1 ¶
HotPotF1 calculates the HotPot F1 score between the prediction and the list of answers.
func StringSimilarity ¶
StringSimilarity calculates string similarity using Levenshtein distance
Types ¶
type Candidate ¶
type Candidate struct {
Program program.Program
Score float64
Instruction string
Prefix string
Depth int
}
Candidate represents a candidate for optimization.
type CoproOptimizer ¶
type CoproOptimizer struct {
Breadth int
Depth int
InitTemperature float64
TrackStats bool
// contains filtered or unexported fields
}
CoproOptimizer represents the teleprompter for optimizing signatures.
func NewCoproOptimizer ¶
func NewCoproOptimizer(breadth, depth int, metric Metric) *CoproOptimizer
NewCoproOptimizer creates a new CoproOptimizer.
type CritiqueNOptimizer ¶
type CritiqueNOptimizer struct {
// contains filtered or unexported fields
}
CritiqueNOptimizer defines the CritiqueN optimizer
func NewCritiqueNOptimizer ¶
func NewCritiqueNOptimizer(opts ...Option) *CritiqueNOptimizer
NewCritiqueNOptimizer ...
type Evaluator ¶
type Evaluator struct {
Program string // prompt or agent
Parameters map[string]interface{}
// contains filtered or unexported fields
}
Evaluator ...
func NewEvaluator ¶
NewEvaluator ...
type Example ¶
type Example struct {
// contains filtered or unexported fields
}
Example ...
func (*Example) WithInputKeys ¶
WithInputKeys ...
type OptimizeOption ¶
type OptimizeOption func(options *OptimizeOptions)
OptimizeOption ...
func WithInitialInstruction ¶
func WithInitialInstruction(instruction string) OptimizeOption
WithInitialInstruction ...
type OptimizeOptions ¶
type OptimizeOptions struct {
InitialInstruction string
Description string
Inputs string
Outputs string
}
OptimizeOptions ...
type OptimizeResult ¶
type OptimizeResult struct {
BestProgram program.Program
BestScore float64
History []*OptimizeStep
BestParameters map[string]interface{}
}
OptimizeResult contains the results of optimization
type OptimizeStep ¶
type OptimizeStep struct {
Program program.Program
Score float64
Parameters map[string]interface{}
Timestamp int64
}
OptimizeStep represents a single optimization step
type Optimizer ¶
type Optimizer interface {
// Optimize performs optimization and returns the best result
Optimize(context.Context, any, ...OptimizeOption) (*OptimizeResult, error)
}
Optimizer defines the interface for optimization