Run frontier MoE models on hardware you already own — pure C, zero deps, experts streamed from disk. Tiny engine, immense model. 🐦
C
Merge pull request #1783 from kevin9327/fix/glm53-text-part-type
Vincenzo Fornaro1a39d82a0b57
diff --cc c/tests/test_openai_server.pyindex 47c77e6c,7140657a..380edd50--- a/c/tests/test_openai_server.py+++ b/c/tests/test_openai_server.py@@@ -2315,42 -2315,36 +2315,71 @@@ class HTTPTest(unittest.TestCase)self.assertEqual(response.status, 200)self.assertEqual(json.load(response)["object"], "chat.completion")+ def test_a_past_tool_call_whose_function_is_not_an_object_is_a_client_error(self):+ """A replayed tool call with `function: "search"` answered HTTP 500.++ The fallback, Kimi and Qwen3.8 renderers already answer 400. GLM, GLM-5.3+ and DeepSeek V4/V4.1 called .get() on the value, and the AttributeError+ became do_POST's 500 "The colibri engine failed to process the request."+ """+ def history(function):+ return {"model": "test-model", "messages": [+ {"role": "user", "content": "run it"},+ {"role": "assistant", "content": "", "tool_calls": [+ {"id": "x", "type": "function", "function": function}]},+ {"role": "tool", "tool_call_id": "x", "content": "done"},+ {"role": "user", "content": "and now?"},+ ]}+ cases = [("search", "messages.1.tool_calls.0.function"),+ (["search"], "messages.1.tool_calls.0.function"),+ (5, "messages.1.tool_calls.0.function"),+ (None, "messages.1.tool_calls.0.function"),+ ({"name": 5, "arguments": "{}"}, "messages.1.tool_calls.0.function.name")]+ for arch in ("glm", "glm53", "deepseek_v4", "deepseek_v41"):+ for function, param in cases:+ with self.subTest(arch=arch, function=function):+ with patch("openai_server.ARCH", arch):+ with self.assertRaises(HTTPError) as caught:+ self.request("/v1/chat/completions", history(function))+ self.addCleanup(caught.exception.close)+ self.assertEqual(caught.exception.code, 400)+ self.assertEqual(json.loads(caught.exception.read())["error"]["param"], param)+ with self.subTest(arch=arch, function="well formed"):+ with patch("openai_server.ARCH", arch):+ with self.request("/v1/chat/completions",+ history({"name": "fn", "arguments": "{}"})) as response:+ self.assertEqual(response.status, 200)++ def test_a_text_part_whose_text_is_not_a_string_is_a_client_error(self):+ """{"type": "text", "text": 5} answered HTTP 500 on GLM-5.3, Qwen3.8 and V4.1.++ The other renderers read content through content_text(), which already+ answers 400. The image expanders of these three, and the GLM-5.3+ renderer, join the text parts themselves, and "".join raised TypeError,+ which do_POST turns into its catch-all 500.+ """+ def request(text):+ return {"model": "test-model",+ "messages": [{"role": "user", "content": [+ {"type": "text", "text": "look at "},+ {"type": "text", "text": text}]}]}+ for arch in ("glm53", "qwen38", "deepseek_v41"):+ for text in (5, None, ["hi"], {"value": "hi"}):+ with self.subTest(arch=arch, text=text):+ with patch("openai_server.ARCH", arch):+ with self.assertRaises(HTTPError) as caught:+ self.request("/v1/chat/completions", request(text))+ self.addCleanup(caught.exception.close)+ self.assertEqual(caught.exception.code, 400)+ self.assertEqual(json.loads(caught.exception.read())["error"]["param"],+ "messages.0.content.1.text")+ with self.subTest(arch=arch, text="well formed"):+ with patch("openai_server.ARCH", arch):+ with self.request("/v1/chat/completions", request("this")) as response:+ self.assertEqual(response.status, 200)+ self.assertIn("look at this", self.engine.calls[-1][0])+class ClientHangupTest(unittest.TestCase):"""A client that disconnects mid-response must not print a traceback.