AI Function Nodes (Focal)
Talemate's AI function-calling layer ("focal"). Define callable functions with typed arguments, hand them to an agent prompt, then unpack the calls the AI made and collect their results. Used by flows like the director chat actions.
7 nodes.
| Node | Registry path |
|---|---|
| AI Function Argument | focal/Argument |
| AI Function Callback | focal/Callback |
| Collect AI Function Call Results | focal/CollectResults |
| AI Function Calling | focal/Focal |
| AI Function Callback Metadata | focal/Metadata |
| Process AI Function Call | focal/ProcessCall |
| Unpack AI Function Call | focal/UnpackCall |
AI Function Argument
focal/Argument
Represents an argument to an AI function.
Extends the function argument with instructions that tell the AI how to fill the argument during AI function calling.
Outputs
| Output | Type | Description |
|---|---|---|
value |
any |
The value of the argument (during function execution) |
Properties
| Property | Type | Default | Description |
|---|---|---|---|
name |
str |
unset |
The name of the argument |
typ |
str |
"str" |
The type of the argument. Choices: str, int, float, bool, list, any. |
instructions |
text |
"" |
The instructions for the argument |
AI Function Callback
focal/Callback
Defines an AI function callback for use with the FOCAL system.
Arguments, instructions and examples are collected from the focal Argument and Metadata nodes inside the supplied function graph.
Inputs
| Input | Type | Description |
|---|---|---|
fn |
function |
The function to call (Returned from an GetFunction node) |
name |
str |
(optional) The name of the callback (optional, overrides the property) |
Outputs
| Output | Type | Description |
|---|---|---|
callback |
focal/callback |
The focal.Callback instance |
Properties
| Property | Type | Default | Description |
|---|---|---|---|
name |
str |
"my_function" |
The name of the callback |
allow_multiple_calls |
bool |
False |
Whether the function can be called multiple times |
allow_concurrent |
bool |
False |
Whether calls to this function can run concurrently (requires client concurrent inference support) |
Collect AI Function Call Results
focal/CollectResults
Collects the results of a list of calls
If a name is provided, only results from calls with that name are collected.
Inputs
| Input | Type | Description |
|---|---|---|
calls |
list |
The list of calls (focal.Call instances) |
name |
str |
Only collect results from calls with this name (optional) |
Outputs
| Output | Type | Description |
|---|---|---|
calls |
list |
The calls input, passed through |
results |
list |
The list of collected call results |
Properties
| Property | Type | Default | Description |
|---|---|---|---|
name |
str |
unset |
The name of the call to collect results from |
AI Function Calling
focal/Focal
Main node for calling AI functions using the FOCAL system.
Either a template or a prompt must be provided.
Inputs
| Input | Type | Description |
|---|---|---|
state |
any |
The current graph state |
template |
str |
(optional) The prompt template name; This template will be used to generate the prompt that facilitates the AI function call(s) |
prompt |
prompt |
(optional) A Prompt instance to use instead of a template |
callbacks |
list |
A list of focal.Callback instances that define the functions to call |
agent |
agent |
The agent to use for the AI function call |
template_vars |
dict |
(optional) A dictionary of variables to use in the template |
max_calls |
int |
(optional) The maximum number of calls to make |
Outputs
| Output | Type | Description |
|---|---|---|
state |
any |
The current graph state |
calls |
list |
The list of calls made (focal.Call instances) |
call_payloads |
list |
The payload dictionaries of the calls made |
response |
str |
The raw response from the processed prompt |
Properties
| Property | Type | Default | Description |
|---|---|---|---|
template |
str |
unset |
The prompt template |
max_calls |
int |
1 |
The maximum number of calls to make. Range: 1 – 10. |
retries |
int |
0 |
The number of retries to make. Range: 0 – 10. |
response_length |
int |
1024 |
The maximum length of the response. Range: 1 – 8192. |
max_concurrent |
int |
3 |
Maximum number of concurrent callback executions. Range: 1 – 10. |
AI Function Callback Metadata
focal/Metadata
Represents metadata within a callback in the focal system.
Allowing to specify instructions and examples for the callback.
The node does no work when executed - it is discovered inside the function graph when an AI function callback is built, and its instructions and examples are attached to the callback.
Inputs
| Input | Type | Description |
|---|---|---|
state |
any |
Connects the node into the function graph so it can be discovered |
Outputs
| Output | Type | Description |
|---|---|---|
state |
any |
Not populated at runtime |
Properties
| Property | Type | Default | Description |
|---|---|---|---|
instructions |
text |
"" |
The instructions for the callback |
examples |
list |
[] |
The examples for the callback |
Process AI Function Call
focal/ProcessCall
Process the AI function call result.
Inputs
| Input | Type | Description |
|---|---|---|
calls |
list |
The list of calls made (focal.Call instances) |
Outputs
| Output | Type | Description |
|---|---|---|
name |
str |
The name of the call |
arguments |
dict |
The arguments of the call |
result |
any |
The result of the call |
uid |
str |
The UID of the call |
called |
bool |
Whether the call was made (if this is False, likely something went wrong) |
Properties
| Property | Type | Default | Description |
|---|---|---|---|
name |
str |
unset |
The name of the call to process |
Unpack AI Function Call
focal/UnpackCall
Unpacks a focal.Call instance
Inputs
| Input | Type | Description |
|---|---|---|
call |
focal/call |
The focal.Call instance to unpack |
Outputs
| Output | Type | Description |
|---|---|---|
name |
str |
The name of the call |
arguments |
dict |
The arguments of the call |
result |
any |
The result of the call |
uid |
str |
The UID of the call |
called |
bool |
Whether the call was made |
error |
str |
The error message if the call failed |