-
Notifications
You must be signed in to change notification settings - Fork 122
Open
Description
Problem
I'm using ellmer with my company's internal OpenAI endpoint.
This worked in ellmer v0.3.0:
library(ellmer)
chat <- chat_openai(
model = "bedrock-anthropic-claude-3.7-sonnet",
base_url = "internal-endpoint",
)
chat$chat("What is the difference between a tibble and a data frame?")In ellmer v0.4.0, I'd start to get a response, then:
Error in data.frame(provider = provider@name, model = provider@model,
arguments imply differing number of rows: 1, 0
Likely Cause
get_token_cost() is called with variant = NULL when the API response doesn't include service_tier. The data.frame() call then fails because variant has length 0 while other columns have length 1.
Potential Fix
Default variant to NULL and set to "" if so:
get_token_cost <- function(provider, tokens, variant = NULL) {
variant <- variant %||% ""
# ...
}Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
No labels