Skip to content
1 min read · 92 words

Function: createAutoToolCallParser()

ts
function createAutoToolCallParser(
  parsers?: Partial<
    Record<Exclude<ToolCallParserName, "auto" | "none">, ToolCallParserFn>
  >,
  order?: readonly (
    | "gemma"
    | "hermes"
    | "gpt_oss"
    | "pythonic"
    | "bare_pythonic"
    | "loose_keyed"
    | "llama3_json"
    | "mistral"
    | "qwen3_coder"
    | "phi"
  )[],
): ToolCallParserFn;

Defined in: src/batteries/llm/chat_common/tool_parsers.ts:1092

Compose an 'auto' parser: run each family parser in order until one returns a non-empty calls array; that result wins. Returns no-match if none claim the text.

Parameters

ParameterTypeDefault value
parsersPartial<Record<Exclude<ToolCallParserName, "auto" | "none">, ToolCallParserFn>>BUNDLED_TOOL_CALL_PARSERS
orderreadonly ( | "gemma" | "hermes" | "gpt_oss" | "pythonic" | "bare_pythonic" | "loose_keyed" | "llama3_json" | "mistral" | "qwen3_coder" | "phi")[]DEFAULT_TOOL_CALL_PARSER_ORDER

Returns

ToolCallParserFn