Skip to content

fix: support native Mistral models beyond the bundled catalogue - #557

Open
DivyamTalwar wants to merge 1 commit into
twinnydotdev:mainfrom
DivyamTalwar:fix/mistral-current-model-identifiers
Open

DivyamTalwar wants to merge 1 commit into
twinnydotdev:mainfrom
DivyamTalwar:fix/mistral-current-model-identifiers

Conversation

@DivyamTalwar

@DivyamTalwar DivyamTalwar commented Oct 22, 2026 •

Copy link
Copy Markdown
Contributor

Summary

Fixes #546.

Mistral model IDs that are missing from fluency.js's bundled catalogue fail before reaching the service. This change lets the native Mistral API validate those IDs and discovers the models available to the configured account. Known models retain their existing streaming policy; manually supplied IDs remain usable even when discovery returns no models.

Not verified: live Mistral account and model-entitlement verification remains outstanding.

Changes

  • Route Mistral chat through fluency.js's open-ended handler at the fixed native https://api.mistral.ai/v1 endpoint. Credentials come from the configured key or MISTRAL_API_KEY; unrelated OpenAI credentials are not borrowed. No shared model catalogue is modified.
  • Preserve Mistral-specific request behavior for known and unknown IDs: system messages, tools, token limits, and the native handler's temperature / 2 conversion for both streaming and blocking requests. Other providers retain their existing temperature values. Mistral does not receive OpenAI-specific streaming-usage or reasoning controls.
  • Preserve Mistral's positional fallback for streamed tool-call fragments that omit an index, while honoring explicit indexes. Normalize text-part replies without stringifying content objects.
  • Discover models with authenticated GET /models, retaining advertised chat/FIM capabilities and context limits. Deduplicate IDs and preserve a successful empty response. Custom FIM endpoints retain their configured discovery address and credentials.
  • Bound discovery to six seconds, including response-body consumption, and propagate caller cancellation. Missing credentials, transport failures, temporary server failures, or the local deadline leave the offline chat catalogue available. Client HTTP errors and malformed replies remain visible; offline discovery does not invent FIM capability.

Validation

  • The final 31-test focused suite passed in the actual VS Code 1.143.0 test host on macOS. Test compilation, extension build, ESLint, and git diff --check also passed after the temperature and tool-fragment corrections.
  • The final tests exercise the real TokenJS/OpenAI SDK against a local HTTP server. They assert native destination and credentials, known/unknown IDs, nonzero 0.8 → 0.4 wire temperatures, system/tool payloads, SSE text and fragmented tool calls, discovery errors, deadline, cancellation, and catalogue isolation. Blocking request tests call the real SDK directly because all currently bundled Mistral models stream.
  • The recorded full suite before those final corrections was 865 passed, 4 pending, 4 failed. Three failures also reproduced on unchanged baseline: a hardcoded backup date, GNU sed usage on Mac, and missing made.txt. The fourth failure was an unchanged diagnostics test exceeding its original two-second timeout. A runner-only ten-second probe passed all its assertions in 2735 ms. The original full-suite failure remains disclosed; no diagnostics source or default timeout was changed.

Remaining validation

Live Mistral requests and account/model entitlements have not been tested. Local protocol fixtures verify request construction and response handling, but cannot establish that a particular account can use a particular model. Human review remains pending.

Let the native Mistral API validate current model IDs and discover account-visible chat/FIM models. Preserve Mistral request controls, streamed tool-call assembly, credentials, cancellation, and offline fallback semantics.

Signed-off-by: Divyam Talwar <divyamtalwar0@gmail.com>
@DivyamTalwar
DivyamTalwar force-pushed the fix/mistral-current-model-identifiers branch from acbdd11 to 3f58ef2 Compare November 22, 2026 19:59
@DivyamTalwar
DivyamTalwar marked this pull request as ready for review November 22, 2026 20:00
@DivyamTalwar

Copy link
Copy Markdown
Contributor Author

@m1ab0t rebased onto current main; tsc, build and eslint pass, and all Mistral tests pass in the extension suite. Out of draft and ready for your review.

@rjmacarthy rjmacarthy closed this Nov 30, 2026
@rjmacarthy rjmacarthy reopened this Nov 30, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Mistral provider doesn't work with certain Mistral models

2 participants