mirror of
https://github.com/langgenius/dify-official-plugins.git
synced 2026-07-22 01:55:27 -04:00
[PR #1329] [MERGED] feat(gemini):Improvements for Gemini 2.5 Series(Thinking mode) #1837
Reference in New Issue
Block a user
Delete Branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
📋 Pull Request Information
Original PR: https://github.com/langgenius/dify-official-plugins/pull/1329
Author: @liiir1985
Created: 7/23/2025
Status: ✅ Merged
Merged: 7/24/2025
Merged by: @crazywoola
Base:
main← Head:feature/gemini-improvements📝 Commits (6)
d2049e6fixed the issue that prompt token count calculation is far more than it actually costs under streaming mode.e1bf0e1Added CoT support for Gemini2.5 seriesfcb64c8Bump the plugin versionac86909Merge branch 'main' into feature/gemini-improvementsa5013d8Bump the plugin version1335e37Fixed the thinking_budget configurations for Geimini 2.5-Flash📊 Changes
13 files changed (+142 additions, -8 deletions)
View changed files
📝
models/gemini/manifest.yaml(+1 -1)📝
models/gemini/models/llm/gemini-2.5-flash-lite-preview-06-17.yaml(+11 -0)📝
models/gemini/models/llm/gemini-2.5-flash-lite.yaml(+11 -0)📝
models/gemini/models/llm/gemini-2.5-flash-preview-04-17.yaml(+11 -0)📝
models/gemini/models/llm/gemini-2.5-flash-preview-05-20.yaml(+11 -0)📝
models/gemini/models/llm/gemini-2.5-flash.yaml(+11 -0)📝
models/gemini/models/llm/gemini-2.5-pro-exp-03-25.yaml(+12 -0)📝
models/gemini/models/llm/gemini-2.5-pro-preview-03-25.yaml(+11 -0)📝
models/gemini/models/llm/gemini-2.5-pro-preview-05-06.yaml(+11 -0)📝
models/gemini/models/llm/gemini-2.5-pro-preview-06-05.yaml(+11 -0)📝
models/gemini/models/llm/gemini-2.5-pro.yaml(+11 -0)📝
models/gemini/models/llm/llm.py(+29 -6)📝
models/gemini/requirements.txt(+1 -1)📄 Description
Related Issues or Context
-Fixed the token usage count calculation for gemini, prompt token usage count was counted multiple times in streaming mode
-Add CoT support for Gemini 2.5 series, and added the thinking budget setting to control it.
This PR contains Changes to LLM Models Plugin
Fixed the token calculation, which was wrong.

Before:
The prompt token usage count was ridiculously high.
After:

It shows the actual token usage count
Added CoT support for Gemini 2.5 series, can use the thinking_budget to control the token used for CoT and to enable/disable the thinking mode.


The content of CoT is surrounded with
<thinking></thinking>.Version Control (Any Changes to the Plugin Will Require Bumping the Version)
Dify Plugin SDK Version
dify_plugin>=0.3.0,<0.5.0is in requirements.txt (SDK docs)Environment Verification (If Any Code Changes)
Local Deployment Environment
SaaS Environment
🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.