vllm.tool_parsers.functiongemma_tool_parser
¶
Classes:
-
FunctionGemmaToolParser–Tool parser for Google's FunctionGemma model (google/functiongemma-270m-it).
FunctionGemmaToolParser
¶
Bases: ToolParser
Tool parser for Google's FunctionGemma model (google/functiongemma-270m-it).
Handles the FunctionGemma function call format:
_buffer_delta_text(delta_text)
¶
Buffer incoming delta text to handle multi-token special sequences.
_close_tool_call(current_text)
¶
Stream what is left of the current call, including its closing brace.
_parse_arguments(args_str, partial=False)
¶
Parse a FunctionGemma argument string into a dictionary.
The chat template writes strings as <escape>text<escape> and
everything else bare: true/false, numbers, [item,...] and
{key:value,...} with bare keys. With partial the string is a
streaming prefix: parsing stops at the first incomplete value and the
complete arguments before it are returned.
_stream_arguments(args, final)
¶
Stream the part of the arguments JSON not sent yet.
Arguments only grow by appended keys, so their JSON is prefix-stable
except for the closing brace, which is held back until final.
_parse_value(text, pos, partial)
¶
Parse one value at pos and return it with the position after it.
Raises:
-
_IncompleteValue–textends inside the value. A bare scalar at the end of apartialstring counts as incomplete, since more digits or letters may still follow. -
_MalformedValue–a delimiter stands where the value should start.