feat(mistral-ai/devstral-medium-251121): add new models [bot]#1228
feat(mistral-ai/devstral-medium-251121): add new models [bot]#1228models-bot[bot] wants to merge 2 commits into
Conversation
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 eb758b9. Configure here.
|
/test-models |
Gateway test results
Failures (8)
ErrorCode snippetimport boto3
from botocore.config import Config
_endpoint = "https://internal.devtest.truefoundry.tech/api/llm"
_api_key = "***"
_model = "test-v2-mistral-ai/devstral-medium-251121"
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": 256,
"temperature": 0.2,
},
)
_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-mistral-ai/devstral-medium-251121"
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": 256,
"temperature": 0.2,
},
)
_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-mistral-ai/devstral-medium-251121"
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
print(f"Tool: {_start['toolUse'].get('name', '')}", flush=True)
if "contentBlockDelta" in _event:
_delta = _event["contentBlockDelta"].get("delta", {})
if "toolUse" in _delta:
_tool_use_detected = True
print(_delta["toolUse"].get("input", ""), end="", flush=True)
if "text" in _delta:
print(_delta["text"], end="", flush=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-mistral-ai/devstral-medium-251121"
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 _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")
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-mistral-ai/devstral-medium-251121",
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,
temperature=0.2,
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")
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-mistral-ai/devstral-medium-251121",
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")
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-mistral-ai/devstral-medium-251121",
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")
response = client.chat.completions.create(
model="test-v2-mistral-ai/devstral-medium-251121",
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,
temperature=0.2,
stream=False,
)
print(response.choices[0].message.content) |

Auto-generated by model-addition-agent for
mistral-ai/devstral-medium-251121.Note
Low Risk
Metadata-only addition with no runtime or auth changes; main risk is incorrect pricing or capability flags affecting billing/routing.
Overview
Adds a new provider catalog entry for
devstral-medium-251121underproviders/mistral-ai/, enabling routing and billing for this Mistral Devstral Medium snapshot.The definition marks the model active for chat with function calling, 262144 context, text-only input/output, default temperature 0.2, and token costs 4e-7 input / 0.000002 output (global region)—aligned with the existing
devstral-medium-latestpricing pattern rather than the deprecateddevstral-medium-2507snapshot.Reviewed by Cursor Bugbot for commit acba19d. Bugbot is set up for automated code reviews on this repo. Configure here.