Run frontier MoE models on hardware you already own — pure C, zero deps, experts streamed from disk. Tiny engine, immense model. 🐦
C
api: refuse unsupported OpenAI result shaping
Benito Mallamaci5ceed4bf5ded
diff --git a/c/openai_server.py b/c/openai_server.pyindex 9d595ac9..93738163 100644--- a/c/openai_server.py+++ b/c/openai_server.py@@ -3119,6 +3119,21 @@ class ToolSideband:def generation_options(body, limit):if body.get("n", 1) != 1:raise APIError(400, "Colibri currently supports `n=1` only.", "n", "unsupported_value")+ best_of = body.get("best_of", 1)+ if best_of not in (None, 1):+ raise APIError(400, "Colibri currently supports `best_of` equal to 1 only.",+ "best_of", "unsupported_value")+ logit_bias = body.get("logit_bias")+ if logit_bias not in (None, {}):+ raise APIError(400, "Colibri does not support a non-empty `logit_bias` yet.",+ "logit_bias", "unsupported_value")+ if body.get("suffix") is not None:+ raise APIError(400, "Colibri does not support `suffix` infill yet.",+ "suffix", "unsupported_parameter")+ modalities = body.get("modalities")+ if isinstance(modalities, list) and "audio" in modalities:+ raise APIError(400, "Colibri does not support audio output via `modalities`.",+ "modalities", "unsupported_value")# `tools`/`functions` are handled by render_chat (declaration) + parse_tool_calls (output).# Validate tools/functions structure early so malformed input fails with a clear error.tools_raw = body.get("tools") or body.get("functions")diff --git a/c/tests/test_openai_server.py b/c/tests/test_openai_server.pyindex e6af5a13..742bdf5d 100644--- a/c/tests/test_openai_server.py+++ b/c/tests/test_openai_server.py@@ -1627,6 +1627,49 @@ class BaseWireContractTest(unittest.TestCase):self.assertEqual(frames, [b"SUBMIT 1 0 11 4 0 0.9\nComplete me\n"])+class OpenAIHonestySetTest(unittest.TestCase):+ def test_refuses_unsupported_result_shaping_fields(self):+ cases = (+ ({"best_of": 2}, "best_of", "unsupported_value"),+ ({"logit_bias": {"42": 100}}, "logit_bias", "unsupported_value"),+ ({"suffix": " after"}, "suffix", "unsupported_parameter"),+ ({"modalities": ["audio"]}, "modalities", "unsupported_value"),+ )+ for fields, param, code in cases:+ with self.subTest(param=param), self.assertRaises(APIError) as caught:+ generation_options(fields, 16)+ self.assertEqual(caught.exception.status, 400)+ self.assertEqual(caught.exception.param, param)+ self.assertEqual(caught.exception.code, code)+ self.assertIn(f"`{param}`", caught.exception.message)++ def test_accepts_noop_values(self):+ generation_options({"best_of": 1, "logit_bias": {}, "suffix": None,+ "modalities": ["text"]}, 16)++ def test_intentionally_ignored_fields_return_200_and_do_not_reach_engine(self):+ base = {"model": "test-model", "prompt": "Complete me",+ "temperature": 0, "max_tokens": 4}+ ignored = {+ "store": True,+ "metadata": {"trace": "request-1"},+ "service_tier": "default",+ "user": "user-1",+ "safety_identifier": "safe-1",+ "parallel_tool_calls": True,+ "prompt_cache_key": "cache-1",+ "verbosity": "low",+ "web_search_options": {},+ "moderation": True,+ "stream_options": {"include_obfuscation": True},+ }+ status_plain, _, frames_plain = _capture_frames(base)+ status_ignored, _, frames_ignored = _capture_frames({**base, **ignored})+ self.assertEqual(status_plain, 200)+ self.assertEqual(status_ignored, 200)+ self.assertEqual(frames_ignored, frames_plain)++class SeedOptionTest(unittest.TestCase):"""`generation_options()` accepts a `seed` field without raising."""diff --git a/docs/api.md b/docs/api.mdindex 33a627fd..13615f00 100644--- a/docs/api.md+++ b/docs/api.md@@ -96,6 +96,15 @@ Audio is accepted only by Inkling checkpoints withaudio support. The default bind address is localhost; set `COLI_API_KEY` beforeexposing the server beyond the machine.+The hosted-platform bookkeeping fields `store`, `metadata`, `service_tier`,+`user`, `safety_identifier`, `parallel_tool_calls`, `prompt_cache_key`,+`verbosity`, `web_search_options`, `moderation`, and+`stream_options.include_obfuscation` are accepted and intentionally ignored:+they have no local equivalent and do not affect generation. Unsupported+result-shaping requests are refused explicitly: `best_of` values above 1, a+non-empty `logit_bias`, `suffix` infill, and audio output requested through+`modalities`.+### `seed``seed` is accepted (not rejected) for OpenAI-API request-shape compatibility;