Class ToolCalls

java.lang.Object
dev.dokimos.core.agents.ToolCalls

public final class ToolCalls extends Object
Coercion helpers for turning a raw value into a typed List<ToolCall>.

A tool-call list reaches an evaluator either already typed (programmatic use) or as a list of maps (deserialized from a JSON or CSV dataset). coerce(Object) normalizes both into a typed list, validating every element so a malformed dataset row fails with a clear, indexed error.

  • Method Details

    • coerce

      public static List<ToolCall> coerce(Object raw)
      Coerces a value into a typed List<ToolCall>.

      Accepts an already-typed List<ToolCall>, or a List<Map> mapped element by element via ToolCall.fromMap(Map). Every element is validated; a list mixing tool calls and maps (or containing any other element type) is rejected. null or an empty list yields an empty list.

      Parameters:
      raw - the value to coerce
      Returns:
      an unmodifiable list of tool calls, never null
      Throws:
      IllegalArgumentException - if the value is not a list, mixes element types, or contains a malformed tool-call map (the message names the offending element index)