feat(aws-bedrock): add new models [bot]#934
Conversation
|
/test-models |
There was a problem hiding this comment.
Cursor Bugbot has reviewed your changes and found 2 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 1ddc3b0. Configure here.
Gateway test results
Failures (8)
Error: Code 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/au.anthropic.claude-opus-4-7",
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")
Error: Code 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/au.anthropic.claude-opus-4-7",
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,
stream=False,
)
print(response.choices[0].message.content)
Error: Code 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/au.anthropic.claude-opus-4-7",
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")
Error: Code 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/au.anthropic.claude-opus-4-7",
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")
Error: Code snippetimport boto3
from botocore.config import Config
_endpoint = "https://internal.devtest.truefoundry.tech/api/llm/bedrock"
_api_key = "***"
_model = "test-v2-aws-bedrock/au.anthropic.claude-opus-4-7"
client = boto3.client(
"bedrock-runtime",
region_name="us-east-1",
endpoint_url=f"{_endpoint}/proxy",
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,
},
)
_content = response["output"]["message"]["content"]
for _block in _content:
if "text" in _block:
print(_block["text"])
Error: Code snippetimport boto3
from botocore.config import Config
_endpoint = "https://internal.devtest.truefoundry.tech/api/llm/bedrock"
_api_key = "***"
_model = "test-v2-aws-bedrock/au.anthropic.claude-opus-4-7"
client = boto3.client(
"bedrock-runtime",
region_name="us-east-1",
endpoint_url=f"{_endpoint}/proxy",
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)}")
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))
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")
Error: Code snippetimport boto3
from botocore.config import Config
_endpoint = "https://internal.devtest.truefoundry.tech/api/llm/bedrock"
_api_key = "***"
_model = "test-v2-aws-bedrock/au.anthropic.claude-opus-4-7"
client = boto3.client(
"bedrock-runtime",
region_name="us-east-1",
endpoint_url=f"{_endpoint}/proxy",
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 "text" in _block:
print(_block["text"])
if "reasoningContent" in _block:
_reasoning_detected = True
_reasoning = _block["reasoningContent"]
if "reasoningText" in _reasoning:
print(f"Reasoning: {_reasoning['reasoningText']['text'][:200]}...")
_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")
Error: Code snippetimport boto3
from botocore.config import Config
_endpoint = "https://internal.devtest.truefoundry.tech/api/llm/bedrock"
_api_key = "***"
_model = "test-v2-aws-bedrock/au.anthropic.claude-opus-4-7"
client = boto3.client(
"bedrock-runtime",
region_name="us-east-1",
endpoint_url=f"{_endpoint}/proxy",
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 _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))
if not _tool_uses:
raise Exception("VALIDATION FAILED: tool-call - no tool uses in Bedrock response")
print("VALIDATION: tool-call SUCCESS")Skipped (8)
Skip reason:
Skip reason:
Skip reason:
Skip reason:
Skip reason:
Skip reason:
Skip reason:
Skip reason: |
|
/test-models |
Gateway test results
Failures (1)
Error: Code 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/au.anthropic.claude-opus-4-7",
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") |
|
/test-models |
Gateway test results
Failures (1)
Error: Code 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/au.anthropic.claude-opus-4-7",
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") |

Auto-generated by model-addition-agent for provider
aws-bedrock.Note
Low Risk
Low risk: adds a new AWS Bedrock model metadata YAML without changing runtime logic; main risk is incorrect pricing/limits/feature flags affecting model selection or cost estimates.
Overview
Adds a new AWS Bedrock model definition
au.anthropic.claude-opus-4-7.yaml, enabling the AU Claude Opus 4.7 variant to be discovered/used with declared token pricing (incl. prompt caching) forap-southeast-2andap-southeast-4.The model config also specifies supported capabilities (tool/function calling, cache controls, system messages, assistant prefill), large context/output limits, and parameter handling (sets
max_tokensdefaults and removestemperature/top_p), withthinking: trueandstatus: active.Reviewed by Cursor Bugbot for commit 1251011. Bugbot is set up for automated code reviews on this repo. Configure here.