Skip to content

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:

Functions:

  • convert_value –

    Decode raw, but keep the text if the schema admits a string, unless it

  • parameter_types –

    Map tool name to ParameterTypes, for Chat or flat Responses tools.

ParameterTypesCache

Parameter types of the last tools list seen, built on first use.

_json_type(value)

JSON Schema type name of a decoded JSON value.

_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.

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]).

parameter_types(tools)

Map tool name to ParameterTypes, for Chat or flat Responses tools.