Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
View Source
var ( ErrStepNotConfigured = errors.New("step dependency not configured") ErrStepValidation = errors.New("step validation failed") ErrStepExecution = errors.New("step execution failed") ErrStepTimeout = errors.New("step execution timed out") )
统一步骤错误。
Functions ¶
This section is empty.
Types ¶
type AgentExecutor ¶
AgentExecutor workflow 侧最小 agent 执行抽象。
type GatewayLike ¶
type GatewayLike interface {
Invoke(ctx context.Context, req *LLMRequest) (*LLMResponse, error)
}
GatewayLike 是 LLM Gateway 的抽象接口。 workflow 层通过此接口调用 LLM,不直接依赖 llm.Provider。
type HumanInputHandler ¶
type HumanInputHandler interface {
RequestInput(ctx context.Context, prompt string, inputType string, options []string) (any, error)
}
HumanInputHandler 人工输入处理器抽象。
type LLMRequest ¶
type LLMRequest struct {
Model string
Prompt string
Temperature float64
MaxTokens int
Metadata map[string]string
}
LLMRequest 是 workflow 层面的 LLM 请求。
type LLMResponse ¶
LLMResponse 是 workflow 层面的 LLM 响应。
type StepInput ¶
type StepInput struct {
Data map[string]any // 上游步骤输出 / 用户输入
Metadata map[string]string // trace_id/run_id/node_id 等
}
StepInput 步骤输入。
type StepOutput ¶
type StepOutput struct {
Data map[string]any // 输出数据
Usage *types.TokenUsage // 可选,LLM 步骤填充
Latency time.Duration
}
StepOutput 步骤输出。
type StepProtocol ¶
type StepProtocol interface {
// ID 返回步骤唯一标识。
ID() string
// Type 返回步骤类型。
Type() StepType
// Execute 执行步骤。
Execute(ctx context.Context, input StepInput) (StepOutput, error)
// Validate 校验步骤配置是否合法。
Validate() error
}
StepProtocol 统一步骤协议(Command Pattern)。 所有步骤类型必须实现此接口。
type StepType ¶
type StepType string
StepType 步骤类型枚举。
const ( StepTypeLLM StepType = "llm" StepTypeTool StepType = "tool" StepTypeHuman StepType = "human" StepTypeCode StepType = "code" StepTypeAgent StepType = "agent" StepTypeHybridRetrieve StepType = "hybrid_retrieve" StepTypeMultiHopRetrieve StepType = "multi_hop_retrieve" StepTypeRerank StepType = "rerank" )
Click to show internal directories.
Click to hide internal directories.