Jido.Actions.Tool (Jido v1.2.0)
View SourceProvides functionality to convert Jido Execs into tool representations.
This module allows Jido Execs to be easily integrated with AI systems like LangChain or Instructor by converting them into a standardized tool format.
Summary
Functions
Builds a parameters schema for the tool based on the action's schema.
Executes an action and formats the result for tool output.
Converts a NimbleOptions type to a JSON Schema type.
Converts a NimbleOptions parameter definition to a JSON Schema representation.
Converts a Jido Exec into a tool representation.
Types
Functions
Builds a parameters schema for the tool based on the action's schema.
Arguments
schema
- The NimbleOptions schema from the action.
Returns
A map representing the parameters schema in a format compatible with LangChain.
Executes an action and formats the result for tool output.
This function is typically used as the function value in the tool representation.
Converts a NimbleOptions type to a JSON Schema type.
Arguments
type
- The NimbleOptions type.
Returns
A string representing the equivalent JSON Schema type.
Converts a NimbleOptions parameter definition to a JSON Schema representation.
Arguments
opts
- The options for a single parameter from the NimbleOptions schema.
Returns
A map representing the parameter in JSON Schema format.
Converts a Jido Exec into a tool representation.
Arguments
action
- The module implementing the Jido.Action behavior.
Returns
A map representing the action as a tool, compatible with systems like LangChain.
Examples
iex> tool = Jido.Actions.Tool.to_tool(MyExec)
%{
name: "my_action",
description: "Performs a specific task",
function: #Function<...>,
parameters_schema: %{...}
}