[PR #1935] [MERGED] fix(tool/google): as agent tool #2158

Closed
opened 2026-02-16 11:16:14 -05:00 by yindo · 0 comments
Owner

📋 Pull Request Information

Original PR: https://github.com/langgenius/dify-official-plugins/pull/1935
Author: @QIN2DIM
Created: 10/27/2025
Status: Merged
Merged: 10/27/2025
Merged by: @crazywoola

Base: mainHead: fix-tool-google


📝 Commits (10+)

  • 09061d5 Create .gitignore
  • 50017cb remove .env
  • 2d10e8e fix(google-tool): fix Google search and image search tool validation and parameter handling
  • 2e28707 fix(tool-google): update version to 0.1.0 in manifest
  • 6b65a1e feat(google-tool): add agent mode support and refactor search response handling
  • da474ea Merge branch 'main' into fix-tool-google
  • dc106c9 fix(tool): update google_search.yaml to clarify Agent mode requirement
  • 6725e2e fix(tools): correct llm_description translation in google_search.yaml
  • f732ebc Update tools/google/tools/utils.py
  • b21f700 Update tools/google/tools/utils.py

📊 Changes

12 files changed (+687 additions, -107 deletions)

View changed files

tools/google/.env (+0 -4)
tools/google/.env.example (+3 -0)
tools/google/.gitignore (+209 -0)
tools/google/.python-version (+1 -0)
📝 tools/google/manifest.yaml (+1 -1)
📝 tools/google/provider/google.py (+1 -1)
tools/google/pyproject.toml (+20 -0)
📝 tools/google/requirements.txt (+114 -1)
📝 tools/google/tools/google_image_search.py (+12 -11)
📝 tools/google/tools/google_search.py (+88 -68)
📝 tools/google/tools/google_search.yaml (+26 -21)
tools/google/tools/utils.py (+212 -0)

📄 Description

Related Issues or Context

Summary

Modernize tool/google for Agent Success & Enhanced Control

  • Major modernization of the tool/google integration, significantly boosting tool call success rates in Agent mode (estimated +80% improvement).
  • Introduced a toggle for Chatflow vs. Agent mode, dictating the tool's response behavior:
    • Agent Mode: Tool now returns only a text_message using an optimized prompt template to enhance focus and relevance.
    • Chatflow Mode: Tool maintains its original behavior, returning only a json_message.
  • Enhanced Tool Description Reliability: Revamped the tool description yaml to include clearer parameter names, model-visible parameter explanations, and few-shot examples, along with defining explicit output boundaries for the model.
  • Input Simplification & Stability: Removed defunct GoogleSearch payload parameters, including the highly unstable location parameter (which required precise latitude/longitude, often leading to null responses on incorrect formatting), further improving tool calling stability.

Demo

Chatflow Agent
PixPin_2025-10-27_16-12-17 PixPin_2025-10-27_16-12-49
text_message json_message
PixPin_2025-10-27_16-13-14 PixPin_2025-10-27_16-14-26

This PR contains Changes to Non-Plugin

  • Documentation
  • Other

This PR contains Changes to Non-LLM Models Plugin

  • I have Run Comprehensive Tests Relevant to My Changes

This PR contains Changes to LLM Models Plugin

  • My Changes Affect Message Flow Handling (System Messages and User→Assistant Turn-Taking)
  • My Changes Affect Tool Interaction Flow (Multi-Round Usage and Output Handling, for both Agent App and Agent Node)
  • My Changes Affect Multimodal Input Handling (Images, PDFs, Audio, Video, etc.)
  • My Changes Affect Multimodal Output Generation (Images, Audio, Video, etc.)
  • My Changes Affect Structured Output Format (JSON, XML, etc.)
  • My Changes Affect Token Consumption Metrics
  • My Changes Affect Other LLM Functionalities (Reasoning Process, Grounding, Prompt Caching, etc.)
  • Other Changes (Add New Models, Fix Model Parameters etc.)

Version Control (Any Changes to the Plugin Will Require Bumping the Version)

  • I have Bumped Up the Version in Manifest.yaml (Top-Level Version Field, Not in Meta Section)

Dify Plugin SDK Version

  • I have Ensured dify_plugin>=0.3.0,<0.5.0 is in requirements.txt (SDK docs)

Environment Verification (If Any Code Changes)

Local Deployment Environment

  • Dify Version is: , I have Tested My Changes on Local Deployment Dify with a Clean Environment That Matches the Production Configuration.

SaaS Environment

  • I have Tested My Changes on cloud.dify.ai with a Clean Environment That Matches the Production Configuration

🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.

## 📋 Pull Request Information **Original PR:** https://github.com/langgenius/dify-official-plugins/pull/1935 **Author:** [@QIN2DIM](https://github.com/QIN2DIM) **Created:** 10/27/2025 **Status:** ✅ Merged **Merged:** 10/27/2025 **Merged by:** [@crazywoola](https://github.com/crazywoola) **Base:** `main` ← **Head:** `fix-tool-google` --- ### 📝 Commits (10+) - [`09061d5`](https://github.com/langgenius/dify-official-plugins/commit/09061d5b7692d5de5bc368960e08871947eeddb8) Create .gitignore - [`50017cb`](https://github.com/langgenius/dify-official-plugins/commit/50017cb87bff852a2258092f4a47d29cf382c7ca) remove .env - [`2d10e8e`](https://github.com/langgenius/dify-official-plugins/commit/2d10e8e0001765fdf3178cdf1144a7b633927219) fix(google-tool): fix Google search and image search tool validation and parameter handling - [`2e28707`](https://github.com/langgenius/dify-official-plugins/commit/2e28707170ffb8248f26379f9d4e9853d5e57748) fix(tool-google): update version to 0.1.0 in manifest - [`6b65a1e`](https://github.com/langgenius/dify-official-plugins/commit/6b65a1e3b962d22d5536023670a192b36d2b5a4d) feat(google-tool): add agent mode support and refactor search response handling - [`da474ea`](https://github.com/langgenius/dify-official-plugins/commit/da474eaa652da2450e7fbad0c72188b02e94e26d) Merge branch 'main' into fix-tool-google - [`dc106c9`](https://github.com/langgenius/dify-official-plugins/commit/dc106c928028380d2310e08a5ec40eb7e8401189) fix(tool): update google_search.yaml to clarify Agent mode requirement - [`6725e2e`](https://github.com/langgenius/dify-official-plugins/commit/6725e2e5af2fbe8b2f79e316716d0cd678be6ac8) fix(tools): correct llm_description translation in google_search.yaml - [`f732ebc`](https://github.com/langgenius/dify-official-plugins/commit/f732ebcd6e4a102ed79a444d11487e2f5b240f66) Update tools/google/tools/utils.py - [`b21f700`](https://github.com/langgenius/dify-official-plugins/commit/b21f70083acd01dc20ebee5be87661eb71497304) Update tools/google/tools/utils.py ### 📊 Changes **12 files changed** (+687 additions, -107 deletions) <details> <summary>View changed files</summary> ➖ `tools/google/.env` (+0 -4) ➕ `tools/google/.env.example` (+3 -0) ➕ `tools/google/.gitignore` (+209 -0) ➕ `tools/google/.python-version` (+1 -0) 📝 `tools/google/manifest.yaml` (+1 -1) 📝 `tools/google/provider/google.py` (+1 -1) ➕ `tools/google/pyproject.toml` (+20 -0) 📝 `tools/google/requirements.txt` (+114 -1) 📝 `tools/google/tools/google_image_search.py` (+12 -11) 📝 `tools/google/tools/google_search.py` (+88 -68) 📝 `tools/google/tools/google_search.yaml` (+26 -21) ➕ `tools/google/tools/utils.py` (+212 -0) </details> ### 📄 Description ## Related Issues or Context <!-- ⚠️ NOTE: This repository is for Dify Official Plugins only. For community contributions, please submit to https://github.com/langgenius/dify-plugins instead. - Link Related Issues if Applicable: #issue_number - Or Provide Context about Why this Change is Needed --> ### Summary **Modernize tool/google for Agent Success & Enhanced Control** - Major modernization of the tool/google integration, significantly boosting tool call success rates in Agent mode (estimated **+80% improvement**). - Introduced a toggle for **Chatflow vs. Agent mode**, dictating the tool's response behavior: - **Agent Mode:** Tool now returns only a text_message using an optimized prompt template to enhance focus and relevance. - **Chatflow Mode:** Tool maintains its original behavior, returning only a json_message. - **Enhanced Tool Description Reliability:** Revamped the tool description yaml to include clearer parameter names, model-visible parameter explanations, and few-shot examples, along with defining explicit output boundaries for the model. - **Input Simplification & Stability:** Removed defunct GoogleSearch payload parameters, including the highly unstable location parameter (which required precise latitude/longitude, often leading to null responses on incorrect formatting), further improving tool calling stability. ### Demo | Chatflow | Agent | | -------- | ----- | | <img width="479" height="634" alt="PixPin_2025-10-27_16-12-17" src="https://github.com/user-attachments/assets/c57be2a4-4463-467b-80ca-365c4e5813c3" /> | <img width="831" height="591" alt="PixPin_2025-10-27_16-12-49" src="https://github.com/user-attachments/assets/362e15f9-a465-46b2-9d05-ba5f69faed57" /> | | text_message | json_message | | ------------ | ------------ | | <img width="936" height="627" alt="PixPin_2025-10-27_16-13-14" src="https://github.com/user-attachments/assets/c117e285-1048-49c6-a554-5b56a963be6f" /> | <img width="927" height="680" alt="PixPin_2025-10-27_16-14-26" src="https://github.com/user-attachments/assets/e0c8b332-c982-4583-b8b6-81c79d318bb5" /> | ## This PR contains Changes to *Non-Plugin* <!-- Put an `x` in all the boxes that apply by replacing [ ] with [x] For example: - [x] Documentation --> - [ ] Documentation - [ ] Other ## This PR contains Changes to *Non-LLM Models Plugin* - [x] I have Run Comprehensive Tests Relevant to My Changes <!-- 📷 Include Screenshots/Videos Demonstrating the Fix, New Feature, or the Behavior Before/After Breaking Changes. --> ## This PR contains Changes to *LLM Models Plugin* <!-- LLM Models Test Example: --> <!-- https://github.com/langgenius/dify-official-plugins/blob/main/.assets/test-examples/llm-plugin-tests/llm_test_example.md --> - [ ] My Changes Affect Message Flow Handling (System Messages and User→Assistant Turn-Taking) <!-- 📷 Include Screenshots/Videos Demonstrating the Fix, New Feature, or the Behavior Before/After Breaking Changes. --> - [ ] My Changes Affect Tool Interaction Flow (Multi-Round Usage and Output Handling, for both Agent App and Agent Node) <!-- 📷 Include Screenshots/Videos Demonstrating the Fix, New Feature, or the Behavior Before/After Breaking Changes. --> - [ ] My Changes Affect Multimodal Input Handling (Images, PDFs, Audio, Video, etc.) <!-- 📷 Include Screenshots/Videos Demonstrating the Fix, New Feature, or the Behavior Before/After Breaking Changes. --> - [ ] My Changes Affect Multimodal Output Generation (Images, Audio, Video, etc.) <!-- 📷 Include Screenshots/Videos Demonstrating the Fix, New Feature, or the Behavior Before/After Breaking Changes. --> - [x] My Changes Affect Structured Output Format (JSON, XML, etc.) <!-- 📷 Include Screenshots/Videos Demonstrating the Fix, New Feature, or the Behavior Before/After Breaking Changes. --> - [ ] My Changes Affect Token Consumption Metrics <!-- 📷 Include Screenshots/Videos Demonstrating the Fix, New Feature, or the Behavior Before/After Breaking Changes. --> - [ ] My Changes Affect Other LLM Functionalities (Reasoning Process, Grounding, Prompt Caching, etc.) <!-- 📷 Include Screenshots/Videos Demonstrating the Fix, New Feature, or the Behavior Before/After Breaking Changes. --> - [x] Other Changes (Add New Models, Fix Model Parameters etc.) <!-- 📷 Include Screenshots/Videos Demonstrating the Fix, New Feature, or the Behavior Before/After Breaking Changes. --> ## Version Control (Any Changes to the Plugin Will Require Bumping the Version) - [x] I have Bumped Up the Version in Manifest.yaml (Top-Level `Version` Field, Not in Meta Section) <!-- ⚠️ NOTE: Version Format: MAJOR.MINOR.PATCH - MAJOR (0.x.x): Reserved for Significant architectural changes or incompatible API modifications - MINOR (x.0.x): For New feature additions while maintaining backward compatibility - PATCH (x.x.0): For Backward-compatible bug fixes and minor improvements - Note: Each Version Component (MAJOR, MINOR, PATCH) Can Be 2 Digits, e.g., 10.11.22 --> ## Dify Plugin SDK Version - [ ] I have Ensured `dify_plugin>=0.3.0,<0.5.0` is in requirements.txt ([SDK docs](https://github.com/langgenius/dify-plugin-sdks/blob/main/python/README.md)) ## Environment Verification (If Any Code Changes) <!-- ⚠️ NOTE: At Least One Environment Must Be Tested. --> ### Local Deployment Environment - [x] Dify Version is: <!-- Specify Your Version (e.g., 1.2.0) -->, I have Tested My Changes on Local Deployment Dify with a Clean Environment That Matches the Production Configuration. <!-- - Python Virtual Env Matching Manifest.yaml & requirements.txt - No Breaking Changes in Dify That May Affect the Testing Result --> ### SaaS Environment - [x] I have Tested My Changes on cloud.dify.ai with a Clean Environment That Matches the Production Configuration <!-- - Python Virtual Env Matching Manifest.yaml & requirements.txt --> --- <sub>🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.</sub>
yindo added the pull-request label 2026-02-16 11:16:14 -05:00
yindo closed this issue 2026-02-16 11:16:14 -05:00
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: langgenius/dify-official-plugins#2158