Skip to contents

A tool that searches the web with DuckDuckGo's HTML search page and returns the title, URL and snippet of each result. Needs the httr2 package. For better results, use a provider's own search tool (see tools_web()) or a dedicated search API.

Usage

tool_web_search(query, num_results = 10)

Format

A tool definition created with ellmer::tool().

Arguments

query

The search query.

num_results

Maximum number of results to return. Defaults to 10.

Value

The numbered results as one string.

See also

Examples

if (FALSE) { # \dontrun{
agent <- Agent$new(
  chat = ellmer::chat("openai/gpt-6-luna"),
  tools = list(tool_web_search),
  permissions = Permissions(web = TRUE)
)
} # }