Skip to content

feat (ai): allow using provider default temperature by specifying null#5890

Merged
lgrammel merged 6 commits intov5from
lg/oYLum7XJ
Apr 22, 2025
Merged

feat (ai): allow using provider default temperature by specifying null#5890
lgrammel merged 6 commits intov5from
lg/oYLum7XJ

Conversation

@lgrammel
Copy link
Copy Markdown
Collaborator

@lgrammel lgrammel commented Apr 22, 2025

Background

For many models, 0 temperature is a great default, because it leads to more stable outputs. However, certain models, in particular reasoning models, require the temperature to be undefined or 1. We reset those values automatically in the providers based on the model, but it is also desirable to have a way to reset the temperature to the provider default.

Summary

Enable users to use the provider default temperature by specifying null. Extend default settings middleware to allow for models with overrides.

@lgrammel lgrammel changed the title x feat (ai): allow using provider default temperature by specifying null Apr 22, 2025
@lgrammel lgrammel closed this Apr 22, 2025
@lgrammel lgrammel reopened this Apr 22, 2025
@lgrammel lgrammel marked this pull request as ready for review April 22, 2025 13:43
@lgrammel lgrammel merged commit 8e64e9c into v5 Apr 22, 2025
7 checks passed
@lgrammel lgrammel deleted the lg/oYLum7XJ branch April 22, 2025 14:07
Copy link
Copy Markdown
Collaborator

@gr2m gr2m left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

My only concern is that null might have a meaning for future providers. We could use Symbols instead of null to signal that the fallback values should be used


const result = await middleware.transformParams!({
type: 'generate',
params: { ...BASE_PARAMS, temperature: undefined },
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

should this have been null

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@lgrammel
Copy link
Copy Markdown
Collaborator Author

yes we can refine e.g. with string alternatives as discussed

samdenty pushed a commit that referenced this pull request Apr 24, 2025
…ining2

* origin/v5: (25 commits)
  chore(providers/langchain): extract to separate package (#5928)
  Version Packages (canary) (#5898)
  fix (docs): fix typo (#5914) (#5919)
  docs: update chat-with-pdf page to include updated provider information (#5895) (#5917)
  docs: Added documentation for function call parsing middleware (#5900)
  refactoring: extract SharedV2Headers (#5912)
  feat (providers/openai): add support for reasoning summaries (#5906) (#5909)
  fix (docs): fix OpenRouter code examples (#5876) (#5893)
  fix(providers/xai): return actual usage when streaming instead of NaN (#5873) (#5891)
  fix (docs): fix valibotSchema import (#5865) (#5889)
  fix (providers/fal): improve model compatibility (#5855) (#5892)
  chore: extract spec types (#5901)
  chore: remove logprobs (#5896)
  Version Packages (canary) (#5872)
  chore (ci): unify jobs & remove unnecessary example builds (#5894)
  feat (ai): allow using provider default temperature by specifying null (#5890)
  fix(ai/mcp-stdio): make `createChildProcess` synchronous to prevent spawn race condition (#5852) (#5888)
  feat (providers/google): add thinking config to provider options (#5842) (#5887)
  fix (examples): avoid mixed message types in `use-chat-streamdata-multistep` (#5824) (#5886)
  chore: restructure language model supported urls (#5882)
  ...
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.

3 participants