mirror of
https://github.com/x1xhlol/system-prompts-and-models-of-ai-tools.git
synced 2026-06-18 15:29:36 +00:00
Merge pull request #2 from mohammedhadeez/fix-thinking-config-example-1878267473057973130
Fix thinkingConfig usage in AI Studio vibe-coder example
This commit is contained in:
commit
7e277ac278
@ -568,7 +568,7 @@ const response = await ai.models.generateContent({
|
|||||||
console.log(response.text);
|
console.log(response.text);
|
||||||
```
|
```
|
||||||
|
|
||||||
**Incorrect Example for Setting `maxOutputTokens` without `thinkingBudget`**
|
**Example for Setting `maxOutputTokens` with low `thinkingBudget`**
|
||||||
```ts
|
```ts
|
||||||
import { GoogleGenAI } from "@google/genai";
|
import { GoogleGenAI } from "@google/genai";
|
||||||
|
|
||||||
@ -577,9 +577,9 @@ const response = await ai.models.generateContent({
|
|||||||
model: "gemini-2.5-flash",
|
model: "gemini-2.5-flash",
|
||||||
contents: "Tell me a story.",
|
contents: "Tell me a story.",
|
||||||
config: {
|
config: {
|
||||||
// Problem: The response will be empty since all the tokens are consumed by thinking.
|
// We limit thinking usage to 25 tokens so that we have 25 tokens left for the response (50 - 25).
|
||||||
// Fix: Add `thinkingConfig: { thinkingBudget: 25 }` to limit thinking usage.
|
|
||||||
maxOutputTokens: 50,
|
maxOutputTokens: 50,
|
||||||
|
thinkingConfig: { thinkingBudget: 25 },
|
||||||
},
|
},
|
||||||
});
|
});
|
||||||
console.log(response.text);
|
console.log(response.text);
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user