Web 获取工具 (web_fetch)
¥Web Fetch Tool (web_fetch)
本文档描述了web_fetchGemini CLI 的工具。
¥This document describes the web_fetch tool for the Gemini CLI.
描述
¥Description
使用web_fetch总结、比较或提取网页中的信息。web_fetch工具处理提示中嵌入的一个或多个 URL(最多 20 个)的内容。web_fetch接受自然语言提示并返回生成的响应。
¥Use web_fetch to summarize, compare, or extract information from web pages. The web_fetch tool processes content from one or more URLs (up to 20) embedded in a prompt. web_fetch takes a natural language prompt and returns a generated response.
参数
¥Arguments
web_fetch接受一个参数:
¥web_fetch takes one argument:
prompt(字符串,必需):包含要获取的 URL(最多 20 个)以及有关如何处理其内容的具体说明的综合提示。例如:"Summarize https://example.com/article and extract key points from https://another.com/data"。提示必须至少包含一个以 开头的 URLhttp://或者https://。¥
prompt(string, required): A comprehensive prompt that includes the URL(s) (up to 20) to fetch and specific instructions on how to process their content. For example:"Summarize https://example.com/article and extract key points from https://another.com/data". The prompt must contain at least one URL starting withhttp://orhttps://.
如何使用web_fetch使用 Gemini CLI
¥How to use web_fetch with the Gemini CLI
使用web_fetch使用 Gemini CLI,提供包含 URL 的自然语言提示。该工具会在获取任何 URL 之前要求确认。确认后,该工具将通过 Gemini API 处理 URLurlContext。
¥To use web_fetch with the Gemini CLI, provide a natural language prompt that contains URLs. The tool will ask for confirmation before fetching any URLs. Once confirmed, the tool will process URLs through Gemini API's urlContext.
如果 Gemini API 无法访问 URL,该工具将回退到直接从本地机器获取内容。该工具将格式化响应,并在可能的情况下包含来源归属和引用。然后,该工具将响应提供给用户。
¥If the Gemini API cannot access the URL, the tool will fall back to fetching content directly from the local machine. The tool will format the response, including source attribution and citations where possible. The tool will then provide the response to the user.
用法:
¥Usage:
web_fetch(prompt="Your prompt, including a URL such as https://google.com.")
web_fetch示例
¥web_fetch examples
总结单篇文章:
¥Summarize a single article:
web_fetch(prompt="Can you summarize the main points of https://example.com/news/latest")
比较两篇文章:
¥Compare two articles:
web_fetch(prompt="What are the differences in the conclusions of these two papers: https://arxiv.org/abs/2401.0001 and https://arxiv.org/abs/2401.0002?")
重要说明
¥Important notes
URL处理:
web_fetch依赖于 Gemini API 访问和处理给定 URL 的能力。¥URL processing:
web_fetchrelies on the Gemini API's ability to access and process the given URLs.输出质量:输出的质量取决于提示中指令的清晰度。
¥Output quality: The quality of the output will depend on the clarity of the instructions in the prompt.