FunctionTool#
- class lumen.ai.tools.FunctionTool(function, **params)#
FunctionTool wraps arbitrary functions and makes them available as a tool for an LLM to call. It inspects the arguments of the function and generates a pydantic Model that the LLM will populate.
The function may also consume information in memory, e.g. the current table or pipeline by declaring the requires parameter.
The function may also return context to add to the current working memory by returning a dictionary and declaring the provides parameter. Any keys listed in the provides parameter will be copied into working memory.
Parameters#
type: Any
default: '{function}({arguments}) returned: {output}'
Formats the return value for inclusion in the global context.Accepts the ‘function’, ‘arguments’ and ‘output’ as formatting variables.
type: Any
default: None
The function to call.
Methods#
- async FunctionTool.requirements(messages: list[Message]) list[str] #
- async FunctionTool.respond(messages: list[Message], **kwargs: dict[str, Any]) str #
Responds to the provided messages.