vllm.tool_parsers.schema_types
¶
JSON types admitted by tool parameter schemas.
XML-style tool parsers receive every argument as raw text. These helpers use the parameter's schema to decide whether to keep that text or decode it.
Classes:
-
ParameterTypesCache–Parameter types of the last tools list seen, built on first use.
Functions:
-
convert_value–Decode raw, but keep the text if the schema admits a string, unless it
-
parameter_types–Map tool name to :data:
ParameterTypes, for Chat or flat Responses tools.
ParameterTypesCache
¶
Parameter types of the last tools list seen, built on first use.
Source code in vllm/tool_parsers/schema_types.py
_json_type(value)
¶
JSON Schema type name of a decoded JSON value.
Source code in vllm/tool_parsers/schema_types.py
_schema_types(schema, root, refs)
¶
JSON types a parameter schema admits, or None if it admits any.
Covers type, const, enum, local $ref, anyOf/oneOf
(union) and allOf (intersection), so that e.g. pydantic's
Optional[str] counts as a string. refs memoizes each $ref, which
keeps the walk linear and ends cycles.
Source code in vllm/tool_parsers/schema_types.py
convert_value(raw, allowed, decode)
¶
Decode raw, but keep the text if the schema admits a string, unless it
decodes to another admitted type (null for Optional[str]).
Source code in vllm/tool_parsers/schema_types.py
parameter_types(tools)
¶
Map tool name to :data:ParameterTypes, for Chat or flat Responses tools.