A Jido.Action for getting clear explanations of complex topics.
This action uses ReqLLM with specialized system prompts to explain topics at different detail levels (basic, intermediate, advanced).
Parameters
model(optional) - Model alias (e.g.,:reasoning) or direct spectopic(required) - The topic to explaindetail_level(optional) - Detail level::basic,:intermediate,:advancedaudience(optional) - Target audience descriptioninclude_examples(optional) - Whether to include examples (default:true)max_tokens(optional) - Maximum tokens to generate (default:2048)temperature(optional) - Sampling temperature (default:0.5)timeout(optional) - Request timeout in milliseconds
Examples
# Basic explanation
{:ok, result} = Jido.Exec.run(Jido.AI.Actions.Reasoning.Explain, %{
topic: "Recursion",
detail_level: :basic
})
# Advanced explanation
{:ok, result} = Jido.Exec.run(Jido.AI.Actions.Reasoning.Explain, %{
topic: "Tail Call Optimization",
detail_level: :advanced,
audience: "Elixir developers"
})
# Without examples
{:ok, result} = Jido.Exec.run(Jido.AI.Actions.Reasoning.Explain, %{
topic: "Machine Learning",
detail_level: :intermediate,
include_examples: false
})
Summary
Functions
Returns the Action metadata. Alias for to_json/0.
Returns the category of the Action.
Returns the description of the Action.
Returns the name of the Action.
Lifecycle hook called after Action execution.
Lifecycle hook called after output validation.
Lifecycle hook called after parameter validation.
Lifecycle hook called before output validation.
Lifecycle hook called before parameter validation.
Lifecycle hook called when an error occurs.
Returns the output schema of the Action.
Executes the explain action.
Returns the input schema of the Action.
Returns the tags associated with the Action.
Returns the Action metadata as a JSON-serializable map.
Converts the Action to an LLM-compatible tool format.
Validates the output result for the Action.
Validates the input parameters for the Action.
Returns the version of the Action.
Functions
Returns the Action metadata. Alias for to_json/0.
Returns the category of the Action.
Returns the description of the Action.
Returns the name of the Action.
Lifecycle hook called after Action execution.
Lifecycle hook called after output validation.
Lifecycle hook called after parameter validation.
Lifecycle hook called before output validation.
Lifecycle hook called before parameter validation.
Lifecycle hook called when an error occurs.
Returns the output schema of the Action.
Executes the explain action.
Returns
{:ok, result}- Successful response withresult,detail_level,model, andusagekeys{:error, reason}- Error from ReqLLM or validation
Result Format
%{
result: "The explanation text",
detail_level: :intermediate,
model: "anthropic:claude-sonnet-4-20250514",
usage: %{...}
}
Returns the input schema of the Action.
Returns the tags associated with the Action.
Returns the Action metadata as a JSON-serializable map.
Converts the Action to an LLM-compatible tool format.
Validates the output result for the Action.
Examples
iex> defmodule ExampleAction do
...> use Jido.Action,
...> name: "example_action",
...> output_schema: [
...> result: [type: :string, required: true]
...> ]
...> end
...> ExampleAction.validate_output(%{result: "test", extra: "ignored"})
{:ok, %{result: "test", extra: "ignored"}}
iex> ExampleAction.validate_output(%{extra: "ignored"})
{:error, "Invalid output for Action: Required key :result not found"}
Validates the input parameters for the Action.
Examples
iex> defmodule ExampleAction do
...> use Jido.Action,
...> name: "example_action",
...> schema: [
...> input: [type: :string, required: true]
...> ]
...> end
...> ExampleAction.validate_params(%{input: "test"})
{:ok, %{input: "test"}}
iex> ExampleAction.validate_params(%{})
{:error, "Invalid parameters for Action: Required key :input not found"}
Returns the version of the Action.