From 293d9ceab20b6352ef5a61363fb17259d7883ce2 Mon Sep 17 00:00:00 2001 From: Romain Lapray Date: Thu, 6 Aug 2026 00:49:40 +0200 Subject: [PATCH] Don't send the `developer` role to Ollama. Ollama Cloud returns a 500 for any request that carries both a `developer` role message and an image. The same request succeeds with `system`, and text-only requests with `developer` are fine, so the two only conflict together. pi selects the `developer` role whenever a model reports reasoning support, and the ollama case hardcodes `reasoning: true` for every model, so every image sent to a vision model like gemma4:31b-cloud failed. The case carried no `compat` at all and therefore inherited pi's OpenAI-shaped defaults; Workers AI already pins the same flag just above. Pin the role rather than the `reasoning` capability, which is reported unconditionally and would disable thinking for ollama models that do support it. Co-Authored-By: Claude Opus 5 (1M context) Claude-Session: https://claude.ai/code/session_01SetKoutv8UUpQn2MeV66RF --- packages/workshop-backend/src/ai-models.ts | 3 +++ 1 file changed, 3 insertions(+) diff --git a/packages/workshop-backend/src/ai-models.ts b/packages/workshop-backend/src/ai-models.ts index 25d1b759..0654e283 100644 --- a/packages/workshop-backend/src/ai-models.ts +++ b/packages/workshop-backend/src/ai-models.ts @@ -563,6 +563,9 @@ function getModelDirect(config: AiModelConfig, sessionAffinity?: string): ModelH input: ["text", "image"], cost: ZERO_COST, ...window, + // Ollama Cloud 500s when a request carries both a `developer` message and an image; pi + // picks that role because we report reasoning: true above, so pin the role, not the flag. + compat: { supportsDeveloperRole: false } satisfies OpenAICompletionsCompat, }, ...(config.apiToken === "" ? { apiKey: "unused", headers: { Authorization: null } }