IMPORTANT: To view this page as Markdown, append `.md` to the URL (e.g. /get-started.md). For the complete documentation index, see llms.txt.
Skip to main content
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)

source

Bases: str, Enum

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'

source

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'

source

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'

source

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'

source

Enforce a tool’s schema or reject it unless strict is false.

FORCE_STRICT_FALSE​

FORCE_STRICT_FALSE = 'force_strict_false'

source

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'

source

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'

source

Enforce every tool’s schema or reject it, ignoring strict.

FORCE_UNCONSTRAINED​

FORCE_UNCONSTRAINED = 'force_unconstrained'

source

Do not compile a tool-call grammar, leaving tool calls unconstrained.

reject_unsupported​

property reject_unsupported: bool

source

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)

source

Return the effective per-tool strict under this policy.

Parameters:

requested (bool | None)

Return type:

bool