Luagents.Tool (luagents v0.2.0)

View Source

Tool definition and execution for the ReAct agent. Tools are functions that the agent can call from Lua code.

Summary

Types

api()

@type api() :: module()

func()

@type func() :: ([any()] -> {:ok, any()} | {:error, any()})

parameter()

@type parameter() :: %{
  name: String.t(),
  type: :string | :number | :boolean | :table,
  description: String.t(),
  required: boolean()
}

t()

@type t() :: %Luagents.Tool{
  api: module() | nil,
  description: String.t(),
  function: func() | nil,
  name: String.t(),
  parameters: [parameter()]
}

Functions

format_for_prompt(tool)

new(name, description, parameters, function_or_api)

@spec new(String.t(), String.t(), [parameter()], func()) :: t()