Skip to content

fix(r): support ellmer 0.5.0's Provider/Model API in test mocks - #284

Merged
cpsievert merged 1 commit into
mainfrom
fix/ellmer-0.5.0-provider-model
Sep 3, 2026
Merged

fix(r): support ellmer 0.5.0's Provider/Model API in test mocks#284
cpsievert merged 1 commit into
mainfrom
fix/ellmer-0.5.0-provider-model

Conversation

@cpsievert

Copy link
Copy Markdown
Contributor

Fixes #283.

ellmer 0.5.0 moves model details from Provider into a new Model class: Provider() no longer takes model as its second positional argument, and Chat$new() now requires a separate model argument. This broke two test fixtures that constructed MockChat$new(ellmer::Provider("test", "test", "test")):

  • tests/testthat/helper-fixtures.Rmock_ellmer_chat_client()
  • tests/testthat/apps/basic/app.R

This PR adds a version-agnostic construction that branches on whether ellmer::Model exists, so the mocks work on both old (≤ 0.4.2) and new (≥ 0.5.0) ellmer:

  • On ≥ 0.5.0: MockChat$new(ellmer::Provider("test", "test"), model = ellmer::Model(name = "test"))
  • On < 0.5.0: MockChat$new(ellmer::Provider("test", "test", "test"))

Both previously-failing test files (test-QueryChat.R, test-querychat_module.R) now pass with dev ellmer installed locally. The 4 TblSqlSource failures seen in a full devtools::test() run are pre-existing (a duckdb/dbplyr CTE-naming issue) and fail identically on main, so they're out of scope here.

ellmer 0.5.0 moves model details from Provider into a new Model class:
Provider() no longer accepts model as its second positional argument,
and Chat$new() requires a separate model argument. Gate the mock chat
client construction on whether ellmer::Model exists so tests pass on
both old and new ellmer.

Fixes #283
@cpsievert
cpsievert merged commit b32edb4 into main Sep 3, 2026
10 checks passed
@cpsievert
cpsievert deleted the fix/ellmer-0.5.0-provider-model branch September 3, 2026 22:21
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Failure with dev ellmer

1 participant