You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
error with m.get("role") when the message is a json #460
raw = req.get("messages", [])
if isinstance(raw, str):
try:
raw = json.loads(raw) # client double-encoded messages as a JSON string
except ValueError:
raw = []
if not isinstance(raw, list):
raw = [] # dict / number / None -> nothing to iterate
for m in raw:
# for m in req.get("messages", []):
role = m.get("role")
if role == "developer":
role = "system"
out = {"role": role, "content": _parts_of(m.get("content")) if role in ("user", "tool", "assistant") else _text_of(m.get("content"))}
if m.get("reasoning_content"):
out["reasoning_content"] = m["reasoning_content"]
if m.get("tool_calls"):
calls = []
for c in m["tool_calls"]:
if not isinstance(c, dict):
continue
fn = c.get("function", c)
args = fn.get("arguments")
if isinstance(args, str): # the template requires a mapping, not a JSON string
args = json.loads(args) if args.strip() else {}
calls.append({"function": {"name": fn.get("name"), "arguments": args or {}}})
out["tool_calls"] = calls
messages.append(out)
tools = [t.get("function", t) if isinstance(t, dict) and t.get("type") == "function" else t
for t in req.get("tools") or []] or None
kwargs = {}
# OpenAI Chat Completions: "reasoning_effort"; Responses style: "reasoning": {"effort": ...}
reasoning = req.get("reasoning") if isinstance(req.get("reasoning"), dict) else {}
kwargs.update(effort_kwargs(req.get("reasoning_effort") or reasoning.get("effort")))
# the vLLM / llama.cpp convention: {"chat_template_kwargs": {"enable_thinking": false, "reasoning_effort": "low"}}
for k, v in (req.get("chat_template_kwargs") or {}).items():
if k == "enable_thinking" and not v:
kwargs = {"enable_thinking": False}
elif k == "reasoning_effort" and "enable_thinking" not in kwargs:
kwargs.update(effort_kwargs(v))
return _late_system_to_user(messages), tools, kwargs
Fixed in 0.1.35: messages sent as a JSON string is decoded, and a list with non-object entries gets a 400 with a clear message. Both APIs, with tests. Thanks for the patch! Run START-HERE.bat (Linux: ./setup.sh) once to update.
Activity
serve: "messages" sent as a JSON string is decoded; a non-object entr…
Niko1221 commentedon Oct 2, 2026
Fixed in 0.1.35:
messagessent as a JSON string is decoded, and a list with non-object entries gets a 400 with a clear message. Both APIs, with tests. Thanks for the patch! RunSTART-HERE.bat(Linux:./setup.sh) once to update.Engine 0.1.35: Windows AMD uses its bundled HIP runtime (Niko1221#468 N…
serve: "messages" sent as a JSON string is decoded; a non-object entr…
Engine 0.1.35: Windows AMD uses its bundled HIP runtime (#468 #461), …
serve: "messages" sent as a JSON string is decoded; a non-object entr…
Engine 0.1.35: Windows AMD uses its bundled HIP runtime (Niko1221#468 N…
serve: "messages" sent as a JSON string is decoded; a non-object entr…
Engine 0.1.35: Windows AMD uses its bundled HIP runtime (Niko1221#468 N…