Conversation
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
This branch was successfully deployed
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 join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
Summary
Chat requests no longer hard-fail on Bedrock Opus 4.7/4.8 model IDs when the
TEMPERATUREenv var is set.app/api/chat/route.tsused to spreadtemperature: parseFloat(process.env.TEMPERATURE)into everystreamTextcall unconditionally; these models reject the parameter outright, so every request failed. The spread is now gated on a newsupportsTemperature(modelId)helper inlib/ai-providers.ts, and a[Temperature] SKIPPED for model: ...log line (mirroring the existing[Prompt Caching]log) tells operators when their setting was ignored instead of failing the request.Why this matters
The reporter in #861 hit
undefined: The model returned the following errors: temperature is deprecated for this modelon every chat request. The hosted demo was fixed on the deployment side by unsettingTEMPERATURE, but the code path is unchanged, so any self-hosted deployment withTEMPERATUREset still breaks the moment it points at an Opus 4.7/4.8 model ID. Making the code model-aware fixes it for every operator instead of requiring each one to discover the env-var workaround.The helper matches the plain, Bedrock inference-profile, and version-suffixed ID forms:
and defaults to
truefor unknown models so nothing else changes behavior — the same conservative capability-matching approachsupportsPromptCachingalready takes.env.examplegets a one-line note thatTEMPERATUREis ignored automatically for models that reject it.Testing
Added
tests/unit/ai-providers.test.tscases forsupportsTemperature: Opus 4.7/4.8 in plain, Bedrock-prefixed, and version-suffixed forms return false; older model IDs, non-Anthropic IDs, and unknown model strings return true. Ran the unit suite, formatting check, and TypeScript compilation — all pass.Closes #861
AI was used for assistance.