For the complete documentation index, see llms.txt. Markdown versions of all pages are available by appending .md to any URL (e.g. /get-started.md).
Python class
ToolCallPolicy
ToolCallPolicy
class max.pipelines.sampling.ToolCallPolicy(value, names=<not given>, *values, module=None, qualname=None, type=None, start=1, boundary=None)
Policy controlling constrained decoding for tool calls.
A best-effort policy enforces as much of a schema as the grammar can; a
reject policy rejects the request when the grammar can’t enforce the whole
schema. Under FORCE_UNCONSTRAINED, tool_choice=required cannot force
a call.
DEFAULT_STRICT_FALSE_AND_BEST_EFFORT
DEFAULT_STRICT_FALSE_AND_BEST_EFFORT = 'default_strict_false_and_best_effort'
Enforce a tool’s schema best-effort only if strict is true.
DEFAULT_STRICT_FALSE_AND_REJECT_UNSUPPORTED
DEFAULT_STRICT_FALSE_AND_REJECT_UNSUPPORTED = 'default_strict_false_and_reject_unsupported'
Enforce a tool’s schema or reject it only if strict is true.
DEFAULT_STRICT_TRUE_AND_BEST_EFFORT
DEFAULT_STRICT_TRUE_AND_BEST_EFFORT = 'default_strict_true_and_best_effort'
Enforce a tool’s schema best-effort unless strict is false.
DEFAULT_STRICT_TRUE_AND_REJECT_UNSUPPORTED
DEFAULT_STRICT_TRUE_AND_REJECT_UNSUPPORTED = 'default_strict_true_and_reject_unsupported'
Enforce a tool’s schema or reject it unless strict is false.
FORCE_STRICT_FALSE
FORCE_STRICT_FALSE = 'force_strict_false'
Constrain every tool to only the envelope, ignoring strict.
FORCE_STRICT_TRUE_AND_BEST_EFFORT
FORCE_STRICT_TRUE_AND_BEST_EFFORT = 'force_strict_true_and_best_effort'
Enforce every tool’s schema best-effort, ignoring strict.
FORCE_STRICT_TRUE_AND_REJECT_UNSUPPORTED
FORCE_STRICT_TRUE_AND_REJECT_UNSUPPORTED = 'force_strict_true_and_reject_unsupported'
Enforce every tool’s schema or reject it, ignoring strict.
FORCE_UNCONSTRAINED
FORCE_UNCONSTRAINED = 'force_unconstrained'
Do not compile a tool-call grammar, leaving tool calls unconstrained.
reject_unsupported
property reject_unsupported: bool
Whether to raise an error when a tool’s schema cannot be enforced.
Otherwise, the schema is enforced best-effort. The error is raised during grammar compilation.
resolve_strict()
resolve_strict(requested)
Return the effective per-tool strict under this policy.