Skip to content

Commit 361dc4f

Browse files
authored
Documentation/pkgdown site improvements (#44)
* Split `search_*()` and `ask_*()` documentation into separate Rd files. Group like functions by `@family <purpose>`, e.g. engine/community/code. * Add package name to `vignette()` call. * Add alt text * Remove `search_ixquick`. * Roll improvements to `_pkgdown.yml`. * Add update note
1 parent 20ef8cf commit 361dc4f

35 files changed

+1297
-609
lines changed

NAMESPACE

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,6 @@ export(search_gh)
2424
export(search_github)
2525
export(search_google)
2626
export(search_grep)
27-
export(search_ixquick)
2827
export(search_kagi)
2928
export(search_posit)
3029
export(search_posit_community)

NEWS.md

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,25 @@
2626
([#42](https://github.com/coatless-rpkg/searcher/pull/42))
2727
- Added searcher logo ([#40](https://github.com/coatless-rpkg/searcher/pull/40))
2828

29+
## Documentation
30+
31+
### Package Website
32+
33+
- Enhanced `_pkgdown.yml` with a more organized structure and improved navigation
34+
- Set the theme to use Bootstrap 5's Flatly theme for a modern look
35+
- Added categorized function reference sections for better discoverability
36+
37+
### Function Documentation
38+
39+
- Reorganized search functions into separate help pages by category:
40+
- Search engines (Google, Bing, etc.)
41+
- Community sites (StackOverflow, Twitter, etc.)
42+
- Code repositories (GitHub, BitBucket, etc.)
43+
- AI assistants (ChatGPT, Claude, etc.)
44+
- Implemented `@family` tags to group related functions in the "See also" section
45+
- Added more specific, relevant examples for each function
46+
- Added brief descriptions of each AI service's strengths and characteristics
47+
2948
## Deprecations
3049

3150
- Deprecated `search_rstudio_community()` and `search_rscom()` functions. ([#43](https://github.com/coatless-rpkg/searcher/pull/43))

R/ai-search-functions.R

Lines changed: 91 additions & 60 deletions
Original file line numberDiff line numberDiff line change
@@ -59,106 +59,137 @@ ai_searcher = function(site) {
5959

6060
########################### Start Search with Generative AI
6161

62-
#' Search Generative AI Services from R
62+
#' Search with ChatGPT
6363
#'
64-
#' Opens a browser to query various generative AI assistants directly from R.
65-
#' These functions allow you to ask questions, get code help, or search for information
66-
#' using popular AI services.
64+
#' Opens a browser with OpenAI's ChatGPT interface and your query.
65+
#' This function allows you to ask questions, get code help,
66+
#' or search for information using ChatGPT.
6767
#'
68-
#' @param query Contents of string to send to the AI. Default is the last error message.
69-
#' @param prompt Optional prompt prefix to add before your query to guide how the AI
68+
#' @param query Contents of string to send to ChatGPT. Default is the last error message.
69+
#' @param prompt Optional prompt prefix to add before your query to guide how ChatGPT
7070
#' responds. If NULL, uses the service-specific default prompt option.
7171
#'
7272
#' @return The generated search URL or an empty string.
7373
#'
74-
#' @rdname search_genai
7574
#' @export
76-
#' @seealso [search_site()]
75+
#' @family AI assistants
7776
#' @examples
78-
#' \dontrun{
79-
#' # Basic AI queries
77+
#' # Basic query
8078
#' ask_chatgpt("How to join two dataframes in R?")
81-
#' ask_claude("Explain what purrr::map_df does")
82-
#' ask_perplexity("Compare dplyr vs data.table")
8379
#'
84-
#' # Using custom prompts
85-
#' ask_mistral("Find bug: ggplot(mtcars, aes(x=mpg, y=hp) + geom_point()",
86-
#' prompt = "Debug this code step by step:")
80+
#' # Using a custom prompt
81+
#' ask_chatgpt("Error: object 'mtcrs' not found",
82+
#' prompt = "Debug this error step by step:")
8783
#'
8884
#' # Searching the last error
85+
#' \dontrun{
8986
#' tryCatch(
9087
#' median("not a number"),
9188
#' error = function(e) ask_chatgpt()
9289
#' )
93-
#'
94-
#' # Setting default prompts
95-
#' options(
96-
#' searcher.chatgpt_prompt = "You are an R viz expert. Help with:",
97-
#' searcher.claude_prompt = "As an R statistics expert, answer:"
98-
#' )
9990
#' }
100-
#'
101-
#' @section ChatGPT Search:
102-
#' The `ask_chatgpt()` function opens a browser with OpenAI's ChatGPT interface and your query using:
103-
#' `https://chat.openai.com/?model=auto&q=<query>`
104-
#'
105-
#' You can customize the AI's behavior by setting a prompt prefix through:
106-
#' 1. The `prompt` parameter for per-call customization
107-
#' 2. The `options(searcher.chatgpt_prompt = "...")` setting for persistent customization
10891
ask_chatgpt = ai_searcher("chatgpt")
10992

110-
#' @rdname search_genai
93+
#' Search with Claude
94+
#'
95+
#' Opens Anthropic's Claude AI assistant with your query.
96+
#' Claude can provide thorough answers to complex questions
97+
#' and offers excellent code explanations.
98+
#'
99+
#' @inheritParams ask_chatgpt
100+
#' @return The generated search URL or an empty string.
101+
#'
111102
#' @export
112-
#' @section Claude Search:
113-
#' The `ask_claude()` function opens Anthropic's Claude AI assistant with your query using:
114-
#' `https://claude.ai/new?q=<query>`
103+
#' @family AI assistants
104+
#' @examples
105+
#' # Basic query
106+
#' ask_claude("Explain what purrr::map_df does")
115107
#'
116-
#' Claude can be directed to respond in specific ways by using the prompt parameter or by
117-
#' setting a default prompt via `options()`.
108+
#' # Using a custom prompt
109+
#' ask_claude("Compare tidyr::pivot_wider vs tidyr::spread",
110+
#' prompt = "Provide examples of when to use each:")
118111
ask_claude = ai_searcher("claude")
119112

120-
#' @rdname search_genai
121-
#' @export
122-
#' @section Perplexity Search:
123-
#' The `ask_perplexity()` function searches with Perplexity AI using:
124-
#' `https://www.perplexity.ai/search?q=<query>&focus=internet&copilot=false`
113+
#' Search with Perplexity
125114
#'
126-
#' Perplexity AI provides answers with citations to sources, making it particularly
115+
#' Searches with Perplexity AI, which provides answers with
116+
#' citations to sources. This makes it particularly
127117
#' useful for research-oriented queries.
118+
#'
119+
#' @inheritParams ask_chatgpt
120+
#' @return The generated search URL or an empty string.
121+
#'
122+
#' @export
123+
#' @family AI assistants
124+
#' @examples
125+
#' # Basic query
126+
#' ask_perplexity("Compare dplyr vs data.table")
127+
#'
128+
#' # Using a custom prompt
129+
#' ask_perplexity("Best packages for time series in R",
130+
#' prompt = "Provide citations and compare performance:")
128131
ask_perplexity = ai_searcher("perplexity")
129132

130-
#' @rdname search_genai
133+
#' Search with Mistral AI
134+
#'
135+
#' Launches Mistral AI with your query. Mistral is known for
136+
#' its strong reasoning capabilities and efficiency.
137+
#'
138+
#' @inheritParams ask_chatgpt
139+
#' @return The generated search URL or an empty string.
140+
#'
131141
#' @export
132-
#' @section Mistral Search:
133-
#' The `ask_mistral()` function launches Mistral AI with your query using:
134-
#' `https://chat.mistral.ai/chat?q=<query>`
142+
#' @family AI assistants
143+
#' @examples
144+
#' # Basic query
145+
#' ask_mistral("How to handle missing data in R?")
135146
#'
136-
#' The default prompt can be customized through the `searcher.mistral_prompt` option.
147+
#' # Using a custom prompt
148+
#' ask_mistral("Fix this code: ggplot(mtcars, aes(x=mpg, y=hp) + geom_point()",
149+
#' prompt = "Explain the error and fix it:")
137150
ask_mistral = ai_searcher("mistral")
138151

139-
#' @rdname search_genai
152+
#' Search with Bing Copilot
153+
#'
154+
#' Searches Microsoft Bing Copilot, which combines web search results
155+
#' with AI-generated responses. This makes it useful for queries that
156+
#' benefit from current web information.
157+
#'
158+
#' @inheritParams ask_chatgpt
159+
#' @return The generated search URL or an empty string.
160+
#'
140161
#' @export
141-
#' @section Bing Copilot Search:
142-
#' The `ask_bing_copilot()` and `search_copilot()` functions both search
143-
#' Microsoft Bing Copilot using:
144-
#' `https://www.bing.com/search?showconv=1&sendquery=1&q=<query>`
162+
#' @family AI assistants
163+
#' @examples
164+
#' # Basic query
165+
#' ask_bing_copilot("Latest R package for geospatial analysis")
145166
#'
146-
#' Bing Copilot combines search results with AI-generated responses, making it
147-
#' useful for queries that benefit from web information.
167+
#' # Using a custom prompt
168+
#' ask_bing_copilot("Write a function to calculate the median",
169+
#' prompt = "Show multiple approaches:")
148170
ask_bing_copilot = ai_searcher("copilot")
149171

150-
#' @rdname search_genai
172+
#' @rdname ask_bing_copilot
151173
#' @export
152174
ask_copilot = ask_bing_copilot
153175

154-
#' @rdname search_genai
176+
#' Search with Meta AI
177+
#'
178+
#' Searches Meta AI, which provides general-purpose AI assistance
179+
#' with a focus on conversational responses.
180+
#'
181+
#' @inheritParams ask_chatgpt
182+
#' @return The generated search URL or an empty string.
183+
#'
155184
#' @export
156-
#' @section Meta AI Search:
157-
#' The `ask_meta_ai()` function searches Meta AI using:
158-
#' `https://www.meta.ai/?q=<query>`
185+
#' @family AI assistants
186+
#' @examples
187+
#' # Basic query
188+
#' ask_meta_ai("What are the best R packages for visualization?")
159189
#'
160-
#' Meta AI provides general-purpose AI assistance with a focus on conversational
161-
#' responses.
190+
#' # Using a custom prompt
191+
#' ask_meta_ai("How to create a heatmap in R",
192+
#' prompt = "Compare ggplot2 and base R approaches:")
162193
ask_meta_ai = ai_searcher("meta")
163194

164195
########################### End Search with Generative AI

R/defunct-functions.R

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,8 +2,13 @@
22
#'
33
#' Functions listed below are no longer included in the `searcher` package
44
#'
5-
#' - [search_ixquick()]: The function binding was removed as the search engine
5+
#' - `search_ixquick()`: The function binding was removed as the search engine
66
#' name changed to "Startpage". Please use [search_startpage()].
77
#'
8+
#' - `search_rstudio_community()`: The function binding was removed as the
9+
#' company name changed to "Posit". Please use [search_posit_community()].
10+
#'
11+
#' - `search_rscom()`: The function binding was removed as the
12+
#' company name changed to "Posit". Please use [search_posit()].
813
#' @name searcher-defunct
914
NULL

0 commit comments

Comments
 (0)