@@ -26,10 +26,12 @@ The goal of `searcher` is to provide a search interface directly inside of _R_.
2626For example, to look up ` rcpp example numeric vector `
2727or ` ggplot2 fix axis labels ` call one of the ` search_*() ` functions to
2828automatically have a web browser open, go to a search site, and type the query.
29- ` searcher ` also provides direct integration with AI assistants, allowing you to
30- send queries to ChatGPT, Claude, and other AI services with R-optimized prompts.
31- By default, the search functions will attempt to search the last error on call
32- if no query is specified.
29+ ` searcher ` also provides direct integration with AI assistants through ` ask_*() `
30+ functions, allowing you to send queries to ChatGPT, Claude, and other AI services
31+ with R-optimized prompts.
32+
33+ By default, the search and ask functions will attempt to search the last error
34+ on call if no query is specified.
3335
3436![ Example workflow of searching and asking AI assistants questions from R.] ( https://i.imgur.com/Zq2rg6G.gif )
3537
@@ -155,8 +157,54 @@ ask_chatgpt(
155157)
156158```
157159
158- See ` vignette("search-with-ai-assistants") ` for more details on using AI
159- assistants in searches through ` searcher ` .
160+ See ` vignette("search-with-ai-assistants", package = "searcher") ` for more
161+ details on using AI assistants in searches through ` searcher ` .
162+
163+ ## AI Prompt Management
164+
165+ For those who frequently use AI assistants, searcher provides a prompt management system:
166+
167+ ``` r
168+ # List available prompts
169+ ai_prompt_list()
170+
171+ # Set a system-level prompt for all AI services
172+ ai_prompt(" debugging" ) # Use a predefined prompt for debugging
173+
174+ # Create custom prompts
175+ ai_prompt_register(" my_prompt" , " As an R expert analyzing the mtcars dataset..." )
176+
177+ # Check active prompt
178+ ai_prompt_active()
179+
180+ # Clear active prompt
181+ ai_prompt_clear()
182+ ```
183+
184+ See ` vignette("managing-ai-prompts") ` for more details on the prompt management system.
185+
186+
187+ ### Comparison with ellmer Package
188+
189+ While both ` searcher ` and ` ellmer ` provide AI assistance for R users, they take different approaches:
190+
191+ - ` searcher ` opens a web browser with your query pre-filled in the AI service's interface
192+ - No API keys needed
193+ - Works with multiple AI services
194+ - Visual interface for complex interactions
195+ - Requires browser access and being logged in
196+ - ` ellmer ` uses API connections to interact with models directly within R
197+ - Requires API keys
198+ - Results returned directly to R console/environment
199+ - Better for programmatic/automated use
200+ - Works in non-interactive environments
201+
202+ These packages are ** complementary** rather than competitive:
203+
204+ - Use ` searcher ` for interactive exploration, debugging, and research
205+ - Use ` ellmer ` for reproducible workflows, batch processing, and production code
206+
207+ See ` vignette("faq", package = "searcher") ` for a more detailed comparison.
160208
161209## Search Errors
162210
@@ -176,9 +224,10 @@ triggers a new browser window to open with the error term listed in verbatim.
176224# Using the generic search error handler
177225options(error = searcher(" google" ))
178226
179- # Directly specify the search function
180- options(error = search_github )
227+ # Directly specify the search or ask function
181228options(error = search_google )
229+
230+ options(error = ask_claude )
182231```
183232
184233### Manually
@@ -189,23 +238,15 @@ call the search function. After that, a browser window will open with
189238the last error message as the search query on the desired search portal.
190239
191240``` r
241+ # Search the last error message with Google
192242search_google()
193- search_bing()
194- search_ecosia()
195- search_rseek()
196- search_qwant()
197- search_brave()
198- search_kagi()
199- search_grep()
200- search_mastodon()
201- search_bluesky()
202- search_twitter() # or search_x()
203- search_duckduckgo() # or search_ddg()
204- search_startpage() # or search_sp()
205- search_stackoverflow() # or search_so()
206- search_posit_community() # or search_posit()
207- search_github() # or search_gh()
208- search_bitbucket() # or search_bb()
243+
244+ # Ask an AI assistant about the last error
245+ # # Switch into debug mode
246+ ai_prompt(" debugging" )
247+
248+ # # Ask Claude about the last error
249+ ask_claude()
209250```
210251
211252## Package Customizations
@@ -248,30 +289,6 @@ From there, add:
248289}
249290```
250291
251- ## AI Prompt Management
252-
253- For those who frequently use AI assistants, searcher provides a prompt management system:
254-
255- ``` r
256- # List available prompts
257- ai_prompt_list()
258-
259- # Set a system-level prompt for all AI services
260- ai_prompt(" debugging" ) # Use a predefined prompt for debugging
261-
262- # Create custom prompts
263- ai_prompt_register(" my_prompt" , " As an R expert analyzing the mtcars dataset..." )
264-
265- # Check active prompt
266- ai_prompt_active()
267-
268- # Clear active prompt
269- ai_prompt_clear()
270- ```
271-
272- See ` vignette("managing-ai-prompts") ` for more details on the prompt management system.
273-
274-
275292## Motivation
276293
277294The idea for ` searcher ` began as a project to automatically search errors and
0 commit comments