-
Notifications
You must be signed in to change notification settings - Fork 1.5k
Add provider_url to ModelResponse and use it in cost()
#3648
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
base: main
Are you sure you want to change the base?
Add provider_url to ModelResponse and use it in cost()
#3648
Conversation
tests/models/test_gemini_vertex.py
Outdated
| usage=IsInstance(RequestUsage), | ||
| model_name='gemini-2.0-flash', | ||
| timestamp=IsDatetime(), | ||
| provider_url=IsStr(), |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why IsStr?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You're right, IsStr() was too permissive since the URL is deterministic. I've replaced it with the concrete URL in the following commit.
fix: replace IsStr with actual provider_url
Summary
provider_urlfield toModelResponseto store the provider's API endpoint URLprovider_urltocalc_price()asprovider_api_urlfor more accurate pricing calculationsprovider_urlabstract property toStreamedResponseand implement it in all subclassesCloses #3608