Skip to content

feat (providers/google): add thinking config to provider options#5842

Merged
shaper merged 3 commits intomainfrom
shaper/pr/gemini-thinking
Apr 18, 2025
Merged

feat (providers/google): add thinking config to provider options#5842
shaper merged 3 commits intomainfrom
shaper/pr/gemini-thinking

Conversation

@shaper
Copy link
Copy Markdown
Collaborator

@shaper shaper commented Apr 17, 2025

Background

For the new Gemini 2.5 Flash model support for thinking:
https://developers.googleblog.com/en/start-building-with-gemini-25-flash/

This change adds a provider option to allow specifying the thinking budget, brief docs on the option, and a simple example script showing use.

Note:

  • the Gemini API does not yet seem to provide any thinking text for inclusion in reasoning text for AI SDK
  • there are thinking token usage metrics newly returned in the Gemini API response not yet incorporated in this change

Summary

  • add thinkingBudget to providerOptions
  • add an example script for testing a google thinking model. Note no reasoning text is yet provided as it does not appear available via the API.

Tasks

  • Tests for the changes have been added (for bug fixes / features)
  • Docs have been added / updated (for bug fixes / features)
  • If required, a patch changeset for relevant packages has been added
  • You've run pnpm prettier-fix to fix any formatting issues

@shaper shaper changed the title exp: gemini thinking feat (providers/google): add thinking config to provider options Apr 18, 2025
@shaper shaper marked this pull request as ready for review April 18, 2025 21:16
@shaper shaper merged commit c56331d into main Apr 18, 2025
7 checks passed
@shaper shaper deleted the shaper/pr/gemini-thinking branch April 18, 2025 21:24
samdenty added a commit that referenced this pull request Apr 22, 2025
…) (#5887)

Co-authored-by: Walter Korman <shaper@vercel.com>
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)
  ...
@samdenty
Copy link
Copy Markdown
Contributor

samdenty commented Apr 28, 2025

@shaper looks like this PR missing updating the types / docs

@gr2m gr2m added ai/provider related to a provider package. Must be assigned together with at least one `provider/*` label provider/google Issues related to the @ai-sdk/google provider labels Oct 28, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

ai/provider related to a provider package. Must be assigned together with at least one `provider/*` label provider/google Issues related to the @ai-sdk/google provider

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants