Skip to content

Commit

Permalink
rename quickly -> gander
Browse files Browse the repository at this point in the history
  • Loading branch information
simonpcouch committed Dec 19, 2024
1 parent 03d97cf commit 2349e32
Show file tree
Hide file tree
Showing 18 changed files with 70 additions and 70 deletions.
2 changes: 1 addition & 1 deletion .Rbuildignore
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
^quickly\.Rproj$
^gander\.Rproj$
^\.Rproj\.user$
^LICENSE\.md$
^README\.Rmd$
Expand Down
6 changes: 3 additions & 3 deletions DESCRIPTION
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
Package: quickly
Package: gander
Title: LLMs at the tooltip
Version: 0.0.0.9000
Authors@R:
Expand All @@ -14,8 +14,8 @@ Config/testthat/edition: 3
Encoding: UTF-8
Roxygen: list(markdown = TRUE)
RoxygenNote: 7.3.2
URL: https://github.com/simonpcouch/quickly, https://simonpcouch.github.io/quickly/
BugReports: https://github.com/simonpcouch/quickly/issues
URL: https://github.com/simonpcouch/gander, https://simonpcouch.github.io/gander/
BugReports: https://github.com/simonpcouch/gander/issues
Imports:
cli (>= 3.6.3),
coro (>= 1.1.0),
Expand Down
2 changes: 1 addition & 1 deletion LICENSE
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
YEAR: 2024
COPYRIGHT HOLDER: quickly authors
COPYRIGHT HOLDER: gander authors
2 changes: 1 addition & 1 deletion LICENSE.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# MIT License

Copyright (c) 2024 quickly authors
Copyright (c) 2024 gander authors

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
Expand Down
2 changes: 1 addition & 1 deletion NAMESPACE
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# Generated by roxygen2: do not edit by hand

export(quickly_addin)
export(gander_addin)
import(rlang)
importFrom(elmer,content_image_file)
importFrom(glue,glue)
8 changes: 4 additions & 4 deletions R/addin.R
Original file line number Diff line number Diff line change
@@ -1,16 +1,16 @@
#' Run the quickly addin
#' Run the gander addin
#'
#' @returns
#' Nothing. Called for its side effects, modifying the current RStudio editor
#' based on user input. Will error if no text is entered in the dialog.
#'
#' @export
quickly_addin <- function() {
gander_addin <- function() {
context <- rstudioapi::getActiveDocumentContext()

# suppress "Listening on..." message and rethrow errors with new context
try_fetch(
suppressMessages(res <- quickly_addin_impl(
suppressMessages(res <- gander_addin_impl(
has_selection = !identical(rstudioapi::primary_selection(context)$text, "")
)),
error = function(cnd) {cli::cli_abort(conditionMessage(cnd), call = NULL)}
Expand All @@ -32,7 +32,7 @@ quickly_addin <- function() {
invisible()
}

quickly_addin_impl <- function(has_selection) {
gander_addin_impl <- function(has_selection) {
minimum_context <- ifelse(has_selection, "Selection", "None")
ui_elements <- list(
shiny::textInput("text", "Enter text:",
Expand Down
12 changes: 6 additions & 6 deletions R/assistant.R
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
#' Options used by the quickly package
#' Options used by the gander package
#'
#' @description
#' The quickly package makes use of two notable user-facing options:
#' The gander package makes use of two notable user-facing options:
#'
#' * `.quickly_fn` and `.quickly_args` determine the underlying LLM powering the
#' * `.gander_fn` and `.gander_args` determine the underlying LLM powering the
#' assistant.
#'
#' @name quickly_options
#' @name gander_options
NULL

initialize_assistant <- function(context, input) {
Expand All @@ -20,12 +20,12 @@ initialize_assistant <- function(context, input) {
}

new_chat <- function(
fn = getOption(".quickly_fn", default = "chat_claude"),
fn = getOption(".gander_fn", default = "chat_claude"),
...,
.ns = "elmer"
) {
args <- list(...)
default_args <- getOption(".quickly_args", default = list())
default_args <- getOption(".gander_args", default = list())
args <- modifyList(default_args, args)

rlang::eval_bare(rlang::call2(fn, !!!args, .ns = .ns))
Expand Down
24 changes: 12 additions & 12 deletions README.Rmd
Original file line number Diff line number Diff line change
Expand Up @@ -13,29 +13,29 @@ knitr::opts_chunk$set(
)
```

# quickly
# gander

<!-- badges: start -->
[![Lifecycle: experimental](https://img.shields.io/badge/lifecycle-experimental-orange.svg)](https://lifecycle.r-lib.org/articles/stages.html#experimental)
[![CRAN status](https://www.r-pkg.org/badges/version/quickly)](https://CRAN.R-project.org/package=quickly)
[![R-CMD-check](https://github.com/simonpcouch/quickly/actions/workflows/R-CMD-check.yaml/badge.svg)](https://github.com/simonpcouch/quickly/actions/workflows/R-CMD-check.yaml)
[![CRAN status](https://www.r-pkg.org/badges/version/gander)](https://CRAN.R-project.org/package=gander)
[![R-CMD-check](https://github.com/simonpcouch/gander/actions/workflows/R-CMD-check.yaml/badge.svg)](https://github.com/simonpcouch/gander/actions/workflows/R-CMD-check.yaml)
<!-- badges: end -->

The quickly package allows [elmer](https://elmer.tidyverse.org) chats to interface directly with your RStudio and Positron sessions. After (optionally) selecting some code, press the keyboard shortcut you've chosen to trigger the assistant (we suggest `Ctrl+Cmd+H`, as in "help") and write your request.
The gander package allows [elmer](https://elmer.tidyverse.org) chats to interface directly with your RStudio and Positron sessions. After (optionally) selecting some code, press the keyboard shortcut you've chosen to trigger the assistant (we suggest `Ctrl+Cmd+H`, as in "help") and write your request.

## Installation

You can install quickly like so:
You can install gander like so:

``` r
pak::pak("simonpcouch/quickly")
pak::pak("simonpcouch/gander")
```

Then, ensure that you have an [`ANTHROPIC_API_KEY`](https://console.anthropic.com/) environment variable set, and you're ready to go. If you'd like to use an LLM other than Anthropic's Claude 3.5 Sonnet—like OpenAI's ChatGPT or a local ollama model—to power the quickly see `?quickly_options`.
Then, ensure that you have an [`ANTHROPIC_API_KEY`](https://console.anthropic.com/) environment variable set, and you're ready to go. If you'd like to use an LLM other than Anthropic's Claude 3.5 Sonnet—like OpenAI's ChatGPT or a local ollama model—to power the gander see `?gander_options`.

The quickly assistant is interfaced with the via the quickly addin. For easiest access, we recommend registering the quickly addin to a keyboard shortcut.
The gander assistant is interfaced with the via the gander addin. For easiest access, we recommend registering the gander addin to a keyboard shortcut.

**In RStudio**, navigate to `Tools > Modify Keyboard Shortcuts > Search "quickly"`—we suggest `Ctrl+Alt+H` (or `Ctrl+Cmd+H` on macOS).
**In RStudio**, navigate to `Tools > Modify Keyboard Shortcuts > Search "gander"`—we suggest `Ctrl+Alt+H` (or `Ctrl+Cmd+H` on macOS).

**In Positron**, you'll need to open the command palette, run "Open Keyboard Shortcuts (JSON)", and paste the following into your `keybindings.json`:

Expand All @@ -46,20 +46,20 @@ The quickly assistant is interfaced with the via the quickly addin. For easiest
"when": "editorTextFocus",
"args": {
"langId": "r",
"code": "quickly::quickly_addin()",
"code": "gander::gander_addin()",
"focus": true
}
}
```

The analogous keybinding on non-macOS is `Ctrl+Alt+H`. That said, change the `"key"` entry to any keybinding you wish!

Once those steps are completed, you're ready to use the quickly assistant with a keyboard shortcut.
Once those steps are completed, you're ready to use the gander assistant with a keyboard shortcut.

## Example

```{r}
#| echo: false
#| fig.alt: "A screencast demonstrating usage. In an RStudio session, I select some ggplot code, trigger the addin and type 'add axis labels', and then the model adds the needed code in-place."
knitr::include_graphics("https://raw.githubusercontent.com/simonpcouch/quickly/refs/heads/main/inst/figs/quickly.gif")
knitr::include_graphics("https://raw.githubusercontent.com/simonpcouch/gander/refs/heads/main/inst/figs/gander.gif")
```
26 changes: 13 additions & 13 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,43 +1,43 @@

<!-- README.md is generated from README.Rmd. Please edit that file -->

# quickly
# gander

<!-- badges: start -->

[![Lifecycle:
experimental](https://img.shields.io/badge/lifecycle-experimental-orange.svg)](https://lifecycle.r-lib.org/articles/stages.html#experimental)
[![CRAN
status](https://www.r-pkg.org/badges/version/quickly)](https://CRAN.R-project.org/package=quickly)
[![R-CMD-check](https://github.com/simonpcouch/quickly/actions/workflows/R-CMD-check.yaml/badge.svg)](https://github.com/simonpcouch/quickly/actions/workflows/R-CMD-check.yaml)
status](https://www.r-pkg.org/badges/version/gander)](https://CRAN.R-project.org/package=gander)
[![R-CMD-check](https://github.com/simonpcouch/gander/actions/workflows/R-CMD-check.yaml/badge.svg)](https://github.com/simonpcouch/gander/actions/workflows/R-CMD-check.yaml)
<!-- badges: end -->

The quickly package allows [elmer](https://elmer.tidyverse.org) chats to
The gander package allows [elmer](https://elmer.tidyverse.org) chats to
interface directly with your RStudio and Positron sessions. After
(optionally) selecting some code, press the keyboard shortcut you’ve
chosen to trigger the assistant (we suggest `Ctrl+Cmd+H`, as in “help”)
and write your request.

## Installation

You can install quickly like so:
You can install gander like so:

``` r
pak::pak("simonpcouch/quickly")
pak::pak("simonpcouch/gander")
```

Then, ensure that you have an
[`ANTHROPIC_API_KEY`](https://console.anthropic.com/) environment
variable set, and you’re ready to go. If you’d like to use an LLM other
than Anthropic’s Claude 3.5 Sonnet—like OpenAI’s ChatGPT or a local
ollama model—to power the quickly see `?quickly_options`.
ollama model—to power the gander see `?gander_options`.

The quickly assistant is interfaced with the via the quickly addin. For
easiest access, we recommend registering the quickly addin to a keyboard
The gander assistant is interfaced with the via the gander addin. For
easiest access, we recommend registering the gander addin to a keyboard
shortcut.

**In RStudio**, navigate to
`Tools > Modify Keyboard Shortcuts > Search "quickly"`—we suggest
`Tools > Modify Keyboard Shortcuts > Search "gander"`—we suggest
`Ctrl+Alt+H` (or `Ctrl+Cmd+H` on macOS).

**In Positron**, you’ll need to open the command palette, run “Open
Expand All @@ -51,7 +51,7 @@ Keyboard Shortcuts (JSON)”, and paste the following into your
"when": "editorTextFocus",
"args": {
"langId": "r",
"code": "quickly::quickly_addin()",
"code": "gander::gander_addin()",
"focus": true
}
}
Expand All @@ -60,9 +60,9 @@ Keyboard Shortcuts (JSON)”, and paste the following into your
The analogous keybinding on non-macOS is `Ctrl+Alt+H`. That said, change
the `"key"` entry to any keybinding you wish!

Once those steps are completed, you’re ready to use the quickly
Once those steps are completed, you’re ready to use the gander
assistant with a keyboard shortcut.

## Example

<img src="https://raw.githubusercontent.com/simonpcouch/quickly/refs/heads/main/inst/figs/quickly.gif" alt="A screencast demonstrating usage. In an RStudio session, I select some ggplot code, trigger the addin and type 'add axis labels', and then the model adds the needed code in-place." width="100%" />
<img src="https://raw.githubusercontent.com/simonpcouch/gander/refs/heads/main/inst/figs/gander.gif" alt="A screencast demonstrating usage. In an RStudio session, I select some ggplot code, trigger the addin and type 'add axis labels', and then the model adds the needed code in-place." width="100%" />
2 changes: 1 addition & 1 deletion _pkgdown.yml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
url: https://simonpcouch.github.io/quickly/
url: https://simonpcouch.github.io/gander/
template:
bootstrap: 5

File renamed without changes.
File renamed without changes
4 changes: 2 additions & 2 deletions inst/rstudio/addins.dcf
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
Name: Quickly LLM assistant
Name: gander LLM assistant
Description: LLM assistant
Binding: quickly_addin
Binding: gander_addin
Interactive: false
16 changes: 8 additions & 8 deletions man/quickly-package.Rd

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

10 changes: 5 additions & 5 deletions man/quickly_addin.Rd

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

10 changes: 5 additions & 5 deletions man/quickly_options.Rd

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

4 changes: 2 additions & 2 deletions tests/testthat.R
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,6 @@
# * https://testthat.r-lib.org/articles/special-files.html

library(testthat)
library(quickly)
library(gander)

test_check("quickly")
test_check("gander")
10 changes: 5 additions & 5 deletions tests/testthat/test-assistant.R
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
test_that("new_chat() uses claude by default", {
withr::local_options(
.quickly_fn = NULL,
.quickly_args = NULL
.gander_fn = NULL,
.gander_args = NULL
)

testthat::with_mocked_bindings(
Expand All @@ -16,8 +16,8 @@ test_that("new_chat() uses claude by default", {

test_that("new_chat() uses custom function and args", {
withr::local_options(
.quickly_fn = "chat_openai",
.quickly_args = list(model = "gpt-4o")
.gander_fn = "chat_openai",
.gander_args = list(model = "gpt-4o")
)

testthat::with_mocked_bindings(
Expand All @@ -35,7 +35,7 @@ test_that("new_chat() uses custom function and args", {

test_that("new_chat() supplied args override default args", {
withr::local_options(
.quickly_args = list(temperature = 0.7)
.gander_args = list(temperature = 0.7)
)

testthat::with_mocked_bindings(
Expand Down

0 comments on commit 2349e32

Please sign in to comment.