Added o3 and updated openai pricing #108
Open
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.
Summary:
This PR expands our support for OpenAI models by introducing additional pricing constants for several GPT-3.5, GPT-4, and related models, while also adding detection for the "o3" model type in the assistant. These changes ensure that our pricing logic reflects the latest API offerings and model variants.
Changes:
• In gptcli/assistant.py:
• In gptcli/providers/openai.py:
Rationale:
• Ensures support for the latest and upcoming OpenAI models, reflecting current pricing structures.
• Improves clarity and maintainability by having explicit mappings for each model variant.
• Future-proofs our codebase against potential changes in model naming conventions and pricing updates.
Testing:
• Verified that gpt_pricing() returns the appropriate pricing dictionary for each supported model.
• Confirmed that the new "o3" prefix correctly instantiates an OpenAICompletionProvider in the assistant.
Please review the changes and let me know if any adjustments are needed.
For reference, below is the prompt I used to update the pricing.
I also then checked that these were all consistent with a large language model which did not find any issues. I checked that LLMs were able to find injected errors.
Here is the openai pricing as copied from the openai website on 2025-02-01:
These are copied from a table, so in general if it's ambiguous, the first price is the one that I want (i.e. without batching or caching)
Please update this python code to include all the prices above:
The new price should supercede the old price. Please give me the full code output (do not abbreviate) so I can copy it in as a new pull request