[pull] main from danny-avila:main - #208
Merged
Merged
Conversation
* 🔭 fix: Derive the Gemini prefill rule from the model version `NO_PREFILL_GEMINI_MODELS` enumerated every Gemini model that rejects a trailing `model`-role turn, so each new Flash release needed an SDK edit and a publish before a downstream consumer could safely list the model. Gemini 3.8 Flash is the third model to hit this (after 3.6 and 3.7), and Google documents the same restriction for it. The Anthropic half of this SDK already derives the equivalent rule from the model version — `modelDisallowsAssistantPrefill` parses the minor version and compares it against 4.6 — which is why new Claude models need no change here. This brings Google in line: every Flash release from 3.6 onward is matched by version, so a future Flash model is covered on release. The 3.5 generation is the one case a cutoff cannot express: Gemini 3.5 Flash-Lite rejects prefill while its sibling Gemini 3.5 Flash still accepts it, so Flash-Lite stays an explicit entry and the list survives for exactly that kind of exception. Scoped to the Flash line deliberately. Dropping the turn silently degrades a working prefill into a fresh generation, so a false positive is worse than a false negative — the rule widens only where Google documents the restriction, and Pro ids are left alone. Tests pin the new coverage (3.8/3.9/3.10/4.0 Flash, prefixed and suffixed ids), the preserved 3.5 split, and that the rule does not widen to Pro lines or to near-miss ids like `gemini-3.7-flashy`. Ref: https://ai.google.dev/gemini-api/docs/latest-model#api-changes-and-parameter-updates Ref: https://ai.google.dev/gemini-api/docs/models/gemini-3.8-flash * 🩹 fix: Match major-only Gemini Flash ids in the prefill cutoff [Codex P2] The version pattern required a `.<minor>` component, but Google ships Flash under both forms — `gemini-3.7-flash` and the major-only `gemini-3-flash-preview`, which this repo already exercises in `src/llm/vertexai/llm.spec.ts` and LibreChat lists by default. So a future `gemini-4-flash` would not have matched, `rejectsModelTurnPrefill` would have returned false, and the trailing model turn would have been sent — the exact HTTP 400 the cutoff exists to prevent. Make the minor component optional and read an omitted one as `.0`. No behavior change for ids already covered: `gemini-3-flash-preview` reads as 3.0, below the 3.6 cutoff, so it keeps returning false as before. `Number(match[2] || '0')` rather than a null check because TypeScript types an optional capture group as `string`, so `!= null` trips `@typescript-eslint/no-unnecessary-condition` even though an unmatched group is `undefined` at runtime.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to subscribe to this conversation on GitHub.
Already have an account?
Sign in.
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
See Commits and Changes for more details.
Created by
pull[bot] (v2.0.0-alpha.4)
Can you help keep this open source service alive? 💖 Please sponsor : )