Bedrock: Claude Sonnet 5 rejects llmai's outputConfig.textFormat (output_config.format: Extra inputs are not permitted)
What happens
With Bedrock configured as the text provider and BEDROCK_MODEL set to a Claude Sonnet 5 inference profile, every presentation generation fails at the outline stage with a Bedrock ValidationException:
botocore.errorfactory.ValidationException: An error occurred (ValidationException) when calling the ConverseStream operation: The model returned the following errors: output_config.format: Extra inputs are not permittedsurfaced as:
llmai.shared.errors.LLMError: 400: The model returned the following errors: output_config.format: Extra inputs are not permittedand returned to the API caller as POST /api/v1/ppt/presentation/generate → 400 Bad Request.
Traceback (abbreviated)
File "/app/servers/fastapi/utils/llm_calls/generate_presentation_outlines.py", line 371, in generate_ppt_outline
async for event in stream_generate_events(
File "/app/servers/fastapi/utils/llm_utils.py", line 523, in stream_generate_events
File "/opt/venv/lib/python3.11/site-packages/llmai/bedrock/client.py", line 766, in _generate_stream
File "/opt/venv/lib/python3.11/site-packages/llmai/bedrock/client.py", line 1029, in _generate_streamRoot cause
llmai 0.3.13 (llmai/bedrock/client.py) unconditionally attaches Bedrock's structured-output parameter whenever a response_format is requested:
# llmai/bedrock/client.py:619-621
output_config = self._get_output_config(response_format)
if output_config:
kwargs["outputConfig"] = output_config# llmai/bedrock/client.py:408-424
def _get_output_config(self, response_format):
response_schema = self._get_bedrock_response_schema(response_format)
if not response_schema:
return None
return {
"textFormat": {
"type": "json_schema",
"structure": {"jsonSchema": {"schema": json.dumps(response_schema)}},
}
}Outline generation always requests a structured response_format, so this parameter is always sent, and Sonnet 5 rejects it. Sonnet 4.x-era models accept the current shape, so this only reproduces on Sonnet 5.
Environment
- Presenton: self-hosted Docker (
ghcr.io/presenton/presenton), v0.9.7-beta era image, running on AWS ECS Fargate llmai: 0.3.13 (latest on PyPI at time of writing - no newer version available to upgrade to)- Provider config (verified present in the running FastAPI process via
/proc/<pid>/environ):LLM=bedrockBEDROCK_REGION=eu-west-1BEDROCK_MODEL=arn:aws:bedrock:eu-west-1:<account>:inference-profile/eu.anthropic.claude-sonnet-5- Credentials via
BEDROCK_AWS_ACCESS_KEY_ID/BEDROCK_AWS_SECRET_ACCESS_KEY/BEDROCK_AWS_SESSION_TOKEN
IAM is correct and not the cause - Bedrock authorises the call and the model itself returns the validation error. (For anyone else hitting a separate AccessDeniedException with a geographic eu./us. inference profile: that one needs the underlying foundation-model ARNs in every region the profile routes to, per AWS's "Prerequisites for inference profiles" docs - unrelated to this bug.)
Expected
Sonnet 5 generation succeeds, or llmai adapts the structured-output request shape (or omits it) for models that do not accept the current outputConfig.textFormat format.
Notes
There appears to be no configuration-side workaround: the parameter is attached automatically whenever a response_format is present, which outline generation always sets, and is not gated by any env var. The practical workaround for users is to pin BEDROCK_MODEL to a Sonnet 4.x model instead.
Source: presenton/presenton