Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
20 changes: 13 additions & 7 deletions DESCRIPTION
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
Package: searcher
Title: Query Search Interfaces
Version: 0.0.7.2
Title: Query Search Interfaces and AI Assistants
Version: 0.1.0
Authors@R: c(
person("James", "Balamuta",
email = "[email protected]",
Expand All @@ -13,11 +13,17 @@ Authors@R: c(
comment = c(ORCID = "0000-0001-9412-0457")
)
)
Description: Provides a search interface to look up terms
on 'Google', 'Bing', 'DuckDuckGo', 'Startpage', 'Ecosia', 'rseek',
'Twitter', 'StackOverflow', 'RStudio Community', 'GitHub', and 'BitBucket'.
Upon searching, a browser window will open with the aforementioned search
results.
Description: Provides search interfaces to look up terms on major search engines
including 'Google', 'Bing', 'DuckDuckGo', 'Startpage', 'Ecosia', 'Brave',
'Kagi', 'rseek', social platforms like 'X' (formerly Twitter), 'BlueSky',
'Mastodon', programming communities such as 'StackOverflow', 'Posit Community',
and code repositories including 'GitHub', 'grep.app', and 'BitBucket'.
Additionally, provides direct integration with AI assistants through
specialized query functions for 'ChatGPT', 'Claude AI', 'Perplexity AI',
'Mistral AI', 'Microsoft Copilot', and 'Meta AI', complete with an AI prompt
management system for R-optimized interactions. Upon searching or querying,
a browser window will open with the search results or AI interface pre-populated
with the specified query.
URL: https://github.com/coatless-rpkg/searcher, https://r-pkg.thecoatlessprofessor.com/searcher/
BugReports: https://github.com/coatless-rpkg/searcher/issues
Depends: R (>= 3.3.0)
Expand Down
3 changes: 3 additions & 0 deletions NAMESPACE
Original file line number Diff line number Diff line change
Expand Up @@ -10,9 +10,12 @@ export(ask_bing_copilot)
export(ask_chatgpt)
export(ask_claude)
export(ask_copilot)
export(ask_grok)
export(ask_le_chat)
export(ask_meta_ai)
export(ask_mistral)
export(ask_perplexity)
export(ask_xai)
export(search_bb)
export(search_bing)
export(search_bitbucket)
Expand Down
19 changes: 10 additions & 9 deletions NEWS.md
Original file line number Diff line number Diff line change
@@ -1,14 +1,15 @@
# searcher 0.0.8
# searcher 0.1.0

## Features

- Added GenAI Search Portals:
- `ask_chatgpt()`: Searches with ChatGPT
- `ask_claude()`: Searches with Claude AI
- `ask_perplexity()`: Searches with Perplexity AI
- `ask_mistral()`: Searches with Mistral AI
- `ask_copilot()`: Searches with Microsoft Bing's Copilot
- `ask_meta_ai()`: Searches with Meta AI
- `ask_chatgpt()`: Discuss with OpenAI's ChatGPT
- `ask_claude()`: Discuss with Anthropic's Claude AI
- `ask_perplexity()`: Discuss with Perplexity AI
- `ask_mistral()`/`ask_le_chat()`: Discuss with Mistral AI's Le Chat
- `ask_copilot()`: Discuss with Microsoft Bing's Copilot
- `ask_xai()`/`ask_grok()`: Discuss with xAI's Grok
- `ask_meta_ai()`: Discuss with Meta AI
- Added an AI Prompt Management System with Persona Prompts:
- `ai_prompt()`: Set a prompt for the AI
- `ai_prompt_active()`: View the active prompt
Expand All @@ -17,7 +18,7 @@
- `ai_prompt_register()`: Add a custom prompt
- `ai_prompt_remove()`: Remove a prompt
- Added new vignettes:
- `search-with-ai-assistants.Rmd`: Overview of the AI Searching Techniques
- `using-ai-assistants-with-searcher.Rmd`: Overview of the AI Searching Techniques
- `managing-ai-prompts.Rmd`: Overview of `searcher`'s AI Prompt Management System
- Added search portals:
- `search_brave()`: Searches on Brave.
Expand All @@ -42,9 +43,9 @@

- Reorganized search functions into separate help pages by category:
- Search engines (Google, Bing, etc.)
- AI assistants (ChatGPT, Claude, etc.)
- Community sites (StackOverflow, Twitter, etc.)
- Code repositories (GitHub, BitBucket, etc.)
- AI assistants (ChatGPT, Claude, etc.)
- Implemented `@family` tags to group related functions in the "See also" section
- Added more specific, relevant examples for each function
- Added brief descriptions of each AI service's strengths and characteristics
Expand Down
32 changes: 30 additions & 2 deletions R/ai-search-functions.R
Original file line number Diff line number Diff line change
Expand Up @@ -65,8 +65,8 @@ ai_searcher = function(site) {
#' This function allows you to ask questions, get code help,
#' or search for information using ChatGPT.
#'
#' @param query Contents of string to send to ChatGPT. Default is the last error message.
#' @param prompt Optional prompt prefix to add before your query to guide how ChatGPT
#' @param query Contents of string to send to AI Service. Default is the last error message.
#' @param prompt Optional prompt prefix to add before your query to guide how the AI Service
#' responds. If NULL, uses the service-specific default prompt option.
#'
#' @return The generated search URL or an empty string.
Expand Down Expand Up @@ -149,6 +149,11 @@ ask_perplexity = ai_searcher("perplexity")
#' prompt = "Explain the error and fix it:")
ask_mistral = ai_searcher("mistral")


#' @rdname ask_mistral
#' @export
ask_le_chat = ask_mistral

#' Search with Bing Copilot
#'
#' Searches Microsoft Bing Copilot, which combines web search results
Expand All @@ -173,6 +178,29 @@ ask_bing_copilot = ai_searcher("copilot")
#' @export
ask_copilot = ask_bing_copilot

#' Search with Grok
#'
#' Searches xAI's Grok, which provides AI assistance focused on
#' maximize truth and objectivity.
#'
#' @inheritParams ask_chatgpt
#' @return The generated search URL or an empty string.
#'
#' @export
#' @family AI assistants
#' @examples
#' # Basic query
#' ask_grok("What are the best practices for R package development?")
#'
#' # Using a custom prompt
#' ask_grok("How to optimize this R code for performance?",
#' prompt = "Focus on efficiency and best practices:")
ask_grok = ai_searcher("grok")

#' @rdname ask_grok
#' @export
ask_xai = ask_grok

#' Search with Meta AI
#'
#' Searches Meta AI, which provides general-purpose AI assistance
Expand Down
2 changes: 2 additions & 0 deletions R/index-sites.R
Original file line number Diff line number Diff line change
Expand Up @@ -111,6 +111,8 @@ site_index =
site_entry("bing copilot", "https://www.bing.com/search?showconv=1&sendquery=1&q=",
"copilot",
keywords = NULL),
site_entry("grok", "https://www.grok.com/?q=",
keywords = NULL),
site_entry("meta ai", "https://www.meta.ai/?q=",
"meta",
keywords = NULL)
Expand Down
8 changes: 6 additions & 2 deletions R/search-functions.R
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,8 @@
#' `"twitter"` or `"x"`, `"bluesky"`, `"mastodon"`, `"stackoverflow"`,
#' `"github"`, `"grep"`, `"bitbucket"`,
#' `"chatgpt"`, `"claude"`, `"perplexity"`,
#' `"mistral"`, `"bing copilot"` or `"copilot"`, and
#' `"meta ai"` or `"meta"`.
#' `"mistral"` or `"le chat"`, `"bing copilot"` or `"copilot"`, and
#' `"grok"` or `"xai"`, `"meta ai"` or `"meta"`.
#' @param query Contents of string to search. Default is the error message.
#' @param rlang Search for results written in R. Default is `TRUE`
#' @param prompt Optional prompt prefix to add before your query to guide how the AI
Expand Down Expand Up @@ -56,6 +56,7 @@ search_site = function(query,
"mistral",
"bing copilot",
"copilot",
"grok",
"meta ai",
"meta"
),
Expand Down Expand Up @@ -92,9 +93,12 @@ search_site = function(query,
chatgpt = ask_chatgpt(query, prompt),
claude = ask_claude(query, prompt),
perplexity = ask_perplexity(query, prompt),
`le chat` = , # empty case carried below
mistral = ask_mistral(query, prompt),
`bing copilot` = , # empty case carried below
copilot = ask_bing_copilot(query, prompt),
xai = , # empty case carried below
grok = ask_grok(query, prompt),
`meta ai` = , # empty case carried below,
meta = ask_meta_ai(query, prompt)
)
Expand Down
9 changes: 8 additions & 1 deletion README.Rmd
Original file line number Diff line number Diff line change
Expand Up @@ -127,6 +127,12 @@ search_bitbucket("assertions", rlang = FALSE) # or search_bb(...)
## AI Assistants

The package also provides functions to query AI assistants directly from R.
The following AI Assistant platforms are supported: OpenAI's [ChatGPT](https://chatgpt.com/),
Anthropic's [Claude](https://claude.ai/),
[Perplexity](https://www.perplexity.ai/),
Microsoft (Bing)'s [Copilot](https://copilot.microsoft.com/),
Mistral's [le Chat](https://chat.mistral.ai/chat),
xAI's [Grok](https://grok.com/), and [Meta.ai](https://www.meta.ai/).
These functions open a browser with your query pre-filled, using customizable
prompts that help the AI give more effective responses for R programming:

Expand All @@ -137,6 +143,7 @@ ask_claude("Explain what purrr::map_df does")
ask_perplexity("Compare dplyr vs data.table performance")
ask_mistral("How to handle missing data in R?")
ask_bing_copilot("Write a function to calculate the median")
ask_grok("What is better base R or tidyverse for research?")
ask_meta_ai("What are the best R packages for time series analysis?")

# Search with an error message
Expand All @@ -157,7 +164,7 @@ ask_chatgpt(
)
```

See `vignette("search-with-ai-assistants", package = "searcher")` for more
See `vignette("using-ai-assistants-with-searcher", package = "searcher")` for more
details on using AI assistants in searches through `searcher`.

## AI Prompt Management
Expand Down
23 changes: 16 additions & 7 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -17,10 +17,12 @@ The goal of `searcher` is to provide a search interface directly inside
of *R*. For example, to look up `rcpp example numeric vector` or
`ggplot2 fix axis labels` call one of the `search_*()` functions to
automatically have a web browser open, go to a search site, and type the
query. `searcher` also provides direct integration with AI assistants,
allowing you to send queries to ChatGPT, Claude, and other AI services
with R-optimized prompts. By default, the search functions will attempt
to search the last error on call if no query is specified.
query. `searcher` also provides direct integration with AI assistants
through `ask_*()` functions, allowing you to send queries to ChatGPT,
Claude, and other AI services with R-optimized prompts.

By default, the search and ask functions will attempt to search the last
error on call if no query is specified.

<figure>
<img src="https://i.imgur.com/Zq2rg6G.gif"
Expand Down Expand Up @@ -125,9 +127,15 @@ search_bitbucket("assertions", rlang = FALSE) # or search_bb(...)
## AI Assistants

The package also provides functions to query AI assistants directly from
R. These functions open a browser with your query pre-filled, using
customizable prompts that help the AI give more effective responses for
R programming:
R. The following AI Assistant platforms are supported: OpenAI’s
[ChatGPT](https://chatgpt.com/), Anthropic’s
[Claude](https://claude.ai/), [Perplexity](https://www.perplexity.ai/),
Microsoft (Bing)’s [Copilot](https://copilot.microsoft.com/), Mistral’s
[le Chat](https://chat.mistral.ai/chat), xAI’s
[Grok](https://grok.com/), and [Meta.ai](https://www.meta.ai/). These
functions open a browser with your query pre-filled, using customizable
prompts that help the AI give more effective responses for R
programming:

``` r
# Get coding help from AI assistants
Expand All @@ -136,6 +144,7 @@ ask_claude("Explain what purrr::map_df does")
ask_perplexity("Compare dplyr vs data.table performance")
ask_mistral("How to handle missing data in R?")
ask_bing_copilot("Write a function to calculate the median")
ask_grok("What is better base R or tidyverse for research?")
ask_meta_ai("What are the best R packages for time series analysis?")

# Search with an error message
Expand Down
7 changes: 4 additions & 3 deletions _pkgdown.yml
Original file line number Diff line number Diff line change
Expand Up @@ -29,9 +29,9 @@ navbar:
menu:
- text: "Search Patterns"
href: articles/search-patterns.html
- text: "Search with AI Assistants"
href: articles/search-with-ai-assistants.html
- text: "Managing AI Prompts in `searcher`"
- text: "Using AI Assistants with searcher"
href: articles/using-ai-assistants-with-searcher.html
- text: "Managing AI Prompts in searcher"
href: articles/managing-ai-prompts.html
- text: "Frequently Asked Questions (FAQ)"
href: articles/faq.html
Expand Down Expand Up @@ -71,6 +71,7 @@ reference:
- ask_mistral
- ask_bing_copilot
- ask_copilot
- ask_grok
- ask_meta_ai

- title: "Community Sites"
Expand Down
5 changes: 3 additions & 2 deletions man/ask_bing_copilot.Rd

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

5 changes: 3 additions & 2 deletions man/ask_chatgpt.Rd

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

5 changes: 3 additions & 2 deletions man/ask_claude.Rd

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

42 changes: 42 additions & 0 deletions man/ask_grok.Rd

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

5 changes: 3 additions & 2 deletions man/ask_meta_ai.Rd

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Loading