feat: add temperature and other common settings to model-level configuration#388
Open
robert-j-y wants to merge 1 commit intomainfrom
Open
feat: add temperature and other common settings to model-level configuration#388robert-j-y wants to merge 1 commit intomainfrom
robert-j-y wants to merge 1 commit intomainfrom
Conversation
…uration Fixes #387 This change adds support for setting default values for common model parameters at the model creation level: - temperature - topP - topK - frequencyPenalty - presencePenalty - maxTokens These settings can be overridden at call time via generateText/streamText options. Example: ```typescript const model = openrouter('google/gemini-3-flash-preview', { temperature: 0, topP: 0.9, maxTokens: 100, }); ``` Co-Authored-By: Robert Yeakel <robert.yeakel@openrouter.ai>
|
ah, this is gonna be awesome to have. ty! |
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.
Description
Fixes #387
Adds support for setting default values for common model parameters at model creation time. Previously, settings like
temperaturecould only be passed at call time viagenerateText/streamText. Now users can set defaults when creating the model:Call-level options still override model-level settings when provided.
New settings added to
OpenRouterSharedSettings:temperature- Controls randomness (0-2)topP- Nucleus sampling (0-1)topK- Top-k samplingfrequencyPenalty- Penalize repeated tokens (-2 to 2)presencePenalty- Penalize tokens based on presence (-2 to 2)maxTokens- Maximum tokens to generateKey areas for review:
??) is used so call-levelundefinedfalls back to model settings, but explicit values always wintemperaturesettings inOpenRouterChatSettings. (Missing) #387Checklist
pnpm stylecheckandpnpm typecheckpnpm testand all tests passChangeset
pnpm changesetto create a changeset fileLink to Devin run: https://app.devin.ai/sessions/ad14476ac9334b8a962f771f56e48975
Requested by: Robert Yeakel (@robert-j-y)