google-web-search
Compare original and translation side by side
🇺🇸
Original
English🇨🇳
Translation
ChineseGoogle Web Search
Google 网页搜索
Overview
概述
This skill provides the capability to perform real-time web searches via the Gemini API's grounding tool. It is designed to fetch the most current information available on the web to provide grounded, citable answers to user queries.
google_searchKey Features:
- Real-time web search via Gemini API
- Grounded responses with verifiable citations
- Configurable model selection
- Simple Python API
本Skill可通过Gemini API的 grounding工具执行实时网页搜索。它旨在获取网络上最新的可用信息,为用户的查询提供基于事实、可引用的答案。
google_search核心特性:
- 通过Gemini API实现实时网页搜索
- 提供带有可验证引用的基于事实的响应
- 可配置模型选择
- 简洁的Python API
Usage
使用方法
This skill exposes the Gemini API's tool. It should be used when the user asks for real-time information, recent events, or requests verifiable citations.
google_search本Skill封装了Gemini API的工具。当用户询问实时信息、近期事件或要求可验证引用时,应使用本Skill。
google_searchExecution Context
执行环境
The core logic is in . This script requires the following environment variables:
scripts/example.py- GEMINI_API_KEY (required): Your Gemini API key
- GEMINI_MODEL (optional): Model to use (default: )
gemini-2.5-flash-lite
Supported Models:
- (default) - Fast and cost-effective
gemini-2.5-flash-lite - - Latest flash model
gemini-3-flash-preview - - More capable, slower
gemini-3-pro-preview - - Specific version
gemini-2.5-flash-lite-preview-09-2025
核心逻辑位于脚本中。该脚本需要以下环境变量:
scripts/example.py- GEMINI_API_KEY(必填):您的Gemini API密钥
- GEMINI_MODEL(可选):使用的模型(默认值:)
gemini-2.5-flash-lite
支持的模型:
- (默认)- 快速且经济高效
gemini-2.5-flash-lite - - 最新的flash模型
gemini-3-flash-preview - - 功能更强,速度稍慢
gemini-3-pro-preview - - 特定版本
gemini-2.5-flash-lite-preview-09-2025
Python Tool Implementation Pattern
Python工具实现模式
When integrating this skill into a larger workflow, the helper script should be executed in an environment where the library is available and the is exposed.
google-genaiGEMINI_API_KEYExample Python invocation structure:
python
from skills.google-web-search.scripts.example import get_grounded_response将本Skill集成到更大的工作流中时,辅助脚本应在已安装库且已配置的环境中执行。
google-genaiGEMINI_API_KEYPython调用示例结构:
python
from skills.google-web-search.scripts.example import get_grounded_responseBasic usage (uses default model):
基础用法(使用默认模型):
prompt = "What is the latest market trend?"
response_text = get_grounded_response(prompt)
print(response_text)
prompt = "What is the latest market trend?"
response_text = get_grounded_response(prompt)
print(response_text)
Using a specific model:
使用特定模型:
response_text = get_grounded_response(prompt, model="gemini-3-pro-preview")
print(response_text)
response_text = get_grounded_response(prompt, model="gemini-3-pro-preview")
print(response_text)
Or set via environment variable:
或通过环境变量设置:
import os
os.environ["GEMINI_MODEL"] = "gemini-3-flash-preview"
response_text = get_grounded_response(prompt)
print(response_text)
undefinedimport os
os.environ["GEMINI_MODEL"] = "gemini-3-flash-preview"
response_text = get_grounded_response(prompt)
print(response_text)
undefinedTroubleshooting
故障排除
If the script fails:
- Missing API Key: Ensure is set in the execution environment.
GEMINI_API_KEY - Library Missing: Verify that the library is installed (
google-genai).pip install google-generativeai - API Limits: Check the API usage limits on the Google AI Studio dashboard.
- Invalid Model: If you set , ensure it's a valid Gemini model name.
GEMINI_MODEL - Model Not Supporting Grounding: Some models may not support the tool. Use flash or pro variants.
google_search
如果脚本运行失败:
- 缺少API密钥:确保执行环境中已设置。
GEMINI_API_KEY - 缺少依赖库:确认已安装库(执行
google-genai)。pip install google-generativeai - API限制:在Google AI Studio控制台检查API使用限制。
- 无效模型:如果设置了,请确保它是有效的Gemini模型名称。
GEMINI_MODEL - 模型不支持Grounding:部分模型可能不支持工具,请使用flash或pro系列模型。
google_search