Google-Vertex: Support include_thinking
in reasoning configuration and extraction of model thoughts.
#6259
Labels
include_thinking
in reasoning configuration and extraction of model thoughts.
#6259
Uh oh!
There was an error while loading. Please reload this page.
Description
Vertex now supports extraction of thinking tokens in certain Gemini models.
I have opened a PR #6261 to provide a suggested implementation of this.
Thinking budget is "technically supported" via:
But actual extraction and usage of the thinking tokens requires additional logic.
Ideally, you'd send something like:
This would be identical to how the request is shaped on the vertex side.
The proper request body sent to vertex looks something like:
When the
includeThoughts
option is passed to the aisdk via providerOptions, it is stripped from the request sent to vertex, and thus included thoughts are not sent.Example Streamed response with thought
The response sent by vertex for thought tokens is like this for thoughts:
And like this for normal text parts:
For completeness, here's the last data part with token usage metadata:
Non-streamed response with thoughts
Like before, a
thought
key is included in reasoning parts, so this should be straighforward to extract.The text was updated successfully, but these errors were encountered: