mirror of
https://github.com/lobehub/lobe-chat.git
synced 2026-06-16 12:36:07 +00:00
💄 style: support adjust thinkingBudget in gemini 2.5 flash (#7947)
* 💄 style: support adjust thinkingBudget in gemini 2.5 flash * 💄 style: support adjust thinkingBudget in gemini 2.5 flash * 💄 style: support adjust thinkingBudget in gemini 2.5 flash
This commit is contained in:
@@ -68,6 +68,7 @@ const googleChatModels: AIChatModelCard[] = [
|
||||
},
|
||||
releasedAt: '2025-05-20',
|
||||
settings: {
|
||||
extendParams: ['enableReasoning', 'reasoningBudgetToken'],
|
||||
searchImpl: 'params',
|
||||
searchProvider: 'google',
|
||||
},
|
||||
@@ -91,6 +92,7 @@ const googleChatModels: AIChatModelCard[] = [
|
||||
},
|
||||
releasedAt: '2025-04-17',
|
||||
settings: {
|
||||
extendParams: ['enableReasoning', 'reasoningBudgetToken'],
|
||||
searchImpl: 'params',
|
||||
searchProvider: 'google',
|
||||
},
|
||||
|
||||
@@ -89,6 +89,7 @@ interface LobeGoogleAIParams {
|
||||
|
||||
interface GoogleAIThinkingConfig {
|
||||
includeThoughts?: boolean;
|
||||
thinkingBudget?: number;
|
||||
}
|
||||
|
||||
export class LobeGoogleAI implements LobeRuntimeAI {
|
||||
@@ -113,10 +114,11 @@ export class LobeGoogleAI implements LobeRuntimeAI {
|
||||
async chat(rawPayload: ChatStreamPayload, options?: ChatCompetitionOptions) {
|
||||
try {
|
||||
const payload = this.buildPayload(rawPayload);
|
||||
const model = payload.model;
|
||||
const { model, thinking } = payload;
|
||||
|
||||
const thinkingConfig: GoogleAIThinkingConfig = {
|
||||
includeThoughts: true,
|
||||
thinkingBudget: thinking?.type === 'enabled' ? Math.min(thinking.budget_tokens, 24_576) : 0,
|
||||
};
|
||||
|
||||
const contents = await this.buildGoogleMessages(payload.messages);
|
||||
|
||||
@@ -122,7 +122,7 @@ export interface ChatStreamPayload {
|
||||
*/
|
||||
temperature: number;
|
||||
/**
|
||||
* use for Claude
|
||||
* use for Claude and Gemini
|
||||
*/
|
||||
thinking?: {
|
||||
budget_tokens: number;
|
||||
|
||||
Reference in New Issue
Block a user