FunctionalFlowStep
LLMFlow module for the FunctionalFlowstep
class that can be used to run a given
function within a flow.
FunctionalFlowStep
Bases: BaseFlowStep
Represents a functional flow step that runs a function. The function must take a dictionary of strings as input and return a string(like regular flow steps)
Parameters:
Name | Type | Description | Default |
---|---|---|---|
name |
str
|
The name of the flow step. |
required |
fn |
Callable
|
The function to run. |
required |
required_keys |
list[str]
|
A list of required keys. |
required |
output_key |
str
|
The key to use for the output. |
required |
callbacks |
list[Callback]
|
List of callback instances. Defaults to None. |
None
|
Attributes:
Name | Type | Description |
---|---|---|
required_keys |
set[str]
|
The keys required for the flow step to run. |
fn |
Callable[[dict[str, str]], str]
|
The function to be run. |
Source code in llmflows/flows/functional_flowstep.py
generate(inputs)
Executes the function with the provided inputs.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
inputs |
dict[str, Any]
|
Input parameters as a dictionary. |
required |
Returns:
Type | Description |
---|---|
tuple[Any, Union[dict, None], Union[dict, None]]
|
The result of the function call, followed by two None values (for call data and config, which are not applicable in this case). |