@@ -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
10891ask_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:")
118111ask_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:")
128131ask_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:")
137150ask_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:")
148170ask_bing_copilot = ai_searcher(" copilot" )
149171
150- # ' @rdname search_genai
172+ # ' @rdname ask_bing_copilot
151173# ' @export
152174ask_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:")
162193ask_meta_ai = ai_searcher(" meta" )
163194
164195# ########################## End Search with Generative AI
0 commit comments