iTerm2’s Composer AI works fine against Mistral’s API. AI Chat, however, fails. After extensive debugging through a LiteLLM proxy, the root cause turns out to be that iTerm2’s AI Chat sends tool definitions using OpenAI’s legacy functions / function_call fields, which OpenAI itself deprecated in mid‑2023 in favour of tools / tool_choice. Mistral (and most non‑OpenAI providers) never implemented the legacy schema and reject the request, so tool calling silently degrades — the model just prints execute_command: {...} as plain text instead of issuing a real tool call iTerm2 can intercept and execute.
Direct symptoms in iTerm2In other words: iTerm2’s AI Chat appears to send only functions[], not the modern tools[] array. So when functions[] is stripped (which is the only way to get past Mistral’s validator), the model has no tool schema at all and falls back to imitating tool‑call syntax in prose.
What I tried (timeline)iTerm2’s AI Chat builds its outgoing request using the pre‑June‑2023 OpenAI function‑calling format:
{ "model": "...", "messages": [...], "functions": [ { "name": "execute_command", "description": "...", "parameters": {...} }, ... ], "function_call": "auto" }The modern format (which Mistral, Anthropic, Gemini, Groq, Together, Fireworks, and basically every non‑OpenAI provider implements) is:
{ "model": "...", "messages": [...], "tools": [ { "type": "function", "function": { "name": "execute_command", "description": "...", "parameters": {...} } } ], "tool_choice": "auto" }Because iTerm2 only emits the legacy shape, AI Chat tool calls are effectively OpenAI‑only. Anyone configuring AI Chat against a non‑OpenAI Chat Completions endpoint either gets a 422 (provider validates and rejects unknown fields) or a silent regression to text‑only chat (provider ignores unknown fields).
Composer works against Mistral because it doesn’t use tool calling — it’s a single‑shot text completion.
Requested fixUpdate iTerm2’s AI Chat to emit tool definitions in the modern tools / tool_choice format. OpenAI’s API still accepts this form (it’s now the canonical one), so the change is backward‑compatible for OpenAI users while immediately unlocking AI Chat for every other OpenAI‑compatible provider — Mistral, Anthropic via OpenAI‑shim, Gemini, Groq, OpenRouter, LM Studio, Ollama, vLLM, etc.
Optionally: expose a setting like “Use legacy functions API” (default off) for anyone pinned to a very old OpenAI‑compatible endpoint.
--
You received this message because you are subscribed to the Google Groups "iterm2-discuss" group.
To unsubscribe from this group and stop receiving emails from it, send an email to iterm2-discus...@googlegroups.com.
To view this discussion visit https://groups.google.com/d/msgid/iterm2-discuss/e5438ddb-0053-4dcd-8622-41ee03310e51n%40googlegroups.com.