Normalizes tool call and tool result data for generated chat UIs.
mix ash_ai.gen.chat templates delegate to extract/1 so the generated modules
stay small and the parsing behavior is centralized in AshAi.
Advanced apps can override the generated delegation seam:
@chat_ui_tools MyApp.ChatUITools
Summary
Functions
A tool result's content in a form to store as JSON and show to people, such
as in a message's tool_results.
Types
Functions
@spec extract(map() | struct()) :: {:ok, extracted_tool_data()} | {:error, Ash.Error.t()}
A tool result's content in a form to store as JSON and show to people, such
as in a message's tool_results.
Content parts become text, with images and other non-text parts described
rather than carrying their data, and a list that is all text is joined.
Other content is returned as it is. Store the result's exact content,
images included, with AshAi.Transcript.to_parts/2.