Skip to content

Commit e369c63

Browse files
authored
Make claude a bit more primary (#844)
* Rename `anthropic_file_` to `claude_` * Rename `provider-anthropic` to `provider-claude` * Alias models_claude() to models_anthropic()
1 parent a7e7a3e commit e369c63

File tree

11 files changed

+58
-47
lines changed

11 files changed

+58
-47
lines changed

DESCRIPTION

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -89,11 +89,11 @@ Collate:
8989
'parallel-chat.R'
9090
'params.R'
9191
'provider-anthropic-files.R'
92-
'provider-anthropic.R'
9392
'provider-any.R'
9493
'provider-aws.R'
9594
'provider-openai-compatible.R'
9695
'provider-azure.R'
96+
'provider-claude.R'
9797
'provider-google.R'
9898
'provider-cloudflare.R'
9999
'provider-databricks.R'

NAMESPACE

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -29,11 +29,6 @@ export(TypeIgnore)
2929
export(TypeJsonSchema)
3030
export(TypeObject)
3131
export(UserTurn)
32-
export(anthropic_file_delete)
33-
export(anthropic_file_download)
34-
export(anthropic_file_get)
35-
export(anthropic_file_list)
36-
export(anthropic_file_upload)
3732
export(batch_chat)
3833
export(batch_chat_completed)
3934
export(batch_chat_structured)
@@ -60,6 +55,11 @@ export(chat_perplexity)
6055
export(chat_portkey)
6156
export(chat_snowflake)
6257
export(chat_vllm)
58+
export(claude_file_delete)
59+
export(claude_file_download)
60+
export(claude_file_get)
61+
export(claude_file_list)
62+
export(claude_file_upload)
6363
export(content_image_file)
6464
export(content_image_plot)
6565
export(content_image_url)
@@ -81,6 +81,7 @@ export(live_browser)
8181
export(live_console)
8282
export(models_anthropic)
8383
export(models_aws_bedrock)
84+
export(models_claude)
8485
export(models_github)
8586
export(models_google_gemini)
8687
export(models_google_vertex)

NEWS.md

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
# ellmer (development version)
22

33
* `parallel_chat()` and `batch_chat()` are no longer experimental.
4-
* New set of `anthropic_file_()` functions for managing file uploads with Anthropic (@dcomputing, #761).
4+
* New set of `claude_file_()` functions for managing file uploads with Claude (@dcomputing, #761).
55
* `chat_openai_compatible()` replaces `chat_openai()` as the interface to use for OpenAI-compatible APIs, and `chat_openai()` is reserved for the official OpenAI API. Unlike previous versions of `chat_openai()`, the `base_url` parameter is now required (#801).
66
* `chat_openai()` now uses OpenAI's responses endpoint (#365, #801). This is their recommended endpoint and gives more access to built-in tools.
77
* `batch_chat()` now retrieves failed results for `chat_openai()` (#830)
@@ -47,6 +47,7 @@
4747
* `models_ollama()` was fixed to correctly query model capabilities from remote Ollama servers (#746).
4848

4949
* `chat_claude()` is no longer deprecated and is an alias for `chat_anthropic()`, reflecting Anthropic's recent rebranding of developer tools under the Claude name (#758).
50+
`models_claude()` is now an alias for `models_anthropic()`.
5051

5152
# ellmer 0.3.2
5253

R/provider-anthropic-files.R

Lines changed: 15 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -10,14 +10,14 @@
1010
#' having a maximum size of 500MB. For more details see
1111
#' <https://docs.claude.com/en/docs/build-with-claude/files>
1212
#'
13-
#' * `anthropic_file_upload()` uploads a file and returns an object that
13+
#' * `claude_file_upload()` uploads a file and returns an object that
1414
#' you can use in chat.
15-
#' * `anthropic_file_list()` lists all uploaded files.
16-
#' * `anthropic_file_get()` returns an object for an previously uploaded file.
17-
#' * `anthropic_file_download()` downloads the file with the given ID. Note
15+
#' * `claude_file_list()` lists all uploaded files.
16+
#' * `claude_file_get()` returns an object for an previously uploaded file.
17+
#' * `claude_file_download()` downloads the file with the given ID. Note
1818
#' that you can only download files created by skills or the code execution
1919
#' tool.
20-
#' * `anthropic_file_delete()` deletes the file with the given ID.
20+
#' * `claude_file_delete()` deletes the file with the given ID.
2121
#'
2222
#' @inheritParams chat_anthropic
2323
#' @param path Path to a file to upload.
@@ -27,12 +27,12 @@
2727
#' @export
2828
#' @examples
2929
#' \dontrun{
30-
#' file <- anthropic_file_upload("path/to/file.pdf")
30+
#' file <- claude_file_upload("path/to/file.pdf")
3131
#' chat <- chat_anthropic(beta_headers = "files-api-2025-04-14")
3232
#' chat$chat("Please summarize the document.", file)
3333
#' }
3434

35-
anthropic_file_upload <- function(
35+
claude_file_upload <- function(
3636
path,
3737
base_url = "https://api.anthropic.com/v1/",
3838
beta_headers = "files-api-2025-04-14",
@@ -54,8 +54,8 @@ anthropic_file_upload <- function(
5454
}
5555

5656
#' @export
57-
#' @rdname anthropic_file_upload
58-
anthropic_file_list <- function(
57+
#' @rdname claude_file_upload
58+
claude_file_list <- function(
5959
base_url = "https://api.anthropic.com/v1/",
6060
credentials = NULL,
6161
beta_headers = "files-api-2025-04-14"
@@ -75,8 +75,8 @@ anthropic_file_list <- function(
7575
}
7676

7777
#' @export
78-
#' @rdname anthropic_file_upload
79-
anthropic_file_get <- function(
78+
#' @rdname claude_file_upload
79+
claude_file_get <- function(
8080
file_id,
8181
base_url = "https://api.anthropic.com/v1/",
8282
credentials = NULL,
@@ -91,9 +91,9 @@ anthropic_file_get <- function(
9191
}
9292

9393
#' @export
94-
#' @rdname anthropic_file_upload
94+
#' @rdname claude_file_upload
9595
#' @param path Path to download the file to.
96-
anthropic_file_download <- function(
96+
claude_file_download <- function(
9797
file_id,
9898
path,
9999
base_url = "https://api.anthropic.com/v1/",
@@ -110,8 +110,8 @@ anthropic_file_download <- function(
110110
}
111111

112112
#' @export
113-
#' @rdname anthropic_file_upload
114-
anthropic_file_delete <- function(
113+
#' @rdname claude_file_upload
114+
claude_file_delete <- function(
115115
file_id,
116116
base_url = "https://api.anthropic.com/v1/",
117117
credentials = NULL,

R/provider-anthropic.R renamed to R/provider-claude.R

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -630,7 +630,7 @@ method(batch_result_turn, ProviderAnthropic) <- function(
630630

631631
#' @export
632632
#' @rdname chat_anthropic
633-
models_anthropic <- function(
633+
models_claude <- function(
634634
base_url = "https://api.anthropic.com/v1",
635635
api_key = anthropic_key()
636636
) {
@@ -661,6 +661,10 @@ models_anthropic <- function(
661661
df[order(-xtfrm(df$created_at)), ]
662662
}
663663

664+
#' @export
665+
#' @rdname chat_anthropic
666+
models_anthropic <- models_claude
667+
664668
# Helpers ----------------------------------------------------------------
665669

666670
# From httr2

_pkgdown.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ reference:
2727
- subtitle: Provider-specific helpers
2828
contents:
2929
- google_upload
30-
- starts_with("anthropic_file")
30+
- starts_with("claude_file")
3131

3232
- title: Chat helpers
3333
contents:

man/chat_anthropic.Rd

Lines changed: 7 additions & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

man/anthropic_file_upload.Rd renamed to man/claude_file_upload.Rd

Lines changed: 17 additions & 17 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.
File renamed without changes.

tests/testthat/test-provider-anthropic-files.R renamed to tests/testthat/test-provider-claude-files.R

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
11
test_that("end-to-end test of all functions", {
22
vcr::local_cassette("anthropic-upload-file")
3-
43
# Avoid using an absolute path in form_file
54
local_mocked_bindings(
65
form_file = function(path, type) {
@@ -11,8 +10,8 @@ test_that("end-to-end test of all functions", {
1110
}
1211
)
1312

14-
upload <- anthropic_file_upload(test_path("apples.pdf"))
15-
defer(anthropic_file_delete(upload@uri))
13+
upload <- claude_file_upload(test_path("apples.pdf"))
14+
defer(claude_file_delete(upload@uri))
1615

1716
chat <- chat_anthropic_test(beta_headers = "files-api-2025-04-14")
1817
response <- chat$chat("What's the title of this document?", upload)
@@ -25,8 +24,8 @@ test_that("end-to-end test of all functions", {
2524

2625
# Can't download uploaded files, but at least tests that request succeeds
2726
path <- withr::local_tempfile()
28-
expect_error(anthropic_file_download(upload@uri, path), "not downloadable")
27+
expect_error(claude_file_download(upload@uri, path), "not downloadable")
2928

30-
files <- anthropic_file_list()
29+
files <- claude_file_list()
3130
expect_true("apples.pdf" %in% files$filename)
3231
})

0 commit comments

Comments
 (0)