MCPcopy Create free account

hub / github.com/The-Pocket/PocketFlow-Go / functions

Functions78 in github.com/The-Pocket/PocketFlow-Go

↓ 19 callersFunctionnewPocketFlowError
(msg string, cause error)
pocketflow.go:62
↓ 10 callersMethodinitCore
()
pocketflow.go:117
↓ 8 callersMethodNext
Next connects this node to another node for a specific action. Returns the *next* node for chaining.
pocketflow.go:93
↓ 8 callersMethodValue
(key any)
pocketflow.go:15
↓ 7 callersMethodSetExec
SetExec sets the ExecFunc.
pocketflow.go:235
↓ 6 callersFunctionlogWarn
(format string, v ...any)
pocketflow.go:66
↓ 5 callersMethodSetParams
SetParams sets node-specific parameters. Returns the node for chaining.
pocketflow.go:87
↓ 5 callersMethodSetValue
(key any, value any)
pocketflow.go:25
↓ 4 callersMethodGetParams
GetParams returns the node's current parameters.
pocketflow.go:90
↓ 4 callersMethodRun
Run executes a single node's lifecycle (prep, exec, post). Useful for standalone execution. Returns the resulting action and error.
pocketflow.go:103
↓ 4 callersMethodSetPost
SetPost sets the PostFunc.
pocketflow.go:241
↓ 4 callersMethodSetRetry
SetRetry configures retry behaviour.
pocketflow.go:216
↓ 3 callersMethodSetPrep
SetPrep sets the PrepFunc.
pocketflow.go:229
↓ 3 callersFunctionresultCaptureNode
resultCaptureNode creates a node that captures the context value into its own params.
pocketflow_test.go:65
↓ 2 callersMethodRun
Run starts the flow execution.
pocketflow.go:621
↓ 2 callersFunctionaddNumberNode
addNumberNode creates a node that adds a number based on context.
pocketflow_test.go:41
↓ 2 callersMethodorchestrate
orchestrate executes the node chain starting from startNode. initialParams are merged with the flow's own params for the *first* node. Returns the las
pocketflow.go:654
↓ 2 callersFunctionsetNumberNode
--- Test Node Implementations using Functional Style --- setNumberNode creates a node that sets a number in the context.
pocketflow_test.go:20
↓ 1 callersMethodError
()
pocketflow.go:49
↓ 1 callersMethodExec
(ctx *PfContext, prepResult any)
pocketflow.go:270
↓ 1 callersMethodExec
Exec iterates through the prepResult slice, calling ExecItemFunc for each item with retries.
pocketflow.go:433
↓ 1 callersMethodExec
Exec for the Flow initiates the orchestration. Should not be called directly by user.
pocketflow.go:595
↓ 1 callersMethodGetNextNode
GetNextNode retrieves the successor node for a given action (or DefaultAction).
pocketflow.go:99
↓ 1 callersMethodInternalRun
InternalRun is used by Flow orchestration to execute the node lifecycle. Separated from Run to prevent potential issues if Run is overridden incorrect
pocketflow.go:107
↓ 1 callersMethodInternalRun
(ctx *PfContext)
pocketflow.go:296
↓ 1 callersMethodInternalRun
InternalRun implements the retry logic at the item level within Exec.
pocketflow.go:526
↓ 1 callersMethodInternalRun
InternalRun executes the flow's lifecycle: Prep, Orchestrate (via Exec), Post.
pocketflow.go:627
↓ 1 callersMethodInternalRun
InternalRun executes the BatchFlow lifecycle: PrepBatch, Exec(orchestrate per batch), PostBatch.
pocketflow.go:822
↓ 1 callersMethodPost
(ctx *PfContext, prepResult any, execResult any)
pocketflow.go:278
↓ 1 callersMethodPost
Post calls the user-defined PostFunc.
pocketflow.go:489
↓ 1 callersMethodPost
Post for the Flow runs after orchestration completes. Default returns the final action.
pocketflow.go:611
↓ 1 callersMethodPost
Post for BatchFlow runs its PostBatchFunc.
pocketflow.go:792
↓ 1 callersMethodPrep
(ctx *PfContext)
pocketflow.go:263
↓ 1 callersMethodPrep
Prep calls the user-defined PrepFunc.
pocketflow.go:424
↓ 1 callersMethodPrep
Prep for the Flow itself. Default is no-op. Can be overridden if needed.
pocketflow.go:589
↓ 1 callersMethodPrep
--- BaseNode Implementation Overrides for BatchFlow --- Prep for BatchFlow runs its PrepBatchFunc.
pocketflow.go:753
↓ 1 callersMethodRun
Run starts the BatchFlow execution.
pocketflow.go:816
↓ 1 callersMethodSetExecItem
SetExecItem sets the ExecItemFunc for processing individual items.
pocketflow.go:395
↓ 1 callersMethodSetFallback
SetFallback sets the ExecFallbackFunc.
pocketflow.go:247
↓ 1 callersMethodSetItemFallback
SetItemFallback sets the ExecItemFallbackFunc.
pocketflow.go:407
↓ 1 callersMethodSetParams
--- BaseNode Implementation for Flow --- Most BaseNode methods are less relevant for Flow itself, focused on orchestration.
pocketflow.go:577
↓ 1 callersMethodSetPostBatch
SetPostBatch sets the function to run after all batches complete.
pocketflow.go:745
↓ 1 callersMethodSetPrepBatch
SetPrepBatch sets the function to generate batch parameters.
pocketflow.go:739
↓ 1 callersFunctionsimpleLogNode
simpleLogNode creates a node for BatchFlow testing.
pocketflow_test.go:91
MethodExec
Exec performs the main work using the result from Prep. Returns the execution result (can be nil) and an error.
pocketflow.go:80
MethodExec
Exec for BatchFlow runs the orchestration for each batch item. The 'prepResult' here is the []*pfContext from BatchFlow.Prep.
pocketflow.go:763
MethodGetNextNode
(action string)
pocketflow.go:166
MethodGetParams
()
pocketflow.go:140
MethodGetSuccessors
GetSuccessors returns the map of action->node successors.
pocketflow.go:96
MethodGetSuccessors
()
pocketflow.go:161
FunctionNewBatchFlow
NewBatchFlow creates a new BatchFlow.
pocketflow.go:722
FunctionNewBatchNode
NewBatchNode creates a new BatchNode with default settings.
pocketflow.go:361
FunctionNewFlow
NewFlow creates a new Flow, optionally with a starting node.
pocketflow.go:557
FunctionNewNode
NewNode creates a new Node with default retry settings (1 try, 0 wait).
pocketflow.go:200
MethodNext
(action string, node BaseNode)
pocketflow.go:146
MethodNext
(action string, node BaseNode)
pocketflow.go:259
MethodNext
(action string, node BaseNode)
pocketflow.go:419
MethodNext
Next for a Flow doesn't make logical sense in the standard execution model.
pocketflow.go:583
MethodPost
Post processes results, updates context, and returns the next action string. An empty string implies DefaultAction. Returns an error if post-processin
pocketflow.go:84
MethodPrep
Prep prepares input for Exec using the shared context. Returns the prepared data (can be nil) and an error.
pocketflow.go:76
MethodRun
(ctx *PfContext)
pocketflow.go:289
MethodRun
(ctx *PfContext)
pocketflow.go:518
MethodSetParams
(params map[string]any)
pocketflow.go:126
MethodSetParams
--- BaseNode Implementation for Node ---
pocketflow.go:254
MethodSetParams
--- BaseNode Implementation for BatchNode ---
pocketflow.go:414
MethodSetPost
SetPost sets the PostFunc. Receives []any prep and []any exec results.
pocketflow.go:401
MethodSetPrep
SetPrep sets the PrepFunc. Expects a function returning []any.
pocketflow.go:389
MethodSetRetry
SetRetry configures retry behaviour.
pocketflow.go:376
MethodStart
Start sets the initial node for the flow. Returns the start node for chaining setup.
pocketflow.go:566
FunctionTestBatchFlowExecution
(t *testing.T)
pocketflow_test.go:174
FunctionTestBatchNodeItemRetryAndFallback
(t *testing.T)
pocketflow_test.go:265
FunctionTestBranchingFlow
(t *testing.T)
pocketflow_test.go:134
FunctionTestNodeRetryFailureWithFallback
(t *testing.T)
pocketflow_test.go:224
FunctionTestNodeRetryFailureWithoutFallback
(t *testing.T)
pocketflow_test.go:247
FunctionTestNodeRetrySuccess
--- Additional Tests ---
pocketflow_test.go:206
FunctionTestSimpleLinearFlow
--- Test Methods ---
pocketflow_test.go:110
MethodUnwrap
Unwrap allows PocketFlowError to work with errors.Is and errors.As.
pocketflow.go:58
FunctionWithParam
(parent context.Context, param map[any]any)
pocketflow.go:32