feat(ai): Add proper thinking support for Gemini 2.5 models
- Added thinkingConfig with includeThoughts and thinkingBudget support - Use part.thought boolean flag to detect thinking content per API docs - Capture and preserve thought signatures for multi-turn function calling - Added supportsThinking() check for Gemini 2.5 series models - Updated example to demonstrate thinking configuration - Handle SDK type limitations with proper type assertions
This commit is contained in:
@@ -23,10 +23,15 @@ const tools: Tool[] = [
|
||||
const options: GeminiLLMOptions = {
|
||||
onText: (t, complete) => process.stdout.write(t + (complete ? "\n" : "")),
|
||||
onThinking: (t, complete) => process.stdout.write(chalk.dim(t + (complete ? "\n" : ""))),
|
||||
toolChoice: "auto"
|
||||
toolChoice: "auto",
|
||||
// Enable thinking for Gemini 2.5 models
|
||||
thinking: {
|
||||
enabled: true,
|
||||
budgetTokens: -1 // Dynamic thinking
|
||||
}
|
||||
};
|
||||
|
||||
const ai = new GeminiLLM("gemini-2.0-flash-exp", process.env.GEMINI_API_KEY || "fake-api-key-for-testing");
|
||||
const ai = new GeminiLLM("gemini-2.5-flash", process.env.GEMINI_API_KEY || "fake-api-key-for-testing");
|
||||
const context: Context = {
|
||||
systemPrompt: "You are a helpful assistant that can use tools to answer questions.",
|
||||
messages: [
|
||||
|
||||
Reference in New Issue
Block a user