mirror of
https://github.com/langgenius/dify-official-plugins.git
synced 2026-07-21 17:45:23 -04:00
[Enhancement] Align functionality with vertex ai and gemini model #582
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?
Originally created by @AlexChim1231 on GitHub (Aug 22, 2025).
Self Checks
1. Is this request related to a challenge you're experiencing? Tell me about your story.
Currently gemini 2.5 series model have params include_thoughts and thinking_budget but vertex ai doesn't
After checking the code, their implementation is different.
2. Additional context or comments
In Gemini plugin llm.py, it is using GenerateContentConfig to setup the config of the generation, it is ok
in Vertex Ai plugin llm.py, there are two different approach to request gemini, if the
groundingset, it is using genai.Client same as Gemini plugin, it accept GenerateContentConfig. But if thegroundingis not set, it is using glm.GenerativeModel and did not accept the thinking related params.3. Can you help us with this feature?
@dosubot[bot] commented on GitHub (Aug 22, 2025):
You're right about the difference: the Gemini plugin uses
genai.ClientandGenerateContentConfigto supportinclude_thoughtsandthinking_budgetfor Gemini 2.5 models, while the Vertex AI plugin only supports these parameters whengroundingis set and falls back toglm.GenerativeModel(which does not support thinking-related parameters) otherwise. This is due to an API limitation—glm.GenerativeModeland itsGenerationConfigdo not expose or accept these advanced reasoning options, whileGenerateContentConfigdoes source.To align the functionality, you could refactor the Vertex AI plugin so that all Gemini 2.x model requests use
genai.ClientandGenerateContentConfig, regardless of thegroundingparameter. This would allow you to supportinclude_thoughtsandthinking_budgetfor all relevant models. The main code section to update is the branching logic inmodels/vertex_ai/models/llm/llm.pywhere it chooses betweengenai.Clientandglm.GenerativeModelsource.For implementation, look at how the Gemini plugin's
_set_thinking_configmethod sets these parameters on the config object, and apply a similar approach in the Vertex AI plugin. Make sure to handle model-specific compatibility (some models may not support thinking mode) as the Gemini plugin does with its blacklist logic source.If you want to contribute, focus on refactoring the request logic in Vertex AI's
llm.pyso that Gemini 2.x models consistently usegenai.ClientandGenerateContentConfig, and add support for the reasoning parameters. Test with both streaming and non-streaming responses to ensure full compatibility.Let me know if you want pointers to specific code lines or have questions about edge cases!
To reply, just mention @dosu.
How did I do? Good | Irrelevant | Incorrect | Verbose | Hallucination | Report 🐛 | Other

@AlexChim1231 commented on GitHub (Aug 22, 2025):
@dosubot
thank you
anyone can assist for this? i try to modify the vertex ai llm.py but not work, here is my code
@dosubot[bot] commented on GitHub (Aug 22, 2025):
Your code is close, but there are a few key details to check for Gemini 2.x models in Vertex AI:
Contents formatting: The
contentsparameter forclient.models.generate_contentshould be a list of dicts, not just the rawhistoryorprompt_messages. You need to convert each item inhistoryto a dict, like[item.to_dict() for item in history]see example.Thinking config: Your use of
self._set_thinking_configis correct if it matches the Gemini plugin's logic, including blacklist handling for unsupported models and proper mapping ofinclude_thoughtsandthinking_budgetreference.System instruction: If you want to set a system prompt, make sure to extract it from
prompt_messagesand pass it assystem_instructioninGenerateContentConfig.Here's a pattern you can follow:
If your code "did not work," please share the exact error message or behavior you saw—this will help pinpoint the issue. Common problems include passing the wrong format for
contentsor using unsupported parameters for certain models see related error.Let me know if you need help with the
historyconstruction or want a more complete example!To reply, just mention @dosu.
How did I do? Good | Irrelevant | Incorrect | Verbose | Hallucination | Report 🐛 | Other

@AlexChim1231 commented on GitHub (Aug 22, 2025):
I guess there has another issue for processing the message.
@dosubot[bot] commented on GitHub (Sep 7, 2025):
Hi, @AlexChim1231. I'm Dosu, and I'm helping the dify-official-plugins team manage their backlog and am marking this issue as stale.
Issue Summary:
Next Steps:
Thank you for your understanding and contribution!
@jortegac commented on GitHub (Sep 29, 2025):
Can this be reviewed again? Aligning this would also unlock the ability to use the image generation models in the vertex plugin for dify
@AlexChim1231 commented on GitHub (Sep 29, 2025):
@jortegac maybe you can find @crazywoola for this