-
Notifications
You must be signed in to change notification settings - Fork 106
Enable built-in search & fetch tools #829
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Conversation
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
simonpcouch
left a comment
There was a problem hiding this 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. |
There was a problem hiding this comment.
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 |
There was a problem hiding this comment.
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
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Claude suggested that 😆
| method(as_json, list(Provider, ContentToolRequestSearch)) <- function( | ||
| provider, | ||
| x, | ||
| ... | ||
| ) { | ||
| x@json | ||
| } |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
lol
To do:
Fixes #578
@simonpcouch @gadenbuie would love your thoughts on the overall shape of this API.