Migrate to Chat Completions API and update dependencies#479
Merged
Conversation
- Update openai from 1.2.0 to 2.17.0 (latest) - Update py-cord from 2.4.1 to 2.7.0 (latest) - Update tiktoken from 0.4.0 to 0.12.0 (latest) - Replace deprecated /v1/completions endpoint with /v1/chat/completions - Replace removed /v1/edits endpoint with chat completions approach - Remove deprecated models (text-davinci-003, text-curie-001, text-davinci-edit-001) - Add new models (gpt-4o-mini, o1, o1-mini, o3-mini) - Update all response parsing from choices[0]["text"] to choices[0]["message"]["content"] - Update send_test_request to use chat completions - Update send_language_detect_request to use chat completions - Bump minimum Python version from 3.9 to 3.10 (required by py-cord 2.7) - Update CI matrix to test Python 3.10, 3.11, 3.12 - Update Dockerfile default Python to 3.11 - Update tests to use current models and response format https://claude.ai/code/session_01YTuyKPGRckqE6jkhtGbnBJ
- Remove @discord.guild_only() from all commands that already have guild_ids=ALLOWED_GUILDS, as py-cord 2.7 raises InvalidArgument when both are present (guild_only sets contexts/integration_types internally which conflicts with guild-scoped commands) - Fix test fixtures to use pytest tmp_path instead of hardcoded relative paths that fail when tests run from the project root https://claude.ai/code/session_01YTuyKPGRckqE6jkhtGbnBJ
llama-index==0.8.69.post1 requires Python >=3.8.1,<3.12, so Python 3.12 is not supported. Remove it from the CI matrix, pyproject.toml classifiers, and hatch test matrix. https://claude.ai/code/session_01YTuyKPGRckqE6jkhtGbnBJ
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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 modernizes the codebase by migrating all OpenAI API requests to use the Chat Completions endpoint, removing deprecated text completion and edit endpoints, and updating Python version support and dependencies.
Key Changes
API Migration
/v1/chat/completionsendpoint/v1/completionsand/v1/editsendpointsmessage.contentformat instead of conditional logic for different response typesModel Updates
text-davinci-003,text-curie-001, andtext-davinci-edit-001modelsgpt-3.5-turbo-0613,gpt-4-0613)gpt-4o-mini,o1,o1-mini, and `o3-mini modelsLOW_USAGE_MODELfromCURIEtoGPT_4_OMEGA_MINIPython & Dependencies
Code Simplification
Implementation Details
response["choices"][0]["message"]["content"]best_ofparameter usage (not supported in chat completions)https://claude.ai/code/session_01YTuyKPGRckqE6jkhtGbnBJ