Skip to content

vllm.parser.granite

Granite parser for JSON-array tool calls.

Granite 3.0/3.1 emit tool calls as a JSON array following a marker::

<|tool_call|> [{"name": "get_weather", "arguments": {"city": "SF"}}]   # 3.0
<tool_call> [{"name": "get_weather", "arguments": {"city": "SF"}}]      # 3.1

<|tool_call|> is a single special token; <tool_call> is plain text. The array may hold several calls, has no closing marker (the ] ends it), and any surrounding prose is content. The engine's JSON-array collection mode splits the array into one call per element and extracts each name via the name-from-args path; _granite_arg_converter carves the arguments object out of each {"name":..,"arguments":{..}} element. Granite has no reasoning.

_granite_arg_converter(raw_args, partial)

Carve the arguments object out of a {"name":..,"arguments":{..}} array element (see extract_json_member_object).