Documentation
¶
Overview ¶
Package pipeline provides a flexible framework for composing and executing sequences of operations (Steps) for LLM workflows like RAG and data processing.
Index ¶
Constants ¶
This section is empty.
Variables ¶
View Source
var ( ErrBreak = errors.New("pipeline loop break") ErrReturn = errors.New("pipeline execution return") )
定义控制流哨兵错误
Functions ¶
This section is empty.
Types ¶
type BreakStep ¶ added in v0.1.8
BreakStep 跳出当前 Loop。
type Hook ¶
type Hook[T any] interface { // OnStepStart is called before a step executes. OnStepStart(ctx context.Context, step Step[T], state T) // OnStepError is called if a step returns an error. OnStepError(ctx context.Context, step Step[T], state T, err error) // OnStepComplete is called after a step successfully executes. OnStepComplete(ctx context.Context, step Step[T], state T) }
Hook allows observing pipeline execution.
type IfStep ¶ added in v0.1.8
type IfStep[T any] struct { StepName string Condition func(ctx context.Context, state T) bool Then Step[T] Else Step[T] }
IfStep 提供管线中的条件分支逻辑。
type LoopStep ¶ added in v0.1.8
type LoopStep[T any] struct { StepName string Condition func(context.Context, T) bool Body Step[T] MaxLoops int }
LoopStep 提供管线中的重复执行逻辑,支持 ErrBreak。
type Pipeline ¶
type Pipeline[T any] struct { // contains filtered or unexported fields }
Pipeline manages a sequence of steps.
type ReturnStep ¶ added in v0.1.8
ReturnStep 终止整个 Pipeline 执行。
func (*ReturnStep[T]) Execute ¶ added in v0.1.8
func (s *ReturnStep[T]) Execute(ctx context.Context, state T) error
func (*ReturnStep[T]) Name ¶ added in v0.1.8
func (s *ReturnStep[T]) Name() string
type State ¶
type State struct {
// contains filtered or unexported fields
}
State is a thread-safe container for data passed between pipeline steps.
func (*State) Get ¶
Get retrieves a value from the state. Returns nil and false if the key does not exist.
Click to show internal directories.
Click to hide internal directories.