Skip to content

Conversation

@hadley
Copy link
Member

@hadley hadley commented Nov 4, 2025

To do:

  • Move to individual provider files
  • Support claude citation deltas
  • Add content types for claude
  • Add content types for openAI
  • Add content types for gemini — only uses text
  • Write search test
  • Write fetch test
  • Check gemini is counting tokens

Fixes #578

@simonpcouch @gadenbuie would love your thoughts on the overall shape of this API.

To do:

* [ ] Move to individual provider files
* [ ] Support claude citation deltas
* [ ] Support claude `server_tool_use`
* [ ] Support OpenAI content type
* [ ] Add tests for claude
* [ ] Add tests for google
* [ ] Add tests for openAI
* [ ] Check gemini is counting tokens

Fixes #578
@hadley hadley changed the title Implement built-in tools Enable search & fetch built-in tools Nov 6, 2025
@hadley hadley changed the title Enable search & fetch built-in tools Enable built-in search & fetch tools Nov 6, 2025
@hadley hadley marked this pull request as ready for review November 7, 2025 17:51
Copy link
Collaborator

@simonpcouch simonpcouch left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should we include some sort of provider + tool compatibility check, perhaps in $set_tools()?

library(ellmer)

chat <- chat_openai()
#> Using model = "gpt-4.1".
chat$register_tool(claude_tool_web_search())
chat$chat("What was in the news today?")
#> Error in `req_perform_connection()`:
#> ! HTTP 400 Bad Request.
#> ℹ Invalid value: 'web_search_20250305'. Supported values are:
#>   'code_interpreter', 'function', 'file_search', 'web_search_preview',
#>   'web_search_preview_2025_03_11', 'image_generation', 'mcp', 'custom', and
#>   'computer_use_preview'.

Created on 2025-11-07 with reprex v2.1.1

Otherwise, totally on board. So much functionality for freeee!

#' previous tool results). For security reasons, Claude cannot dynamically
#' construct URLs to fetch.
#'
#' Requires the `web-fetch-2025-09-10` beta header.
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why is it that this isn't just set for the user?

#' Learn more at <https://platform.openai.com/docs/guides/tools-web-search>
#'
#' @param allowed_domains Character vector. Restrict searches to specific domains
#' (e.g., `c("nytimes.com", "bbc.com")`). Maximum 20 domains. URLs will be
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nytimes.com is a hilarious domain to suggest to use with OpenAI

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Claude suggested that 😆

Comment on lines +26 to +32
method(as_json, list(Provider, ContentToolRequestSearch)) <- function(
provider,
x,
...
) {
x@json
}
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

lol

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Way to enable built-in web search tooling

3 participants