feat(aws-bedrock/us.anthropic.claude-fable-5): add new models [bot]#1326
feat(aws-bedrock/us.anthropic.claude-fable-5): add new models [bot]#1326models-bot[bot] wants to merge 2 commits into
Conversation
|
/test-models |
There was a problem hiding this comment.
Cursor Bugbot has reviewed your changes and found 3 potential issues.
❌ Bugbot Autofix is OFF. To automatically fix reported issues with cloud agents, enable autofix in the Cursor dashboard.
Reviewed by Cursor Bugbot for commit 1e58aca. Configure here.
| - defaultValue: 1 | ||
| key: temperature | ||
| maxValue: 1 | ||
| minValue: 1 |
There was a problem hiding this comment.
Temperature minimum bound wrong
Medium Severity
The temperature override sets minValue to 1 while maxValue is also 1, so metadata only allows the maximum setting and rejects the usual 0–1 range. The aws-bedrock provider default uses minValue 0. This mismatch likely comes from a typo and breaks valid sampling values for consumers that enforce these bounds.
Reviewed by Cursor Bugbot for commit 1e58aca. Configure here.
| - system_messages | ||
| - tool_choice | ||
| - prompt_caching | ||
| - structured_output |
There was a problem hiding this comment.
structured_output wrongly advertised
Medium Severity
The config lists structured_output under features, but comparable Bedrock Anthropic chat models in this repo note that structured_output is not supported on the bedrock-converse path. Advertising it here can cause gateways or UIs to enable JSON-schema flows that fail at runtime.
Reviewed by Cursor Bugbot for commit 1e58aca. Configure here.
| - defaultValue: 0.99 | ||
| key: top_p | ||
| maxValue: 1 | ||
| minValue: 0.99 |
There was a problem hiding this comment.
Thinking params misaligned with peers
Medium Severity
For thinking: true, sibling Bedrock Claude configs drop temperature via removeParams and expose a thinking JSON param, while the direct claude-fable-5 provider entry removes temperature, top_p, and top_k. This file instead overrides temperature and top_p with narrow bounds and omits removeParams and the thinking param, so merged metadata can expose unsupported or incorrect sampling controls.
Reviewed by Cursor Bugbot for commit 1e58aca. Configure here.
Gateway test results
Failures (22)
ErrorCode snippetimport boto3
from botocore.config import Config
_endpoint = "https://internal.devtest.truefoundry.tech/api/llm"
_api_key = "***"
_model = "test-v2-aws-bedrock/us.anthropic.claude-fable-5"
client = boto3.client(
"bedrock-runtime",
region_name="us-east-1",
endpoint_url=_endpoint,
aws_access_key_id="dummy",
aws_secret_access_key="dummy",
config=Config(inject_host_prefix=False),
)
def _add_auth_header(request, **kwargs):
request.headers["x-tfy-api-key"] = _api_key
client.meta.events.register("before-sign.bedrock-runtime.*", _add_auth_header)
tool_config = {
"tools": [
{
"toolSpec": {
"name": "get_weather",
"description": "Get the current weather for a location.",
"inputSchema": {
"json": {
"type": "object",
"properties": {
"location": {
"type": "string",
"description": "The city name, e.g. London",
},
},
"required": ["location"],
}
},
}
}
],
"toolChoice": {"auto": {}},
}
messages = [
{"role": "user", "content": [{"text": "Hi"}]},
{"role": "assistant", "content": [{"text": "Hi, how can I help you"}]},
{"role": "user", "content": [{"text": "Use the get_weather tool to check the weather in London. You must call the tool, do not respond with plain text."}]},
]
system = [{"text": "You are a helpful assistant with access to tools. You MUST strictly use the provided tools to answer. Never respond with plain text when a tool is available."}]
response = client.converse(
modelId=_model,
system=system,
messages=messages,
toolConfig=tool_config,
)
_content = response["output"]["message"]["content"]
_tool_uses = [block for block in _content if "toolUse" in block]
if _tool_uses:
for _tu in _tool_uses:
print(f"Tool: {_tu['toolUse']['name']}")
print(f"Input: {_tu['toolUse']['input']}")
else:
_text_blocks = [block["text"] for block in _content if "text" in block]
print("\n".join(_text_blocks))
_content = response["output"]["message"]["content"]
_tool_uses = [block for block in _content if "toolUse" in block]
if not _tool_uses:
raise Exception("VALIDATION FAILED: tool-call - no tool uses in Bedrock response")
print("VALIDATION: tool-call SUCCESS")
ErrorCode snippetimport boto3
from botocore.config import Config
_endpoint = "https://internal.devtest.truefoundry.tech/api/llm"
_api_key = "***"
_model = "test-v2-aws-bedrock/us.anthropic.claude-fable-5"
client = boto3.client(
"bedrock-runtime",
region_name="us-east-1",
endpoint_url=_endpoint,
aws_access_key_id="dummy",
aws_secret_access_key="dummy",
config=Config(inject_host_prefix=False),
)
def _add_auth_header(request, **kwargs):
request.headers["x-tfy-api-key"] = _api_key
client.meta.events.register("before-sign.bedrock-runtime.*", _add_auth_header)
messages = [
{"role": "user", "content": [{"text": "Hi"}]},
{"role": "assistant", "content": [{"text": "Hi, how can I help you"}]},
{"role": "user", "content": [{"text": "How to calculate 3^3^3^3? Think step by step and show all reasoning."}]},
]
system = [{"text": "You are a helpful assistant. You MUST think step by step and show your reasoning. Never skip reasoning steps."}]
response = client.converse_stream(
modelId=_model,
system=system,
messages=messages,
additionalModelRequestFields={
"thinking": {"type":"adaptive"},
},
)
_events = []
for _event in response["stream"]:
_events.append(_event)
if "contentBlockDelta" in _event:
_delta = _event["contentBlockDelta"].get("delta", {})
if "reasoningContent" in _delta:
print(_delta["reasoningContent"].get("text", ""), end="", flush=True)
if "text" in _delta:
print(_delta["text"], end="", flush=True)
_reasoning_detected = False
for _event in _events:
if "contentBlockDelta" in _event:
_delta = _event["contentBlockDelta"].get("delta", {})
if "reasoningContent" in _delta:
_reasoning_detected = True
if "contentBlockStart" in _event:
_start = _event["contentBlockStart"].get("start", {})
if "reasoningContent" in _start:
_reasoning_detected = True
if "metadata" in _event:
_usage = _event["metadata"].get("usage", {})
if _usage.get("reasoning_tokens") or _usage.get("reasoningTokens"):
_reasoning_detected = True
if not _reasoning_detected:
raise Exception("VALIDATION FAILED: reasoning stream - no reasoning information in Bedrock stream")
print("\nVALIDATION: reasoning stream SUCCESS")
ErrorCode snippetimport boto3
import json
from botocore.config import Config
_endpoint = "https://internal.devtest.truefoundry.tech/api/llm"
_api_key = "***"
_model = "test-v2-aws-bedrock/us.anthropic.claude-fable-5"
client = boto3.client(
"bedrock-runtime",
region_name="us-east-1",
endpoint_url=_endpoint,
aws_access_key_id="dummy",
aws_secret_access_key="dummy",
config=Config(inject_host_prefix=False),
)
def _add_auth_header(request, **kwargs):
request.headers["x-tfy-api-key"] = _api_key
client.meta.events.register("before-sign.bedrock-runtime.*", _add_auth_header)
response_schema = {
"title": "CalendarEvent",
"type": "object",
"properties": {
"name": {"type": "string"},
"date": {"type": "string"},
"participants": {
"type": "array",
"items": {"type": "string"},
},
},
"required": ["name", "date", "participants"],
"additionalProperties": False,
}
output_config = {
"textFormat": {
"type": "json_schema",
"structure": {
"jsonSchema": {
"schema": json.dumps(response_schema),
"name": "CalendarEvent",
"description": "Extract event information as a structured CalendarEvent.",
}
}
}
}
messages = [
{"role": "user", "content": [{"text": "Hi"}]},
{"role": "assistant", "content": [{"text": "Hi, how can I help you"}]},
{"role": "user", "content": [{"text": "Alice and Bob are going to a science fair on Friday."}]},
]
system = [{"text": "Extract the event information as JSON matching the provided schema."}]
response = client.converse(
modelId=_model,
system=system,
messages=messages,
outputConfig=output_config,
)
_content = response["output"]["message"]["content"]
for _block in _content:
if "text" in _block:
print(_block["text"])
import json as _json
_content = response["output"]["message"]["content"]
_text_blocks = [block["text"] for block in _content if "text" in block]
_text = "".join(_text_blocks)
if not _text:
raise Exception("VALIDATION FAILED: structured-output - no content received from Bedrock response")
_parsed = _json.loads(_text)
if "name" not in _parsed or "date" not in _parsed or "participants" not in _parsed:
raise Exception("VALIDATION FAILED: structured-output - missing expected fields (name, date, participants)")
if not isinstance(_parsed.get("participants"), list):
raise Exception("VALIDATION FAILED: structured-output - 'participants' is not a list, schema not enforced")
print("VALIDATION: structured-output SUCCESS")
ErrorCode snippetimport boto3
from botocore.config import Config
_endpoint = "https://internal.devtest.truefoundry.tech/api/llm"
_api_key = "***"
_model = "test-v2-aws-bedrock/us.anthropic.claude-fable-5"
client = boto3.client(
"bedrock-runtime",
region_name="us-east-1",
endpoint_url=_endpoint,
aws_access_key_id="dummy",
aws_secret_access_key="dummy",
config=Config(inject_host_prefix=False),
)
def _add_auth_header(request, **kwargs):
request.headers["x-tfy-api-key"] = _api_key
client.meta.events.register("before-sign.bedrock-runtime.*", _add_auth_header)
messages = [
{"role": "user", "content": [{"text": "Hi"}]},
{"role": "assistant", "content": [{"text": "Hi, how can I help you"}]},
{"role": "user", "content": [{"text": "How to calculate 3^3^3^3? Think step by step and show all reasoning."}]},
]
system = [{"text": "You are a helpful assistant. You MUST think step by step and show your reasoning. Never skip reasoning steps."}]
response = client.converse(
modelId=_model,
system=system,
messages=messages,
additionalModelRequestFields={
"thinking": {"type":"adaptive"},
},
)
_content = response["output"]["message"]["content"]
for _block in _content:
if "reasoningContent" in _block:
print(_block["reasoningContent"]["reasoningText"]["text"])
if "text" in _block:
print(_block["text"])
_content = response["output"]["message"]["content"]
_reasoning_detected = False
for _block in _content:
if "reasoningContent" in _block:
_reasoning_detected = True
_usage = response.get("usage", {})
if _usage.get("reasoning_tokens") or _usage.get("reasoningTokens"):
_reasoning_detected = True
if not _reasoning_detected:
print("Response: ", response)
raise Exception("VALIDATION FAILED: reasoning - no reasoning information in Bedrock response")
print("VALIDATION: reasoning SUCCESS")
ErrorCode snippetimport boto3
from botocore.config import Config
_endpoint = "https://internal.devtest.truefoundry.tech/api/llm"
_api_key = "***"
_model = "test-v2-aws-bedrock/us.anthropic.claude-fable-5"
client = boto3.client(
"bedrock-runtime",
region_name="us-east-1",
endpoint_url=_endpoint,
aws_access_key_id="dummy",
aws_secret_access_key="dummy",
config=Config(inject_host_prefix=False),
)
def _add_auth_header(request, **kwargs):
request.headers["x-tfy-api-key"] = _api_key
client.meta.events.register("before-sign.bedrock-runtime.*", _add_auth_header)
messages = [
{"role": "user", "content": [{"text": "Hi"}]},
{"role": "assistant", "content": [{"text": "Hi, how can I help you"}]},
{"role": "user", "content": [{"text": "What is the capital of France?"}]},
]
system = [{"text": "You are a helpful assistant."}]
response = client.converse_stream(
modelId=_model,
system=system,
messages=messages,
inferenceConfig={
"maxTokens": 1000,
"temperature": 1,
},
)
_events = []
for _event in response["stream"]:
_events.append(_event)
if "contentBlockDelta" in _event:
_delta = _event["contentBlockDelta"].get("delta", {})
if "text" in _delta:
print(_delta["text"], end="", flush=True)
ErrorCode snippetimport boto3
from botocore.config import Config
_endpoint = "https://internal.devtest.truefoundry.tech/api/llm"
_api_key = "***"
_model = "test-v2-aws-bedrock/us.anthropic.claude-fable-5"
client = boto3.client(
"bedrock-runtime",
region_name="us-east-1",
endpoint_url=_endpoint,
aws_access_key_id="dummy",
aws_secret_access_key="dummy",
config=Config(inject_host_prefix=False),
)
def _add_auth_header(request, **kwargs):
request.headers["x-tfy-api-key"] = _api_key
client.meta.events.register("before-sign.bedrock-runtime.*", _add_auth_header)
messages = [
{"role": "user", "content": [{"text": "Hi"}]},
{"role": "assistant", "content": [{"text": "Hi, how can I help you"}]},
{"role": "user", "content": [{"text": "What is the capital of France?"}]},
]
system = [{"text": "You are a helpful assistant."}]
response = client.converse(
modelId=_model,
system=system,
messages=messages,
inferenceConfig={
"maxTokens": 1000,
"temperature": 1,
},
)
_content = response["output"]["message"]["content"]
for _block in _content:
if "text" in _block:
print(_block["text"])
ErrorCode snippetimport boto3
from botocore.config import Config
_endpoint = "https://internal.devtest.truefoundry.tech/api/llm"
_api_key = "***"
_model = "test-v2-aws-bedrock/us.anthropic.claude-fable-5"
client = boto3.client(
"bedrock-runtime",
region_name="us-east-1",
endpoint_url=_endpoint,
aws_access_key_id="dummy",
aws_secret_access_key="dummy",
config=Config(inject_host_prefix=False),
)
def _add_auth_header(request, **kwargs):
request.headers["x-tfy-api-key"] = _api_key
client.meta.events.register("before-sign.bedrock-runtime.*", _add_auth_header)
tool_config = {
"tools": [
{
"toolSpec": {
"name": "get_weather",
"description": "Get the current weather for a location.",
"inputSchema": {
"json": {
"type": "object",
"properties": {
"location": {
"type": "string",
"description": "The city name, e.g. London",
},
},
"required": ["location"],
}
},
}
}
],
"toolChoice": {"auto": {}},
}
messages = [
{"role": "user", "content": [{"text": "Hi"}]},
{"role": "assistant", "content": [{"text": "Hi, how can I help you"}]},
{"role": "user", "content": [{"text": "Use the get_weather tool to check the weather in London and Paris. You MUST make both tool calls strictly in parallel, not sequentially."}]},
]
system = [{"text": "You are a helpful assistant with access to tools. You MUST strictly call multiple tools in parallel whenever possible. Never call them sequentially."}]
response = client.converse(
modelId=_model,
system=system,
messages=messages,
toolConfig=tool_config,
)
_content = response["output"]["message"]["content"]
_tool_uses = [block for block in _content if "toolUse" in block]
if _tool_uses:
for _tu in _tool_uses:
print(f"Tool: {_tu['toolUse']['name']}")
print(f"Input: {_tu['toolUse']['input']}")
else:
_text_blocks = [block["text"] for block in _content if "text" in block]
print("\n".join(_text_blocks))
_content = response["output"]["message"]["content"]
_tool_uses = [block for block in _content if "toolUse" in block]
if _tool_uses:
print(f"Number of parallel tool calls: {len(_tool_uses)}")
if not _tool_uses or len(_tool_uses) < 1:
raise Exception(
f"VALIDATION FAILED: parallel-tool-call - expected at least 1 tool call, "
f"got {len(_tool_uses) if _tool_uses else 0}"
)
print("VALIDATION: parallel-tool-call SUCCESS")
ErrorCode snippetimport boto3
import json
from botocore.config import Config
_endpoint = "https://internal.devtest.truefoundry.tech/api/llm"
_api_key = "***"
_model = "test-v2-aws-bedrock/us.anthropic.claude-fable-5"
client = boto3.client(
"bedrock-runtime",
region_name="us-east-1",
endpoint_url=_endpoint,
aws_access_key_id="dummy",
aws_secret_access_key="dummy",
config=Config(inject_host_prefix=False),
)
def _add_auth_header(request, **kwargs):
request.headers["x-tfy-api-key"] = _api_key
client.meta.events.register("before-sign.bedrock-runtime.*", _add_auth_header)
response_schema = {
"title": "CalendarEvent",
"type": "object",
"properties": {
"name": {"type": "string"},
"date": {"type": "string"},
"participants": {
"type": "array",
"items": {"type": "string"},
},
},
"required": ["name", "date", "participants"],
"additionalProperties": False,
}
output_config = {
"textFormat": {
"type": "json_schema",
"structure": {
"jsonSchema": {
"schema": json.dumps(response_schema),
"name": "CalendarEvent",
"description": "Extract event information as a structured CalendarEvent.",
}
}
}
}
messages = [
{"role": "user", "content": [{"text": "Hi"}]},
{"role": "assistant", "content": [{"text": "Hi, how can I help you"}]},
{"role": "user", "content": [{"text": "Alice and Bob are going to a science fair on Friday."}]},
]
system = [{"text": "Extract the event information as JSON matching the provided schema."}]
response = client.converse_stream(
modelId=_model,
system=system,
messages=messages,
outputConfig=output_config,
)
_events = []
for _event in response["stream"]:
_events.append(_event)
if "contentBlockDelta" in _event:
_delta = _event["contentBlockDelta"].get("delta", {})
if "text" in _delta:
print(_delta["text"], end="", flush=True)
import json as _json
_accumulated_text = ""
for _event in _events:
if "contentBlockDelta" in _event:
_delta = _event["contentBlockDelta"].get("delta", {})
if "text" in _delta:
_accumulated_text += _delta["text"]
if _accumulated_text:
_parsed = _json.loads(_accumulated_text)
else:
raise Exception("VALIDATION FAILED: structured-output stream - no content received from Bedrock stream")
if "name" not in _parsed or "date" not in _parsed or "participants" not in _parsed:
raise Exception("VALIDATION FAILED: structured-output stream - missing expected fields (name, date, participants)")
if not isinstance(_parsed.get("participants"), list):
raise Exception("VALIDATION FAILED: structured-output stream - 'participants' is not a list, schema not enforced")
print("\nVALIDATION: structured-output stream SUCCESS")
ErrorCode snippetimport boto3
from botocore.config import Config
_endpoint = "https://internal.devtest.truefoundry.tech/api/llm"
_api_key = "***"
_model = "test-v2-aws-bedrock/us.anthropic.claude-fable-5"
client = boto3.client(
"bedrock-runtime",
region_name="us-east-1",
endpoint_url=_endpoint,
aws_access_key_id="dummy",
aws_secret_access_key="dummy",
config=Config(inject_host_prefix=False),
)
def _add_auth_header(request, **kwargs):
request.headers["x-tfy-api-key"] = _api_key
client.meta.events.register("before-sign.bedrock-runtime.*", _add_auth_header)
tool_config = {
"tools": [
{
"toolSpec": {
"name": "get_weather",
"description": "Get the current weather for a location.",
"inputSchema": {
"json": {
"type": "object",
"properties": {
"location": {
"type": "string",
"description": "The city name, e.g. London",
},
},
"required": ["location"],
}
},
}
}
],
"toolChoice": {"auto": {}},
}
messages = [
{"role": "user", "content": [{"text": "Hi"}]},
{"role": "assistant", "content": [{"text": "Hi, how can I help you"}]},
{"role": "user", "content": [{"text": "Use the get_weather tool to check the weather in London. You must call the tool, do not respond with plain text."}]},
]
system = [{"text": "You are a helpful assistant with access to tools. You MUST strictly use the provided tools to answer. Never respond with plain text when a tool is available."}]
response = client.converse_stream(
modelId=_model,
system=system,
messages=messages,
toolConfig=tool_config,
)
_events = []
for _event in response["stream"]:
_events.append(_event)
if "contentBlockStart" in _event:
_start = _event["contentBlockStart"].get("start", {})
if "toolUse" in _start:
print(f"Tool: {_start['toolUse'].get('name', '')}", flush=True)
if "contentBlockDelta" in _event:
_delta = _event["contentBlockDelta"].get("delta", {})
if "toolUse" in _delta:
print(_delta["toolUse"].get("input", ""), end="", flush=True)
if "text" in _delta:
print(_delta["text"], end="", flush=True)
_tool_use_detected = False
for _event in _events:
if "contentBlockStart" in _event:
_start = _event["contentBlockStart"].get("start", {})
if "toolUse" in _start:
_tool_use_detected = True
if "contentBlockDelta" in _event:
_delta = _event["contentBlockDelta"].get("delta", {})
if "toolUse" in _delta:
_tool_use_detected = True
if not _tool_use_detected:
raise Exception("VALIDATION FAILED: tool-call stream - no tool uses in Bedrock stream")
print("\nVALIDATION: tool-call stream SUCCESS")
ErrorCode snippetimport boto3
from botocore.config import Config
_endpoint = "https://internal.devtest.truefoundry.tech/api/llm"
_api_key = "***"
_model = "test-v2-aws-bedrock/us.anthropic.claude-fable-5"
client = boto3.client(
"bedrock-runtime",
region_name="us-east-1",
endpoint_url=_endpoint,
aws_access_key_id="dummy",
aws_secret_access_key="dummy",
config=Config(inject_host_prefix=False),
)
def _add_auth_header(request, **kwargs):
request.headers["x-tfy-api-key"] = _api_key
client.meta.events.register("before-sign.bedrock-runtime.*", _add_auth_header)
tool_config = {
"tools": [
{
"toolSpec": {
"name": "get_weather",
"description": "Get the current weather for a location.",
"inputSchema": {
"json": {
"type": "object",
"properties": {
"location": {
"type": "string",
"description": "The city name, e.g. London",
},
},
"required": ["location"],
}
},
}
}
],
"toolChoice": {"auto": {}},
}
messages = [
{"role": "user", "content": [{"text": "Hi"}]},
{"role": "assistant", "content": [{"text": "Hi, how can I help you"}]},
{"role": "user", "content": [{"text": "Use the get_weather tool to check the weather in London and Paris. You MUST make both tool calls strictly in parallel, not sequentially."}]},
]
system = [{"text": "You are a helpful assistant with access to tools. You MUST strictly call multiple tools in parallel whenever possible. Never call them sequentially."}]
response = client.converse_stream(
modelId=_model,
system=system,
messages=messages,
toolConfig=tool_config,
)
_events = []
for _event in response["stream"]:
_events.append(_event)
if "contentBlockStart" in _event:
_start = _event["contentBlockStart"].get("start", {})
if "toolUse" in _start:
print(f"Tool: {_start['toolUse'].get('name', '')}", flush=True)
if "contentBlockDelta" in _event:
_delta = _event["contentBlockDelta"].get("delta", {})
if "toolUse" in _delta:
print(_delta["toolUse"].get("input", ""), end="", flush=True)
if "text" in _delta:
print(_delta["text"], end="", flush=True)
_tool_use_indices = set()
_current_index = -1
for _event in _events:
if "contentBlockStart" in _event:
_start = _event["contentBlockStart"]
_current_index = _start.get("contentBlockIndex", _current_index + 1)
if "toolUse" in _start.get("start", {}):
_tool_use_indices.add(_current_index)
if len(_tool_use_indices) < 1:
raise Exception(
f"VALIDATION FAILED: parallel-tool-call stream - expected at least 1 tool call, "
f"got {len(_tool_use_indices)}"
)
print(f"\nNumber of parallel tool calls: {len(_tool_use_indices)}")
print("VALIDATION: parallel-tool-call stream SUCCESS")
ErrorCode snippetfrom openai import OpenAI
client = OpenAI(api_key="***", base_url="https://internal.devtest.truefoundry.tech/api/llm")
tools = [
{
"type": "function",
"function": {
"name": "get_weather",
"description": "Get the current weather for a location.",
"parameters": {
"type": "object",
"properties": {
"location": {
"type": "string",
"description": "The city name, e.g. London",
},
},
"required": ["location"],
"additionalProperties": False,
},
"strict": True,
},
},
]
response = client.chat.completions.create(
model="test-v2-aws-bedrock/us.anthropic.claude-fable-5",
messages=[
{"role": "system", "content": "You are a helpful assistant with access to tools. You MUST strictly call multiple tools in parallel whenever possible. Never call them sequentially."},
{"role": "user", "content": "Hi"},
{"role": "assistant", "content": "Hi, how can I help you"},
{"role": "user", "content": "Use the get_weather tool to check the weather in London and Paris. You MUST make both tool calls strictly in parallel, not sequentially."},
],
tools=tools,
tool_choice="auto",
parallel_tool_calls=True,
stream=True,
)
_tool_call_indices = set()
for chunk in response:
if chunk.choices and len(chunk.choices) > 0:
delta = chunk.choices[0].delta
if delta.content is not None:
print(delta.content, end="", flush=True)
if delta.tool_calls:
for _tc in delta.tool_calls:
_tool_call_indices.add(_tc.index)
if _tc.function:
print(_tc.function.arguments or "", end="", flush=True)
if len(_tool_call_indices) < 1:
raise Exception(
f"VALIDATION FAILED: parallel-tool-call stream - expected at least 1 tool call, "
f"got {len(_tool_call_indices)}"
)
print(f"\nNumber of parallel tool calls: {len(_tool_call_indices)}")
print("VALIDATION: parallel-tool-call stream SUCCESS")
ErrorCode snippetfrom openai import OpenAI
import json
client = OpenAI(api_key="***", base_url="https://internal.devtest.truefoundry.tech/api/llm")
response_schema = json.loads('''{
"title": "CalendarEvent",
"type": "object",
"properties": {
"name": { "type": "string" },
"date": { "type": "string" },
"participants": {
"type": "array",
"items": { "type": "string" }
}
},
"required": ["name", "date", "participants"],
"additionalProperties": false
}''')
response = client.chat.completions.create(
model="test-v2-aws-bedrock/us.anthropic.claude-fable-5",
messages=[
{"role": "system", "content": "Extract the event information as JSON."},
{"role": "user", "content": "Hi"},
{"role": "assistant", "content": "Hi, how can I help you"},
{"role": "user", "content": "Alice and Bob are going to a science fair on Friday. Extract the event details as JSON."},
],
response_format={"type": "json_schema", "json_schema": {"name": "CalendarEvent", "schema": response_schema}},
stream=False,
)
import json as _json
_content = response.choices[0].message.content
print(_content)
if not _content:
raise Exception("VALIDATION FAILED: structured-output - response content is empty")
_parsed = _json.loads(_content)
if "name" not in _parsed or "date" not in _parsed or "participants" not in _parsed:
raise Exception("VALIDATION FAILED: structured-output - missing expected fields (name, date, participants)")
if not isinstance(_parsed.get("participants"), list):
raise Exception("VALIDATION FAILED: structured-output - 'participants' is not a list, schema not enforced")
if set(_parsed.keys()) != {"name", "date", "participants"}:
raise Exception(
f"VALIDATION FAILED: structured-output - unexpected keys present: {set(_parsed.keys())}"
)
print("VALIDATION: structured-output SUCCESS")
ErrorCode snippetfrom openai import OpenAI
client = OpenAI(api_key="***", base_url="https://internal.devtest.truefoundry.tech/api/llm")
tools = [
{
"type": "function",
"function": {
"name": "get_weather",
"description": "Get the current weather for a location.",
"parameters": {
"type": "object",
"properties": {
"location": {
"type": "string",
"description": "The city name, e.g. London",
},
},
"required": ["location"],
"additionalProperties": False,
},
"strict": True,
},
},
]
response = client.chat.completions.create(
model="test-v2-aws-bedrock/us.anthropic.claude-fable-5",
messages=[
{"role": "system", "content": "You are a helpful assistant with access to tools. You MUST strictly use the provided tools to answer. Never respond with plain text when a tool is available."},
{"role": "user", "content": "Hi"},
{"role": "assistant", "content": "Hi, how can I help you"},
{"role": "user", "content": "Use the get_weather tool to check the weather in London. You must call the tool, do not respond with plain text."},
],
tools=tools,
tool_choice="auto",
stream=False,
)
_message = response.choices[0].message
if _message.tool_calls:
for _tc in _message.tool_calls:
print(f"Function: {_tc.function.name}")
print(f"Arguments: {_tc.function.arguments}")
else:
print(_message.content)
if not _message.tool_calls or len(_message.tool_calls) == 0:
raise Exception("VALIDATION FAILED: tool-call - no tool calls in response")
print("VALIDATION: tool-call SUCCESS")
ErrorCode snippetfrom openai import OpenAI
client = OpenAI(api_key="***", base_url="https://internal.devtest.truefoundry.tech/api/llm")
response = client.chat.completions.create(
model="test-v2-aws-bedrock/us.anthropic.claude-fable-5",
messages=[
{"role": "system", "content": "You are a helpful assistant. Respond in JSON format."},
{"role": "user", "content": "Hi"},
{"role": "assistant", "content": "Hi, how can I help you"},
{"role": "user", "content": "List 3 colors with their hex codes in JSON."},
],
response_format={"type": "json_object"},
stream=True,
)
import json as _json
_accumulated = ""
for chunk in response:
if chunk.choices and len(chunk.choices) > 0:
delta = chunk.choices[0].delta
if delta.content is not None:
_accumulated += delta.content
print(delta.content, end="", flush=True)
if not _accumulated:
raise Exception("VALIDATION FAILED: json-output stream - no content received")
_json.loads(_accumulated)
print("\nVALIDATION: json-output stream SUCCESS")
ErrorCode snippetfrom openai import OpenAI
client = OpenAI(api_key="***", base_url="https://internal.devtest.truefoundry.tech/api/llm")
tools = [
{
"type": "function",
"function": {
"name": "get_weather",
"description": "Get the current weather for a location.",
"parameters": {
"type": "object",
"properties": {
"location": {
"type": "string",
"description": "The city name, e.g. London",
},
},
"required": ["location"],
"additionalProperties": False,
},
"strict": True,
},
},
]
response = client.chat.completions.create(
model="test-v2-aws-bedrock/us.anthropic.claude-fable-5",
messages=[
{"role": "system", "content": "You are a helpful assistant with access to tools. You MUST strictly use the provided tools to answer. Never respond with plain text when a tool is available."},
{"role": "user", "content": "Hi"},
{"role": "assistant", "content": "Hi, how can I help you"},
{"role": "user", "content": "Use the get_weather tool to check the weather in London. You must call the tool, do not respond with plain text."},
],
tools=tools,
tool_choice="auto",
stream=True,
)
_tool_calls_made = False
for chunk in response:
if chunk.choices and len(chunk.choices) > 0:
delta = chunk.choices[0].delta
if delta.content is not None:
print(delta.content, end="", flush=True)
if delta.tool_calls:
_tool_calls_made = True
for _tc in delta.tool_calls:
if _tc.function:
print(_tc.function.arguments or "", end="", flush=True)
if not _tool_calls_made:
raise Exception("VALIDATION FAILED: tool-call stream - no tool calls received")
print("\nVALIDATION: tool-call stream SUCCESS")
ErrorCode snippetfrom openai import OpenAI
client = OpenAI(api_key="***", base_url="https://internal.devtest.truefoundry.tech/api/llm")
tools = [
{
"type": "function",
"function": {
"name": "get_weather",
"description": "Get the current weather for a location.",
"parameters": {
"type": "object",
"properties": {
"location": {
"type": "string",
"description": "The city name, e.g. London",
},
},
"required": ["location"],
"additionalProperties": False,
},
"strict": True,
},
},
]
response = client.chat.completions.create(
model="test-v2-aws-bedrock/us.anthropic.claude-fable-5",
messages=[
{"role": "system", "content": "You are a helpful assistant with access to tools. You MUST strictly call multiple tools in parallel whenever possible. Never call them sequentially."},
{"role": "user", "content": "Hi"},
{"role": "assistant", "content": "Hi, how can I help you"},
{"role": "user", "content": "Use the get_weather tool to check the weather in London and Paris. You MUST make both tool calls strictly in parallel, not sequentially."},
],
tools=tools,
tool_choice="auto",
parallel_tool_calls=True,
stream=False,
)
_message = response.choices[0].message
if _message.tool_calls:
print(f"Number of parallel tool calls: {len(_message.tool_calls)}")
for _tc in _message.tool_calls:
print(f"Function: {_tc.function.name}")
print(f"Arguments: {_tc.function.arguments}")
else:
print(_message.content)
if not _message.tool_calls or len(_message.tool_calls) < 1:
raise Exception(
f"VALIDATION FAILED: parallel-tool-call - expected at least 1 tool call, "
f"got {len(_message.tool_calls) if _message.tool_calls else 0}"
)
print("VALIDATION: parallel-tool-call SUCCESS")
ErrorCode snippetfrom openai import OpenAI
client = OpenAI(api_key="***", base_url="https://internal.devtest.truefoundry.tech/api/llm")
response = client.chat.completions.create(
model="test-v2-aws-bedrock/us.anthropic.claude-fable-5",
messages=[
{"role": "system", "content": "You are a helpful assistant. You MUST think step by step and show your reasoning. Never skip reasoning steps."},
{"role": "user", "content": "Hi"},
{"role": "assistant", "content": "Hi, how can I help you"},
{"role": "user", "content": "How to calculate 3^3^3^3? Think step by step and show all reasoning."},
],
reasoning_effort="medium",
stream=True,
)
_reasoning_detected = False
for chunk in response:
if chunk.choices and len(chunk.choices) > 0:
delta = chunk.choices[0].delta
if delta.content is not None:
print(delta.content, end="", flush=True)
if getattr(delta, "reasoning_content", None) is not None:
_reasoning_detected = True
if getattr(delta, "reasoning", None) is not None:
_reasoning_detected = True
_usage = getattr(chunk, "usage", None)
if _usage is not None:
_details = getattr(_usage, "completion_tokens_details", None)
if _details and getattr(_details, "reasoning_tokens", 0) > 0:
_reasoning_detected = True
if not _reasoning_detected:
raise Exception("VALIDATION FAILED: reasoning stream - no reasoning information in stream")
print("\nVALIDATION: reasoning stream SUCCESS")
ErrorCode snippetfrom openai import OpenAI
client = OpenAI(api_key="***", base_url="https://internal.devtest.truefoundry.tech/api/llm")
response = client.chat.completions.create(
model="test-v2-aws-bedrock/us.anthropic.claude-fable-5",
messages=[
{"role": "system", "content": "You are a helpful assistant."},
{"role": "user", "content": "Hi"},
{"role": "assistant", "content": "Hi, how can I help you"},
{"role": "user", "content": "What is the capital of France?"},
],
max_tokens=1000,
temperature=1,
stream=False,
)
print(response.choices[0].message.content)
ErrorCode snippetfrom openai import OpenAI
client = OpenAI(api_key="***", base_url="https://internal.devtest.truefoundry.tech/api/llm")
response = client.chat.completions.create(
model="test-v2-aws-bedrock/us.anthropic.claude-fable-5",
messages=[
{"role": "system", "content": "You are a helpful assistant."},
{"role": "user", "content": "Hi"},
{"role": "assistant", "content": "Hi, how can I help you"},
{"role": "user", "content": "What is the capital of France?"},
],
max_tokens=1000,
temperature=1,
stream=True,
)
for chunk in response:
if chunk.choices and len(chunk.choices) > 0:
delta = chunk.choices[0].delta
if delta.content is not None:
print(delta.content, end="", flush=True)
ErrorCode snippetfrom openai import OpenAI
client = OpenAI(api_key="***", base_url="https://internal.devtest.truefoundry.tech/api/llm")
response = client.chat.completions.create(
model="test-v2-aws-bedrock/us.anthropic.claude-fable-5",
messages=[
{"role": "system", "content": "You are a helpful assistant. Respond in JSON format."},
{"role": "user", "content": "Hi"},
{"role": "assistant", "content": "Hi, how can I help you"},
{"role": "user", "content": "List 3 colors with their hex codes in JSON."},
],
response_format={"type": "json_object"},
stream=False,
)
import json as _json
_content = response.choices[0].message.content
print(_content)
if not _content:
raise Exception("VALIDATION FAILED: json-output - response content is empty")
_json.loads(_content)
print("VALIDATION: json-output SUCCESS")
ErrorCode snippetfrom openai import OpenAI
client = OpenAI(api_key="***", base_url="https://internal.devtest.truefoundry.tech/api/llm")
response = client.chat.completions.create(
model="test-v2-aws-bedrock/us.anthropic.claude-fable-5",
messages=[
{"role": "system", "content": "You are a helpful assistant. You MUST think step by step and show your reasoning. Never skip reasoning steps."},
{"role": "user", "content": "Hi"},
{"role": "assistant", "content": "Hi, how can I help you"},
{"role": "user", "content": "How to calculate 3^3^3^3? Think step by step and show all reasoning."},
],
reasoning_effort="medium",
stream=False,
)
_usage = getattr(response, "usage", None)
_reasoning_detected = False
_choices = getattr(response, "choices", None)
if _choices and len(_choices) > 0:
_message = getattr(_choices[0], "message", None)
else:
_message = None
if _message and getattr(_message, "content", None) is not None:
print(_message.content)
if _usage is not None:
_output_token_details = getattr(_usage, "completion_tokens_details", None)
if _output_token_details and getattr(_output_token_details, "reasoning_tokens", 0) > 0:
_reasoning_detected = True
elif getattr(_usage, "reasoning", None) is not None:
_reasoning_detected = True
if getattr(_message, "reasoning_content", None) is not None:
_reasoning_detected = True
elif getattr(_message, "reasoning", None) is not None:
_reasoning_detected = True
if not _reasoning_detected:
print("Response: ", response)
raise Exception("VALIDATION FAILED: reasoning - no reasoning information in response")
print("VALIDATION: reasoning SUCCESS")
ErrorCode snippetfrom openai import OpenAI
import json
client = OpenAI(api_key="***", base_url="https://internal.devtest.truefoundry.tech/api/llm")
response_schema = json.loads('''{
"title": "CalendarEvent",
"type": "object",
"properties": {
"name": { "type": "string" },
"date": { "type": "string" },
"participants": {
"type": "array",
"items": { "type": "string" }
}
},
"required": ["name", "date", "participants"],
"additionalProperties": false
}''')
response = client.chat.completions.create(
model="test-v2-aws-bedrock/us.anthropic.claude-fable-5",
messages=[
{"role": "system", "content": "Extract the event information as JSON."},
{"role": "user", "content": "Hi"},
{"role": "assistant", "content": "Hi, how can I help you"},
{"role": "user", "content": "Alice and Bob are going to a science fair on Friday. Extract the event details as JSON."},
],
response_format={"type": "json_schema", "json_schema": {"name": "CalendarEvent", "schema": response_schema}},
stream=True,
)
import json as _json
_accumulated = ""
for chunk in response:
if chunk.choices and len(chunk.choices) > 0:
delta = chunk.choices[0].delta
if delta.content is not None:
_accumulated += delta.content
print(delta.content, end="", flush=True)
if not _accumulated:
raise Exception("VALIDATION FAILED: structured-output stream - no content received")
_parsed = _json.loads(_accumulated)
if "name" not in _parsed or "date" not in _parsed or "participants" not in _parsed:
raise Exception("VALIDATION FAILED: structured-output stream - missing expected fields (name, date, participants)")
if not isinstance(_parsed.get("participants"), list):
raise Exception("VALIDATION FAILED: structured-output stream - 'participants' is not a list, schema not enforced")
if set(_parsed.keys()) != {"name", "date", "participants"}:
raise Exception(
f"VALIDATION FAILED: structured-output stream - unexpected keys present: {set(_parsed.keys())}"
)
print("\nVALIDATION: structured-output stream SUCCESS")Skipped (2)
Skip reason
Skip reason |


Auto-generated by model-addition-agent for
aws-bedrock/us.anthropic.claude-fable-5.Note
Low Risk
Catalog-only YAML addition with no runtime or auth changes; main review surface is correct pricing, limits, and param bounds (notably temperature/top_p min=max defaults).
Overview
Adds a new AWS Bedrock provider definition for
us.anthropic.claude-fable-5, registering Claude Fable 5 for routing, pricing, and capability metadata.The entry marks the model active and serverless, with 1M context, up to 128K output tokens, text/image input, and thinking enabled. It lists standard Claude chat features (tools, prompt caching, structured/JSON output, etc.) and per-region token costs (including cache read/write) for us-west-2, us-west-1, us-east-1, ca-west-1, and ca-central-1.
Reviewed by Cursor Bugbot for commit 1e58aca. Bugbot is set up for automated code reviews on this repo. Configure here.