mirror of
https://github.com/OpenHands/OpenHands.git
synced 2025-12-26 05:48:36 +08:00
27 lines
1.3 KiB
Python
27 lines
1.3 KiB
Python
from litellm import ChatCompletionToolParam, ChatCompletionToolParamFunctionChunk
|
|
|
|
_WEB_DESCRIPTION = """Read (convert to markdown) content from a webpage. You should prefer using the `web_read` tool over the `browser` tool, but do use the `browser` tool if you need to interact with a webpage (e.g., click a button, fill out a form, etc.) OR read a webpage that contains images.
|
|
|
|
You may use the `web_read` tool to read text content from a webpage, and even search the webpage content using a Google search query (e.g., url=`https://www.google.com/search?q=YOUR_QUERY`).
|
|
|
|
Only the most recently read webpage will be available to read. This means you should not follow a link to a new page until you are done with the information on the current page.
|
|
"""
|
|
|
|
WebReadTool = ChatCompletionToolParam(
|
|
type='function',
|
|
function=ChatCompletionToolParamFunctionChunk(
|
|
name='web_read',
|
|
description=_WEB_DESCRIPTION,
|
|
parameters={
|
|
'type': 'object',
|
|
'properties': {
|
|
'url': {
|
|
'type': 'string',
|
|
'description': 'The URL of the webpage to read. You can also use a Google search query here (e.g., `https://www.google.com/search?q=YOUR_QUERY`).',
|
|
}
|
|
},
|
|
'required': ['url'],
|
|
},
|
|
),
|
|
)
|