The btw_tools()
function provides a list of tools that can be registered
with an ellmer chat via chat$set_tools()
that allow the chat to
interface with your computational environment. Chats returned by
this function have access to the tools:
Name | Group | Description |
btw_tool_docs_available_vignettes | docs | List available vignettes for an R package. |
btw_tool_docs_help_page | docs | Get help page from package. |
btw_tool_docs_package_help_topics | docs | Get available help topics for an R package. |
btw_tool_docs_package_news | docs | Read the release notes (NEWS) for a package. |
Use this tool when you need to learn what changed in a package release, i.e. | | btw_tool_docs_vignette | docs | Get a package vignette in plain text. | | btw_tool_env_describe_data_frame | env | Show the data frame or table or get information about the structure of a data frame or table. | | btw_tool_env_describe_environment | env | List and describe items in an environment. | | btw_tool_files_list_files | files | List files in the current working directory or in subfolders in the current project directory. | | btw_tool_files_read_text_file | files | Read an entire text file. | | btw_tool_ide_read_current_editor | ide | Read the contents of the editor that is currently open in the user's IDE. | | btw_tool_search_package_info | search | Describe a CRAN package. | | btw_tool_search_packages | search | Search for an R package on CRAN.
Search Behavior
Prioritizes exact phrase matches over individual words
Falls back to word matching only when phrase matching fails
Query Strategy
Submit separate searches for distinct concepts (e.g.,
flights
,airlines
)Break multi-concept queries (e.g.,
flights airlines data API
) into multiple searches and synthesize resultsSearch for single, specific technical terms that package authors would use
If the search result includes more than a 1000 results, refine your query and try again.
Examples
Good: Search for "permutation test"
or just "permutation"
Bad: Search for "statistical analysis tools for permutation test"
. |
| btw_tool_session_check_package_installed | session | Check if a package is installed in the current session. |
| btw_tool_session_package_info | session | Verify that a specific package is installed, or find out which packages are in use in the current session. |
| btw_tool_session_platform_info | session | Describes the R version, operating system, language and locale settings for the user's system. |
Value
Registers the tools with chat
, updating the chat
object in
place. The chat
input is returned invisibly.
See also
Other Tools:
btw_tool_docs_package_news()
,
btw_tool_env_describe_data_frame()
,
btw_tool_env_describe_environment()
,
btw_tool_files_list_files()
,
btw_tool_files_read_text_file()
,
btw_tool_ide_read_current_editor()
,
btw_tool_package_docs
,
btw_tool_search_packages()
,
btw_tool_session_package_info()
,
btw_tool_session_platform_info()
Examples
# requires an ANTHROPIC_API_KEY
if (FALSE) { # \dontrun{
ch <- ellmer::chat_anthropic()
# register all of the available tools
ch$set_tools(btw_tools())
# or register only the tools related to fetching documentation
ch$set_tools(btw_tools(tools = "docs"))
# ensure that the current tools persist
ch$set_tools(c(ch$get_tools(), btw_tools()))
} # }