Skip to content

Commit ade3e10

Browse files
authored
Merge pull request #122 from mlverse/updates
Fixes bug that shows GPT 4o even if there is no token
2 parents 9824815 + 8d38734 commit ade3e10

File tree

5 files changed

+31
-1
lines changed

5 files changed

+31
-1
lines changed

DESCRIPTION

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
Package: chattr
22
Title: Interact with Large Language Models in 'RStudio'
3-
Version: 0.2.0
3+
Version: 0.2.0.9000
44
Authors@R: c(
55
person("Edgar", "Ruiz", , "[email protected]", role = c("aut", "cre")),
66
person(given = "Posit Software, PBC", role = c("cph", "fnd"))

NEWS.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,7 @@
1+
# chattr (dev)
2+
3+
* Prevents OpenAI 4o from showing as an option if no token is found
4+
15
# chattr 0.2.0
26

37
## General

R/chattr-use.R

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -93,6 +93,7 @@ ch_get_ymls <- function(menu = TRUE) {
9393
if (!gpt_exists) {
9494
prep_files$gpt35 <- NULL
9595
prep_files$gpt4 <- NULL
96+
prep_files$gpt4o <- NULL
9697
}
9798

9899
if (!dbrx_exists) {

tests/testthat/_snaps/chattr-use.md

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,13 @@
1212
Output
1313
[1] "OpenAI - Chat Completions - gpt-4 (gpt4) \n"
1414

15+
---
16+
17+
Code
18+
out$gpt4o
19+
Output
20+
[1] "OpenAI - Chat Completions - gpt-4o (gpt4o) \n"
21+
1522
# Menu works
1623

1724
Code

tests/testthat/test-chattr-use.R

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,10 +6,28 @@ test_that("Request submission works", {
66
expect_equal(class(out), "list")
77
expect_snapshot(out$gpt35)
88
expect_snapshot(out$gpt4)
9+
expect_snapshot(out$gpt4o)
910
}
1011
)
1112
})
1213

14+
test_that("Missing token prevents showing the option", {
15+
withr::with_envvar(
16+
new = c(
17+
"OPENAI_API_KEY" = NA,
18+
"DATABRICKS_TOKEN" = "test",
19+
"DATABRICKS_HOST" = "test"
20+
),
21+
{
22+
out <- ch_get_ymls(menu = FALSE)
23+
expect_null(out$gpt35)
24+
expect_null(out$gpt4)
25+
expect_null(out$gpt4o)
26+
}
27+
)
28+
})
29+
30+
1331
test_that("Menu works", {
1432
skip_on_cran()
1533
withr::with_envvar(

0 commit comments

Comments
 (0)