Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func GenerateMethodName ¶
GenerateMethodName converts a goal UID to a valid Go method name
Types ¶
type Config ¶
type Config struct {
Goals []ConfigGoal `json:"goals" yaml:"goals"`
Prompts []ConfigPrompt `json:"prompts" yaml:"prompts"`
GenerateOptions *ConfigGenerateOptions `json:"generateOptions,omitempty" yaml:"generateOptions,omitempty"`
}
Config represents the structure of llmango.yaml/json files
type ConfigGenerateOptions ¶
type ConfigGenerateOptions struct {
RawGoalFunctions []string `json:"rawGoalFunctions,omitempty" yaml:"rawGoalFunctions,omitempty"`
}
ConfigGenerateOptions represents generation options in config
type ConfigGoal ¶
type ConfigGoal struct {
UID string `json:"uid" yaml:"uid"`
Title string `json:"title" yaml:"title"`
Description string `json:"description" yaml:"description"`
InputType string `json:"input_type" yaml:"input_type"`
OutputType string `json:"output_type" yaml:"output_type"`
InputExample interface{} `json:"input_example,omitempty" yaml:"input_example,omitempty"`
OutputExample interface{} `json:"output_example,omitempty" yaml:"output_example,omitempty"`
}
ConfigGoal represents a goal defined in configuration
type ConfigPrompt ¶
type ConfigPrompt struct {
UID string `json:"uid" yaml:"uid"`
GoalUID string `json:"goal_uid" yaml:"goal_uid"`
Model string `json:"model" yaml:"model"`
Parameters openrouter.Parameters `json:"parameters,omitempty" yaml:"parameters,omitempty"`
Messages []openrouter.Message `json:"messages" yaml:"messages"`
Weight int `json:"weight,omitempty" yaml:"weight,omitempty"`
IsCanary bool `json:"is_canary,omitempty" yaml:"is_canary,omitempty"`
MaxRuns int `json:"max_runs,omitempty" yaml:"max_runs,omitempty"`
}
ConfigPrompt represents a prompt defined in configuration
type DiscoveredGoal ¶
type DiscoveredGoal struct {
UID string `json:"uid" yaml:"uid"`
Title string `json:"title" yaml:"title"`
Description string `json:"description" yaml:"description"`
InputType string `json:"input_type" yaml:"input_type"`
OutputType string `json:"output_type" yaml:"output_type"`
InputExampleJSON string `json:"input_example_json,omitempty" yaml:"input_example_json,omitempty"`
OutputExampleJSON string `json:"output_example_json,omitempty" yaml:"output_example_json,omitempty"`
SourceFile string `json:"source_file" yaml:"source_file"`
SourceType string `json:"source_type" yaml:"source_type"` // "go" or "config"
VarName string `json:"var_name" yaml:"var_name"` // Variable name in Go code
IsPointer bool `json:"is_pointer" yaml:"is_pointer"` // Whether this goal variable is a pointer
}
DiscoveredGoal represents a goal found during parsing
type DiscoveredPrompt ¶
type DiscoveredPrompt struct {
UID string `json:"uid" yaml:"uid"`
GoalUID string `json:"goal_uid" yaml:"goal_uid"`
Model string `json:"model" yaml:"model"`
Parameters openrouter.Parameters `json:"parameters" yaml:"parameters"`
Messages []openrouter.Message `json:"messages" yaml:"messages"`
Weight int `json:"weight" yaml:"weight"`
IsCanary bool `json:"is_canary" yaml:"is_canary"`
MaxRuns int `json:"max_runs" yaml:"max_runs"`
SourceFile string `json:"source_file" yaml:"source_file"`
SourceType string `json:"source_type" yaml:"source_type"` // "go" or "config"
VarName string `json:"var_name" yaml:"var_name"` // Variable name in Go code
}
DiscoveredPrompt represents a prompt found during parsing
type GenerateOptions ¶
type GenerateOptions struct {
InputDir string
OutputFile string
ConfigFile string
PackageName string
GoSourceDir string
Validate bool
}
GenerateOptions contains options for code generation
type ParseError ¶
type ParseError struct {
File string `json:"file" yaml:"file"`
Line int `json:"line,omitempty" yaml:"line,omitempty"`
Column int `json:"column,omitempty" yaml:"column,omitempty"`
Message string `json:"message" yaml:"message"`
Type string `json:"type" yaml:"type"` // "warning" or "error"
}
ParseError represents an error encountered during parsing
type ParseResult ¶
type ParseResult struct {
Goals []DiscoveredGoal `json:"goals" yaml:"goals"`
Prompts []DiscoveredPrompt `json:"prompts" yaml:"prompts"`
Errors []ParseError `json:"errors,omitempty" yaml:"errors,omitempty"`
RawGoalFunctions map[string]bool `json:"raw_goal_functions,omitempty" yaml:"raw_goal_functions,omitempty"`
}
ParseResult contains all discovered goals and prompts
func MergeResults ¶
func MergeResults(goResult, configResult *ParseResult) *ParseResult
MergeResults combines results from Go files and config files, handling conflicts
func ParseConfigFiles ¶
func ParseConfigFiles(dir string) (*ParseResult, error)
ParseConfigFiles scans for and parses llmango configuration files
func ParseGoFiles ¶
func ParseGoFiles(dir string) (*ParseResult, error)
ParseGoFiles scans Go files in the given directory and extracts goal and prompt definitions
func ParseGoFilesWithExclusions ¶
func ParseGoFilesWithExclusions(dir string, excludeFiles []string) (*ParseResult, error)
ParseGoFilesWithExclusions scans Go files in the given directory and extracts goal and prompt definitions, excluding files that match the provided exclusion patterns