[!Note] This is the Eagle model of the Mistral Medium 3.5 model to perform speculative decoding. Click here to access themistralai/Mistral-Medium-3.5-128Bweights.
'none' → Do not use reasoning'high' → Use reasoning (recommended for complex prompts and agentic usage)
Use reasoning_effort="high" for complex tasks and agentic coding.reasoning_effort="high". Temp between 0.0 and 0.7 for reasoning_effort="none" depending on the task.
Generally, lower means answer that are more to the point and higher allows the model to be more creative. It is a good practice to try different values in order to
improve the model performance to meet your demands.uv pip install -U vllm \
--torch-backend=auto \
--extra-index-url https://wheels.vllm.ai/nightlymistral_common >= 1.11.1 and transformers >= 5.4.0.python -c "import mistral_common; print(mistral_common.__version__)"
python -c "import transformers; print(transformers.__version__)"1vllm serve mistralai/Mistral-Medium-3.5-128B --tensor-parallel-size 8 \
2 --tool-call-parser mistral --enable-auto-tool-choice --reasoning-parser mistral --max_num_batched_tokens 16384 --max_num_seqs 128 \
3 --gpu_memory_utilization 0.8 --speculative_config '{
4 "model": "mistralai/Mistral-Medium-3.5-128B-EAGLE",
5 "num_speculative_tokens": 3,
6 "method": "eagle",
7 "max_model_len": "65536"
8 }'docker pull lmsysorg/sglang:dev-mistral-medium-3.5 # H100 / H200 (Hopper, CUDA 12.9)
docker pull lmsysorg/sglang:dev-cu13-mistral-medium-3.5 # B200 / B300 (Blackwell, CUDA 13.0)transformers >= 5.4.0.1python -m sglang.launch_server --model-path mistralai/Mistral-Medium-3.5-128B \
2 --tp 8 --dtype bfloat16 --tool-call-parser mistral --reasoning-parser mistral \
3 --speculative-algorithm EAGLE \
4 --speculative-draft-model-path mistralai/Mistral-Medium-3.5-128B-EAGLE \
5 --speculative-num-steps 3 --speculative-eagle-topk 1 --speculative-num-draft-tokens 41from datetime import datetime, timedelta
2
3from openai import OpenAI
4from huggingface_hub import hf_hub_download
5
6# Modify OpenAI's API key and API base to use vLLM's API server.
7openai_api_key = "EMPTY"
8openai_api_base = "http://localhost:8000/v1"
9
10TEMP = 0.1
11# use TEMP = 0.7 for reasoning="high"
12
13client = OpenAI(
14 api_key=openai_api_key,
15 base_url=openai_api_base,
16)
17
18models = client.models.list()
19model = models.data[0].id
20
21
22def load_system_prompt(repo_id: str, filename: str) -> str:
23 file_path = hf_hub_download(repo_id=repo_id, filename=filename)
24 with open(file_path, "r") as file:
25 system_prompt = file.read()
26 today = datetime.today().strftime("%Y-%m-%d")
27 yesterday = (datetime.today() - timedelta(days=1)).strftime("%Y-%m-%d")
28 model_name = repo_id.split("/")[-1]
29 return system_prompt.format(name=model_name, today=today, yesterday=yesterday)
30
31
32SYSTEM_PROMPT = load_system_prompt(model, "SYSTEM_PROMPT.txt")
33
34messages = [
35 {"role": "system", "content": SYSTEM_PROMPT},
36 {
37 "role": "user",
38 "content": "Write me a sentence where every word starts with the next letter in the alphabet - start with 'a' and end with 'z'.",
39 },
40]
41
42response = client.chat.completions.create(
43 model=model,
44 messages=messages,
45 temperature=TEMP,
46 reasoning_effort="none",
47)
48
49assistant_message = response.choices[0].message.content
50print(assistant_message)1import json
2from datetime import datetime, timedelta
3
4from openai import OpenAI
5from huggingface_hub import hf_hub_download
6
7# Modify OpenAI's API key and API base to use vLLM's API server.
8openai_api_key = "EMPTY"
9openai_api_base = "http://localhost:8000/v1"
10
11TEMP = 0.1
12
13client = OpenAI(
14 api_key=openai_api_key,
15 base_url=openai_api_base,
16)
17
18models = client.models.list()
19model = models.data[0].id
20
21
22def load_system_prompt(repo_id: str, filename: str) -> str:
23 file_path = hf_hub_download(repo_id=repo_id, filename=filename)
24 with open(file_path, "r") as file:
25 system_prompt = file.read()
26 today = datetime.today().strftime("%Y-%m-%d")
27 yesterday = (datetime.today() - timedelta(days=1)).strftime("%Y-%m-%d")
28 model_name = repo_id.split("/")[-1]
29 return system_prompt.format(name=model_name, today=today, yesterday=yesterday)
30
31
32SYSTEM_PROMPT = load_system_prompt(model, "SYSTEM_PROMPT.txt")
33
34image_url = "https://math-coaching.com/img/fiche/46/expressions-mathematiques.jpg"
35
36
37def my_calculator(expression: str) -> str:
38 return str(eval(expression))
39
40
41tools = [
42 {
43 "type": "function",
44 "function": {
45 "name": "my_calculator",
46 "description": "A calculator that can evaluate a mathematical expression.",
47 "parameters": {
48 "type": "object",
49 "properties": {
50 "expression": {
51 "type": "string",
52 "description": "The mathematical expression to evaluate.",
53 },
54 },
55 "required": ["expression"],
56 },
57 },
58 },
59 {
60 "type": "function",
61 "function": {
62 "name": "rewrite",
63 "description": "Rewrite a given text for improved clarity",
64 "parameters": {
65 "type": "object",
66 "properties": {
67 "text": {
68 "type": "string",
69 "description": "The input text to rewrite",
70 }
71 },
72 },
73 },
74 },
75]
76
77messages = [
78 {"role": "system", "content": SYSTEM_PROMPT},
79 {
80 "role": "user",
81 "content": [
82 {
83 "type": "text",
84 "text": "Thanks to your calculator, compute the results for the equations that involve numbers displayed in the image.",
85 },
86 {
87 "type": "image_url",
88 "image_url": {
89 "url": image_url,
90 },
91 },
92 ],
93 },
94]
95
96response = client.chat.completions.create(
97 model=model,
98 messages=messages,
99 temperature=TEMP,
100 tools=tools,
101 tool_choice="auto",
102 reasoning_effort="none",
103)
104
105tool_calls = response.choices[0].message.tool_calls
106
107results = []
108for tool_call in tool_calls:
109 function_name = tool_call.function.name
110 function_args = tool_call.function.arguments
111 if function_name == "my_calculator":
112 result = my_calculator(**json.loads(function_args))
113 results.append(result)
114
115messages.append({"role": "assistant", "tool_calls": tool_calls})
116for tool_call, result in zip(tool_calls, results):
117 messages.append(
118 {
119 "role": "tool",
120 "tool_call_id": tool_call.id,
121 "name": tool_call.function.name,
122 "content": result,
123 }
124 )
125
126
127response = client.chat.completions.create(
128 model=model,
129 messages=messages,
130 temperature=TEMP,
131 reasoning_effort="none",
132)
133
134print(response.choices[0].message.content)1from datetime import datetime, timedelta
2
3from openai import OpenAI
4from huggingface_hub import hf_hub_download
5
6# Modify OpenAI's API key and API base to use vLLM's API server.
7openai_api_key = "EMPTY"
8openai_api_base = "http://localhost:8000/v1"
9
10TEMP = 0.7
11
12client = OpenAI(
13 api_key=openai_api_key,
14 base_url=openai_api_base,
15)
16
17models = client.models.list()
18model = models.data[0].id
19
20
21def load_system_prompt(repo_id: str, filename: str) -> str:
22 file_path = hf_hub_download(repo_id=repo_id, filename=filename)
23 with open(file_path, "r") as file:
24 system_prompt = file.read()
25 today = datetime.today().strftime("%Y-%m-%d")
26 yesterday = (datetime.today() - timedelta(days=1)).strftime("%Y-%m-%d")
27 model_name = repo_id.split("/")[-1]
28 return system_prompt.format(name=model_name, today=today, yesterday=yesterday)
29
30
31SYSTEM_PROMPT = load_system_prompt(model, "SYSTEM_PROMPT.txt")
32image_url = "https://static.wikia.nocookie.net/essentialsdocs/images/7/70/Battle.png/revision/latest?cb=20220523172438"
33
34messages = [
35 {"role": "system", "content": SYSTEM_PROMPT},
36 {
37 "role": "user",
38 "content": [
39 {
40 "type": "text",
41 "text": "What action do you think I should take in this situation? List all the possible actions and explain why you think they are good or bad.",
42 },
43 {"type": "image_url", "image_url": {"url": image_url}},
44 ],
45 },
46]
47
48
49response = client.chat.completions.create(
50 model=model,
51 messages=messages,
52 temperature=TEMP,
53 reasoning_effort="high",
54)
55
56print(response.choices[0].message.content)