Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
var ErrAdvisorNotConfigured = errors.New("no AI connection is configured for self-healing")
ErrAdvisorNotConfigured is returned when no model connection is set up.
Functions ¶
This section is empty.
Types ¶
type AIOptimizer ¶
type AIOptimizer interface {
// Optimize suggests and applies optimizations for a running engine.
Optimize(ctx context.Context, id string, e *engine.Engine, status telemetry.StatusUpdate) error
}
AIOptimizer defines the interface for AI-driven performance optimization.
type ConnectFunc ¶ added in v1.18.0
ConnectFunc returns the provider and model to use for a workflow, resolving its key for that workflow's vhost.
type CorrectionAction ¶
type CorrectionAction string
CorrectionAction defines the type of fix to apply.
const ( ActionScaleBatch CorrectionAction = "scale_batch" ActionAdjustTimeout CorrectionAction = "adjust_timeout" ActionIncreaseRetry CorrectionAction = "increase_retry" ActionNotifyOperator CorrectionAction = "notify_operator" ActionSafeMode CorrectionAction = "safe_mode" ActionSuggestMapping CorrectionAction = "suggest_mapping" )
type DefaultAIOptimizer ¶
type DefaultAIOptimizer struct {
// contains filtered or unexported fields
}
DefaultAIOptimizer implements AIOptimizer using the SelfHealingService.
func NewAIOptimizer ¶
func NewAIOptimizer(aiSvc *ai.SelfHealingService, logger hermod.Logger) *DefaultAIOptimizer
NewAIOptimizer creates a new DefaultAIOptimizer.
type FailurePattern ¶
FailurePattern represents a detected issue in the pipeline.
type LLMMappingAdvisor ¶ added in v1.18.0
type LLMMappingAdvisor struct {
// contains filtered or unexported fields
}
LLMMappingAdvisor asks a model, through pkg/llm, for a mapping. Every string in the sample is run through the PII masker before it is sent.
func NewLLMMappingAdvisor ¶ added in v1.18.0
func NewLLMMappingAdvisor(connect ConnectFunc) *LLMMappingAdvisor
NewLLMMappingAdvisor builds the advisor.
func (*LLMMappingAdvisor) SuggestMapping ¶ added in v1.18.0
func (a *LLMMappingAdvisor) SuggestMapping(ctx context.Context, workflowID, nodeID string, sample map[string]any) (string, error)
SuggestMapping asks the workflow's model for a mapping from a masked copy of sample.
type MappingAdvisor ¶ added in v1.18.0
type MappingAdvisor interface {
SuggestMapping(ctx context.Context, workflowID, nodeID string, sample map[string]any) (string, error)
}
MappingAdvisor suggests a field mapping for a node whose validation keeps failing, from a sample of what reaches it.
type Optimizer ¶
type Optimizer struct {
// contains filtered or unexported fields
}
Optimizer tracks engine metrics and suggests/applies runtime tunings.
func NewOptimizer ¶
func NewOptimizer(logger hermod.Logger, aiOpt AIOptimizer, notifier func(workflowID, title, message string)) *Optimizer
func (*Optimizer) SetMappingAdvisor ¶ added in v1.18.0
func (o *Optimizer) SetMappingAdvisor(a MappingAdvisor)
SetMappingAdvisor sets who the self-correction gate asks for mappings.
func (*Optimizer) SetProposer ¶ added in v1.18.0
SetProposer sets where the optimizer's self-correction gate sends fixes.
func (*Optimizer) Unregister ¶
type OptimizerConfig ¶
type Proposer ¶ added in v1.18.0
type Proposer interface {
Propose(ctx context.Context, s Suggestion) error
}
Proposer keeps a suggestion for approval.
type SelfCorrectionGate ¶
type SelfCorrectionGate struct {
// contains filtered or unexported fields
}
SelfCorrectionGate watches a workflow's telemetry for failure patterns.
It never changes a running engine or a stored workflow. A fix becomes a Suggestion handed to the Proposer, which keeps it for a person to approve; everything else is advice to the operator.
func NewSelfCorrectionGate ¶
func NewSelfCorrectionGate(logger hermod.Logger, notifier func(workflowID, title, message string)) *SelfCorrectionGate
func (*SelfCorrectionGate) Analyze ¶
func (g *SelfCorrectionGate) Analyze(id string, _ *engine.Engine, status telemetry.StatusUpdate)
func (*SelfCorrectionGate) SetMappingAdvisor ¶ added in v1.18.0
func (g *SelfCorrectionGate) SetMappingAdvisor(a MappingAdvisor)
SetMappingAdvisor sets who is asked for a mapping. Without one no model is called and the operator is only told that validation is failing.
func (*SelfCorrectionGate) SetProposer ¶ added in v1.18.0
func (g *SelfCorrectionGate) SetProposer(p Proposer)
SetProposer sets where suggestions go. Without one they are only announced to the operator.
type Suggestion ¶ added in v1.18.0
type Suggestion struct {
WorkflowID string
NodeID string
Action CorrectionAction
Reason string
}
Suggestion is a fix the gate would make. It is not applied: a Proposer stores it for a person to approve, and only an approval changes the workflow, through the same path as an edit in the editor.