Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Ensure cost per token is float. #6811

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

haringsrob
Copy link

Title

When you pass in a quoted string in the config, it will append the values (on streamed responses) and it will fail to do the calculation. In addition to that, if you do not quote the floats using the helm charts, they are converted to their scientific notation.

There's no validation at the moment, this results in something like this:

adding spend to team db. Response cost: 1e-061e-065e-065e-065e-065e-065e-065e-065e-065e-065e-065e-065e-065e-065e-065e-065e-065e-065e-065e-065e-065e-065e-065e-065e-065e-065e-065e-065e-065e-065e-065e-065e- │
│ 065e-065e-065e-065e-06. team_id: None.

By casting these values, if present, to make sure they are floats we can fix this.

Relevant issues

#6641

Type

🐛 Bug Fix

Changes

Changes the register_model to ensure it casts to float.

Copy link

vercel bot commented Nov 19, 2024

The latest updates on your projects. Learn more about Vercel for Git ↗︎

Name Status Preview Comments Updated (UTC)
litellm ✅ Ready (Inspect) Visit Preview 💬 Add feedback Nov 19, 2024 1:05pm

Copy link
Contributor

@ishaan-jaff ishaan-jaff left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

changes look good, can you add a test for register_model for this scenario

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.

2 participants