- Duale AI
- Documentation
- Model Routing
- Structured output
Structured output: provider enforcement
Maps which provider types enforce response schemas, which keywords are stripped, and strict mode conditions for Duale AI structured output.
This reference covers provider enforcement of structured output, removed schema keywords, strict mode rules, and tool parameter schema handling.
- Provider type enforcement of structured output declarations.
- Schema keywords removed before sending to providers.
- Restating removed limits in field descriptions.
- Strict mode structural rules for supported providers.
- Tool parameter schema keyword removal by provider type.
Summaries were generated by AI.
Whether a provider enforces your response schema depends on the provider type of the route and on its declared features. Duale AI validates every answer against your schema either way. Use this reference to check enforcement for each provider type and to shape a schema that keeps strict enforcement on.
Check what each provider type enforces
Before you rely on a typed result, check whether the provider type of each route in the pool enforces the response schema. Provider enforcement can improve the reliability of the first answer. Duale AI validates the final result on every route.
Do not declare structured_output on a Z.ai, AWS Bedrock, or Vertex AI route. These provider types cannot enforce a
response schema. Duale AI adds the schema as a prompt instruction regardless of that declaration; leaving the feature
off keeps the route’s claim accurate.
On a DashScope Qwen route, Duale AI sends your schema with strict enforcement when you declare structured_output. Confirm that the
selected endpoint and region support it before you enable the route, and check the features that a preset declares.
Without structured_output, DashScope receives a JSON-object request and the schema remains a prompt instruction. A
JSON response request also uses JSON-object mode; neither fallback depends on the json_mode declaration.
Keywords that do not reach the provider as constraints
On routes that send a native response schema, except DashScope Qwen routes, Duale AI removes these keywords before it sends the schema:
- numeric bounds and
multipleOf; - string length,
pattern, andformat; - item counts and uniqueness;
- object property counts,
patternProperties, andpropertyNames; defaultanddiscriminator.
Duale AI still applies these rules when it validates the answer and builds the application result. An answer that violates one fails validation and spends a provider request; it never becomes accepted output.
Restate limits in field descriptions
On routes that remove these keywords, restate each limit in the field description. The description reaches the model as an instruction to follow. It does not enforce the limit, so your application still validates the result. Integrate model routing in an application shows a field description that carries a length limit.
Keep strict mode on
On OpenAI Responses, both Microsoft Foundry APIs, OpenAI-compatible Chat Completions, Together AI, Mistral, Groq, and Cerebras routes, Duale AI turns strict mode on only when the schema meets two structural rules:
- Name every property in the object’s required list. One missing property turns strict mode off for the whole request.
- Give every object named properties. A free-form or key-value map turns strict mode off for the whole request.
If one object fails either rule, Duale AI sends the schema without strict mode. It does not raise a configuration error. Both models below illustrate that check and omit their imports, which are the Pydantic ones shown in Integrate model routing in an application:
# Strict mode is off for the entire request: `metadata` has no named properties.
class ReviewResult(BaseModel):
decision: Literal["manual_review", "reject"]
metadata: dict[str, str]
# Strict mode stays on: every object names its properties, and every property is required.
class ReviewMetadata(BaseModel):
model_config = ConfigDict(extra="forbid")
reviewer_queue: str
source_system: str
class ReviewResult(BaseModel):
model_config = ConfigDict(extra="forbid")
decision: Literal["manual_review", "reject"]
metadata: ReviewMetadataAnthropic and DashScope Qwen routes
On an Anthropic route, Duale AI sends the schema without the removed keywords and without a separate strict-mode switch. The provider enforces that schema. The two structural rules above do not apply, but the description rule still carries each removed limit to the model.
On a DashScope Qwen route with structured_output, Duale AI sends the response schema unchanged with strict
enforcement. It removes no keyword and applies no structural check. Use schema features that the configured endpoint
supports; an unsupported schema can fail at the provider.
Tool parameter schemas
Duale AI removes the same keywords from the parameter schema of a Tool on Together AI and DashScope Qwen routes. It also removes them on OpenAI-compatible Chat Completions and Microsoft Foundry Chat Completions routes when Strict Structured Responses is on. Other provider types send the parameter schema unchanged.
Route settings explains how to
declare structured_output and json_mode on a route.