feat(anthropic): update model YAMLs [bot]#1046
Closed
models-bot[bot] wants to merge 1 commit into
Closed
Conversation
Contributor
|
/test-models |
Collaborator
Gateway test results
Failures (10)
Error: Code snippetimport anthropic
_api_key = "***"
_model = "test-v2-anthropic/claude-opus-4-7"
client = anthropic.Anthropic(
api_key=_api_key,
base_url="https://internal.devtest.truefoundry.tech/api/llm",
)
tools = [
{
"name": "get_weather",
"description": "Get the current weather for a location.",
"input_schema": {
"type": "object",
"properties": {
"location": {
"type": "string",
"description": "The city name, e.g. London",
},
},
"required": ["location"],
},
},
]
messages = [
{"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."},
]
response = client.messages.create(
model=_model,
system="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.",
messages=messages,
tools=tools,
tool_choice={"type": "auto"},
max_tokens=1024,
)
for block in response.content:
if block.type == "tool_use":
print(f"Tool: {block.name}")
print(f"Input: {block.input}")
elif block.type == "text":
print(block.text)
_tool_uses = [block for block in response.content if block.type == "tool_use"]
if _tool_uses:
for _tu in _tool_uses:
print(f"Tool: {_tu.name}")
print(f"Input: {_tu.input}")
else:
_text_blocks = [block.text for block in response.content if block.type == "text"]
print("\n".join(_text_blocks))
if not _tool_uses:
raise Exception("VALIDATION FAILED: tool-call - no tool uses in Anthropic response")
print("VALIDATION: tool-call SUCCESS")
Error: Code snippetimport anthropic
_api_key = "***"
_model = "test-v2-anthropic/claude-opus-4-7"
client = anthropic.Anthropic(
api_key=_api_key,
base_url="https://internal.devtest.truefoundry.tech/api/llm",
)
messages = [
{"role": "user", "content": "Hi"},
{"role": "assistant", "content": "Hi, how can I help you"},
{"role": "user", "content": "What is the capital of France?"},
]
response = client.messages.create(
model=_model,
system="You are a helpful assistant.",
messages=messages,
max_tokens=256,
)
for block in response.content:
if block.type == "text":
print(block.text)
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-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")
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-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 snippetimport anthropic
_api_key = "***"
_model = "test-v2-anthropic/claude-opus-4-7"
client = anthropic.Anthropic(
api_key=_api_key,
base_url="https://internal.devtest.truefoundry.tech/api/llm",
)
tools = [
{
"name": "get_weather",
"description": "Get the current weather for a location.",
"input_schema": {
"type": "object",
"properties": {
"location": {
"type": "string",
"description": "The city name, e.g. London",
},
},
"required": ["location"],
},
},
]
messages = [
{"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."},
]
response = client.messages.create(
model=_model,
system="You are a helpful assistant with access to tools. You MUST strictly call multiple tools in parallel whenever possible. Never call them sequentially.",
messages=messages,
tools=tools,
tool_choice={"type": "auto"},
max_tokens=1024,
)
for block in response.content:
if block.type == "tool_use":
print(f"Tool: {block.name}")
print(f"Input: {block.input}")
elif block.type == "text":
print(block.text)
_tool_uses = [block for block in response.content if block.type == "tool_use"]
if _tool_uses:
print(f"Number of parallel tool calls: {len(_tool_uses)}")
for _tu in _tool_uses:
print(f"Tool: {_tu.name}")
print(f"Input: {_tu.input}")
else:
_text_blocks = [block.text for block in response.content if block.type == "text"]
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 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-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=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")
Error: Code snippetimport anthropic
import json
_api_key = "***"
_model = "test-v2-anthropic/claude-opus-4-7"
client = anthropic.Anthropic(
api_key=_api_key,
base_url="https://internal.devtest.truefoundry.tech/api/llm",
)
response_schema = {
"type": "object",
"properties": {
"name": {"type": "string"},
"date": {"type": "string"},
"participants": {
"type": "array",
"items": {"type": "string"},
},
},
"required": ["name", "date", "participants"],
}
tools = [
{
"name": "CalendarEvent",
"description": "Extract event information as a structured CalendarEvent.",
"input_schema": response_schema,
},
]
messages = [
{"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."},
]
response = client.messages.create(
model=_model,
system="Extract the event information using the CalendarEvent tool.",
messages=messages,
tools=tools,
tool_choice={"type": "tool", "name": "CalendarEvent"},
max_tokens=1024,
)
for block in response.content:
if block.type == "tool_use":
print(json.dumps(block.input, indent=2))
elif block.type == "text":
print(block.text)
import json as _json
_tool_uses = [block for block in response.content if block.type == "tool_use"]
if _tool_uses:
_parsed = _tool_uses[0].input
else:
_text_blocks = [block.text for block in response.content if block.type == "text"]
_text = "".join(_text_blocks)
_parsed = _json.loads(_text)
print(_json.dumps(_parsed, indent=2))
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")
Error: Code 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-anthropic/claude-opus-4-7",
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")
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-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=256,
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)
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-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=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") |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Auto-generated by poc-agent for provider
anthropic.Note
Low Risk
Low risk config-only change that adds a new pricing field; main risk is mispricing if downstream parsers don’t recognize the new key.
Overview
Updates the Anthropic model config for
claude-opus-4-7to includecache_creation_input_token_cost_per_hour, extending the pricing metadata used for prompt caching cost calculations.Reviewed by Cursor Bugbot for commit 0d679b6. Bugbot is set up for automated code reviews on this repo. Configure here.