Tool#

class lumen.ai.tools.Tool(*, llm, memory, prompts, template_overrides, purpose, name)#

A Tool can be invoked by another Actor to provide additional context or respond to a question. Unlike an Agent they never interact with or on behalf of a user directly.


Parameters#

llm

type: lumen.ai.llm.Llm
default: None
The LLM implementation to query.

memory

type: lumen.ai.memory._Memory
default: None
Local memory which will be used to provide the agent context.If None the global memory will be used.

name

type: str
default: 'Tool'
String identifier for this object.

prompts

type: dict
default: {}
A dictionary of prompts used by the actor, indexed by prompt name.Each prompt should be defined as a dictionary containing a template’template’ and optionally a ‘model’ and ‘tools’.

provides

type: list
default: []
List of context values it provides to current working memory.

purpose

type: str
default: ''
Describes the purpose of this actor for consumption ofother actors that might invoke it.

requires

type: list
default: []
List of context values it requires to be in memory.

template_overrides

type: dict
default: {}
Overrides the template’s ‘instructions’, ‘context’, ‘tools’, or ‘examples’ jinja2 blocks.Is a nested dictionary with the prompt name (e.g. main) as the keyand the block names as the inner keys with the new content as thevalues.


Methods#

async Tool.requirements(messages: list[Message]) list[str]#
abstract async Tool.respond(messages: list[Message], **kwargs: dict[str, Any]) Any#

Responds to the provided messages.

Types#

Tool

A Tool can be invoked by another Actor to provide additional

Tool.html
FunctionTool

FunctionTool wraps arbitrary functions and makes them available as a tool

FunctionTool.html
DocumentLookup

The DocumentLookup tool creates a vector store of all available documents

DocumentLookup.html
TableLookup

The TableLookup tool creates a vector store of all available tables

TableLookup.html