ExAthena.ToolCalls.Native (ExAthena v0.3.1)

Copy Markdown View Source

Parses native tool-call structures from provider responses.

Handles the three common shapes:

  1. OpenAI / Ollama — %{id:, type: "function", function: %{name:, arguments: "json"}}. arguments is almost always a JSON-encoded string.

  2. Claude — %{type: "tool_use", id:, name:, input: map()}.

  3. Pre-parsed — already-parsed %{id:, name:, arguments: map()}. No-op.

Tolerant of both atom and string keys, and tolerant of either a JSON string or a decoded map for arguments.

Summary

Functions

parse(calls)

@spec parse(list()) :: {:ok, [ExAthena.Messages.ToolCall.t()]} | {:error, term()}