View Source LangChain.Message.ToolResult (LangChain v0.2.0)

Represents a the result of running a requested tool. The LLM's requests a tool use through a ToolCall. A ToolResult returns the answer or result from the application back to the AI.

Summary

Functions

Build a new ToolResult and return an :ok/:error tuple with the result.

Build a new ToolResult and return it or raise an error if invalid.

Types

@type t() :: %LangChain.Message.ToolResult{
  content: term(),
  display_text: term(),
  is_error: term(),
  name: term(),
  tool_call_id: term(),
  type: term()
}

Functions

@spec new(attrs :: map()) :: {:ok, t()} | {:error, Ecto.Changeset.t()}

Build a new ToolResult and return an :ok/:error tuple with the result.

@spec new!(attrs :: map()) :: t() | no_return()

Build a new ToolResult and return it or raise an error if invalid.