Fix handling of snapshot_ids ("gpt-4-turbo-2024-04-09" and "gpt-4o-2024-05-13") and alias "gpt-4-turbo". #672
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Currently snapshots "gpt-4o-2024-05-13" and "gpt-4-turbo-2024-04-09" wrongfully return model costs for "gpt-4".
The same is the case for "gpt-4-turbo", which is inconsistent with the OpenAI API that has "gpt-4-turbo" pointing to "gpt-4-turbo-2024-04-09" (https://platform.openai.com/docs/models/gpt-4-turbo-and-gpt-4).
These commits would fix these issue for now. However, if OpenAI decides to change pricing so that "gpt-4-turbo-2024-04-09" and "gpt-4-turbo-preview" (pointing to "gpt-4-0125-preview") will differ in cost, the logic will not hold. I suggest adding costs for each snapshot_id and adding tests to ensure that they are correct.
If you agree, I'd be more than happy to prepare a PR.
Summary:
This PR fixes incorrect cost retrieval for specific GPT-4 model snapshots and aliases, ensuring consistency with OpenAI's API.
Key points:
get_model_cost
ininstructor/cli/usage.py
to correctly handle costs forgpt-4-turbo-2024-04-09
,gpt-4o-2024-05-13
, and aliasgpt-4-turbo
.Generated with ❤️ by ellipsis.dev