tidyverse / elmer

Call LLM APIs from R
http://elmer.tidyverse.org/
Other
208 stars 30 forks source link

Repeated `$extract_data()` calls on `chat_[claude/gemini]()` results in error #142

Closed cpsievert closed 2 weeks ago

cpsievert commented 4 weeks ago
library(elmer)

chat <- chat_claude()

spec <- type_object(
  age = type_number(),
  name = type_string()
)

chat$extract_data(
  "My name is Susan and I'm 13 years old",
  spec = spec 
)
#> $name
#> [1] "Susan"
#> 
#> $age
#> [1] 13

chat$extract_data(
  "My name is Susan and I'm 13 years old",
  spec = spec 
)
#> Error: Can't find method for generic `as_json(provider, x)`:
#> - provider: <elmer::ProviderClaude>
#> - x       : <elmer::ContentJson>

Created on 2024-10-31 with reprex v2.1.1

cpsievert commented 4 weeks ago

chat_gemini() has the same problem

hadley commented 4 weeks ago

Yeah I have this on my to do list 😞