steps

package
v1.4.6 Latest Latest
Warning

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

Go to latest
Published: Mar 3, 2026 License: MIT Imports: 8 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type AgentStep

type AgentStep struct {
	Agent core.AgentExecutor
	// contains filtered or unexported fields
}

AgentStep 通过 AgentExecutor 抽象执行 agent。

func NewAgentStep

func NewAgentStep(id string, agent core.AgentExecutor) *AgentStep

NewAgentStep 创建 agent 步骤。

func (*AgentStep) Execute

func (s *AgentStep) Execute(ctx context.Context, input core.StepInput) (core.StepOutput, error)

func (*AgentStep) ID

func (s *AgentStep) ID() string

func (*AgentStep) Type

func (s *AgentStep) Type() core.StepType

func (*AgentStep) Validate

func (s *AgentStep) Validate() error

type CodeHandler

type CodeHandler func(ctx context.Context, input core.StepInput) (map[string]any, error)

CodeHandler CodeStep 执行函数签名。

type CodeStep

type CodeStep struct {
	Handler CodeHandler
	// contains filtered or unexported fields
}

CodeStep 执行自定义代码逻辑。

func NewCodeStep

func NewCodeStep(id string, handler CodeHandler) *CodeStep

NewCodeStep 创建代码步骤。

func (*CodeStep) Execute

func (s *CodeStep) Execute(ctx context.Context, input core.StepInput) (core.StepOutput, error)

func (*CodeStep) ID

func (s *CodeStep) ID() string

func (*CodeStep) Type

func (s *CodeStep) Type() core.StepType

func (*CodeStep) Validate

func (s *CodeStep) Validate() error

type HumanStep

type HumanStep struct {
	Prompt    string
	InputType string
	Options   []string
	Timeout   time.Duration
	Handler   core.HumanInputHandler
	// contains filtered or unexported fields
}

HumanStep 通过 HumanInputHandler 请求人工输入。

func NewHumanStep

func NewHumanStep(id string, handler core.HumanInputHandler) *HumanStep

NewHumanStep 创建人工步骤。

func (*HumanStep) Execute

func (s *HumanStep) Execute(ctx context.Context, input core.StepInput) (core.StepOutput, error)

func (*HumanStep) ID

func (s *HumanStep) ID() string

func (*HumanStep) Type

func (s *HumanStep) Type() core.StepType

func (*HumanStep) Validate

func (s *HumanStep) Validate() error

type HybridRetrieveStep

type HybridRetrieveStep struct {
	Query     string
	Retriever HybridRetriever
	// contains filtered or unexported fields
}

HybridRetrieveStep executes a hybrid retrieval node in DAG.

func NewHybridRetrieveStep

func NewHybridRetrieveStep(id string, retriever HybridRetriever) *HybridRetrieveStep

func (*HybridRetrieveStep) Execute

func (*HybridRetrieveStep) ID

func (s *HybridRetrieveStep) ID() string

func (*HybridRetrieveStep) Type

func (s *HybridRetrieveStep) Type() core.StepType

func (*HybridRetrieveStep) Validate

func (s *HybridRetrieveStep) Validate() error

type HybridRetriever

type HybridRetriever interface {
	Retrieve(ctx context.Context, query string, queryEmbedding []float64) ([]rag.RetrievalResult, error)
}

HybridRetriever abstracts hybrid retrieval execution.

type LLMStep

type LLMStep struct {
	Model       string
	Prompt      string
	Temperature float64
	MaxTokens   int
	Gateway     core.GatewayLike
	// contains filtered or unexported fields
}

LLMStep 通过 GatewayLike 抽象调用 LLM。

func NewLLMStep

func NewLLMStep(id string, gateway core.GatewayLike) *LLMStep

NewLLMStep 创建 LLM 步骤。

func (*LLMStep) Execute

func (s *LLMStep) Execute(ctx context.Context, input core.StepInput) (core.StepOutput, error)

func (*LLMStep) ID

func (s *LLMStep) ID() string

func (*LLMStep) Type

func (s *LLMStep) Type() core.StepType

func (*LLMStep) Validate

func (s *LLMStep) Validate() error

type MultiHopReasoner

type MultiHopReasoner interface {
	Reason(ctx context.Context, query string) (*rag.ReasoningChain, error)
}

MultiHopReasoner abstracts multi-hop retrieval reasoning.

type MultiHopRetrieveStep

type MultiHopRetrieveStep struct {
	Query    string
	Reasoner MultiHopReasoner
	// contains filtered or unexported fields
}

MultiHopRetrieveStep executes multi-hop retrieval and flattens hop results.

func NewMultiHopRetrieveStep

func NewMultiHopRetrieveStep(id string, reasoner MultiHopReasoner) *MultiHopRetrieveStep

func (*MultiHopRetrieveStep) Execute

func (*MultiHopRetrieveStep) ID

func (s *MultiHopRetrieveStep) ID() string

func (*MultiHopRetrieveStep) Type

func (*MultiHopRetrieveStep) Validate

func (s *MultiHopRetrieveStep) Validate() error

type RerankStep

type RerankStep struct {
	Query    string
	Reranker RetrievalReranker
	// contains filtered or unexported fields
}

RerankStep re-orders retrieval results in DAG.

func NewRerankStep

func NewRerankStep(id string, reranker RetrievalReranker) *RerankStep

func (*RerankStep) Execute

func (s *RerankStep) Execute(ctx context.Context, input core.StepInput) (core.StepOutput, error)

func (*RerankStep) ID

func (s *RerankStep) ID() string

func (*RerankStep) Type

func (s *RerankStep) Type() core.StepType

func (*RerankStep) Validate

func (s *RerankStep) Validate() error

type RetrievalReranker

type RetrievalReranker interface {
	Rerank(ctx context.Context, query string, results []rag.RetrievalResult) ([]rag.RetrievalResult, error)
}

RetrievalReranker abstracts retrieval rerank behavior.

type ToolStep

type ToolStep struct {
	ToolName string
	Params   map[string]any
	Registry core.ToolRegistry
	// contains filtered or unexported fields
}

ToolStep 通过 ToolRegistry 执行工具调用。

func NewToolStep

func NewToolStep(id string, toolName string, registry core.ToolRegistry) *ToolStep

NewToolStep 创建工具步骤。

func (*ToolStep) Execute

func (s *ToolStep) Execute(ctx context.Context, input core.StepInput) (core.StepOutput, error)

func (*ToolStep) ID

func (s *ToolStep) ID() string

func (*ToolStep) Type

func (s *ToolStep) Type() core.StepType

func (*ToolStep) Validate

func (s *ToolStep) Validate() error

Jump to

Keyboard shortcuts

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