How do I display thinking text with @ai-sdk/google? #6737
-
|
Hi, I'm using I'm using
|
Beta Was this translation helpful? Give feedback.
Replies: 2 comments 2 replies
-
|
Yes I think Pro model is designed to be more "sophisticated" than Flash. I wouldn't be surprised it take more time. As for displaying the thinking text, try the following snippet. Let me know if this works for you.
Then execute the file with bun run ./ai-sdk/google-reasoning.ts (this is the file name I used) |
Beta Was this translation helpful? Give feedback.
-
|
Hey @frescoanalytics - thanks for the reply. Is it possible to modify this solution to work with I've since switched to openAI. The response times are acceptable in my case. |
Beta Was this translation helpful? Give feedback.
Google seems to have a unified interface to generate "response". In the case of generating object, you'd call ai.models.generateContent with a responseSchema config. (See https://ai.google.dev/gemini-api/docs/structured-output)
You can slightly tweak the example on the page to achieve streaming. Below is a TS script with Google SDK. Turn thinking config on and off to see the difference.