executor

package
v0.0.1 Latest Latest
Warning

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

Go to latest
Published: Jun 1, 2025 License: MIT Imports: 9 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func GetTypedArg

func GetTypedArg[T any](p *ExecutorParams, argName string) (T, error)

func GetTypedResult

func GetTypedResult[T any](res *ExecutorResult, argName string) (T, bool)

Types

type ErrArgMissing

type ErrArgMissing struct {
	ArgName string
}

func (ErrArgMissing) Error

func (e ErrArgMissing) Error() string

type ErrInvalidArgumentType

type ErrInvalidArgumentType struct {
	Name     string
	Expected string
	Received string
}

func (ErrInvalidArgumentType) Error

func (e ErrInvalidArgumentType) Error() string

type ErrInvalidParams

type ErrInvalidParams struct {
	ExecutorName  string
	MissingParams []string
}

func (ErrInvalidParams) Error

func (e ErrInvalidParams) Error() string

type ErrOperatorNotFound

type ErrOperatorNotFound struct {
	ExecutorName string
	OperatorName string
}

func (ErrOperatorNotFound) Error

func (e ErrOperatorNotFound) Error() string

type Executor

type Executor interface {
	Execute(ctx context.Context, params *ExecutorParams) *ExecutorResult
}

type ExecutorParamOption

type ExecutorParamOption func(*ExecutorParams)

func WithArgs

func WithArgs(args map[string]any) ExecutorParamOption

func WithOperator

func WithOperator(op string) ExecutorParamOption

func WithVectorStore

func WithVectorStore(vs vector.Store) ExecutorParamOption

type ExecutorParams

type ExecutorParams struct {
	Operator    string
	Transport   transport.Transport
	VectorStore vector.Store
	Args        map[string]any

	Children []*WorkflowNode
	Routes   []*WorkflowRoute
	Branches []*WorkflowBranch
	// contains filtered or unexported fields
}

func MakeNodeParams

func MakeNodeParams(node *WorkflowNode, sourceParams *ExecutorParams) *ExecutorParams

func NewExecutorParams

func NewExecutorParams(id string, query string, options ...ExecutorParamOption) *ExecutorParams

func ProcessResult

func ProcessResult(params *ExecutorParams, result *ExecutorResult) *ExecutorParams

func (ExecutorParams) Copy

func (p ExecutorParams) Copy() *ExecutorParams

Copy creates a copy of the ExecutorParams object The returned copy excludes the following fields:

Children, Routes, Branches

func (ExecutorParams) GetArg

func (p ExecutorParams) GetArg(argName string) (any, error)

func (ExecutorParams) GetQuery

func (p ExecutorParams) GetQuery() string

func (ExecutorParams) GetTaskID

func (p ExecutorParams) GetTaskID() string

func (*ExecutorParams) SetBranches

func (p *ExecutorParams) SetBranches(branches []*WorkflowBranch)

func (*ExecutorParams) SetChildren

func (p *ExecutorParams) SetChildren(children []*WorkflowNode)

func (*ExecutorParams) SetQuery

func (p *ExecutorParams) SetQuery(q string)

func (*ExecutorParams) SetRoutes

func (p *ExecutorParams) SetRoutes(routes []*WorkflowRoute)

func (ExecutorParams) WithQuery

func (p ExecutorParams) WithQuery(q string) *ExecutorParams

type ExecutorResult

type ExecutorResult struct {
	Name     string
	Operator string
	Err      error
	Values   map[string]any
}

func (*ExecutorResult) Get

func (res *ExecutorResult) Get(valueName string) (any, bool)

type Workflow

type Workflow struct {
	// contains filtered or unexported fields
}

func NewWorkflow

func NewWorkflow(
	identifier string,
	description string,
	collectionName string,
	search bool,
	nodes []*WorkflowNode,
) *Workflow

func (Workflow) Execute

func (w Workflow) Execute(ctx context.Context, params *ExecutorParams) *ExecutorResult

type WorkflowBranch

type WorkflowBranch struct {
	Name  string
	Nodes []*WorkflowNode
}

type WorkflowNode

type WorkflowNode struct {
	Executor Executor
	Operator string
	NodeType string
	Args     map[string]any

	Children []*WorkflowNode
	Routes   []*WorkflowRoute
	Branches []*WorkflowBranch
}

func NewWorkflowNode

func NewWorkflowNode(executor Executor, operator string, nodeType string) *WorkflowNode

func (WorkflowNode) Execute

func (n WorkflowNode) Execute(ctx context.Context, params *ExecutorParams) *ExecutorResult

type WorkflowRoute

type WorkflowRoute struct {
	Key         string
	Description string
	Nodes       []*WorkflowNode
}

Jump to

Keyboard shortcuts

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