-
Notifications
You must be signed in to change notification settings - Fork 82
Closed
Labels
bugSomething isn't workingSomething isn't working
Description
Bug Description
In 1.0.0-rc.4 I could do this to get the usage cost for a Google Gemini request:
defp parse_response(response) do
text = ReqLLM.Response.text(response)
usage = ReqLLM.Response.usage(response)
{:ok,
%{
text: text,
total_tokens: usage.total_tokens,
total_cost: usage.total_cost,
model: response.model
}}
endbut in 1.0.0-rc.5 I get this error:
** (KeyError) key :total_cost not found in: %{
output_tokens: 1,
input_tokens: 17,
reasoning_tokens: 0,
cached_tokens: 0,
total_tokens: 18
}. Did you mean:
* :total_tokens
I don't see any reference in the changelog for this, has this been removed?
Steps to Reproduce
- Get the usage from
ReqLLM.Response.usage(response) - Try to get
total_costfrom it.
Expected Behavior
Return the total cost.
Actual Behavior
It doesn't include any costs.
Environment
- Package version: 1.0.0-rc.5
- Elixir 1.18.4
- Erlang/OTP 28
Additional Context
Previously (RC4) this worked without needing to run mix req_llm.model_sync. But this fails in RC5 even if I run that mix task.
I'm not sure then why is that mix task doing...
Metadata
Metadata
Assignees
Labels
bugSomething isn't workingSomething isn't working