Migrate to openai >=1.0.0,<2 - #175
Open
ehsandaya1-blip wants to merge 1 commit into
Open
ehsandaya1-blip wants to merge 1 commit into
ehsandaya1-blip wants to merge 1 commit into
Conversation
- **openai.ChatCompletion.create** → `client.chat.completions.create` (7 sites): Resource classes moved under the client with snake_case, plural resource names. - **openai.api_key / openai.api_base / openai.organization (module globals)** → `openai.OpenAI(api_key=..., base_url=..., organization=...)` (5 sites): Module-level configuration is replaced by an explicit client object. - **openai.ChatCompletion.acreate** → `AsyncOpenAI().chat.completions.create (awaited)` (1 site): Async variants (`acreate`) are removed; use `AsyncOpenAI` client and await the same method name. Files touched: 6. Deterministic rewrites from a machine-readable MigrationSpec for this upgrade, then a review pass on the semantic residue; every changed file was parsed and checked with pyflakes for new undefined names before this PR was prepared. No behaviour beyond the migration was touched: no reformatting, no import reordering, no unrelated code. Happy to adjust anything — if the project deliberately pins the old major version, say so and I will close this.
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.
This updates the project's use of
openaifrom<1.0.0to>=1.0.0,<2, following the provider's migration guide (openai/openai-python#742).What changed
client.chat.completions.create(7 sites): Resource classes moved under the client with snake_case, plural resource names.openai.OpenAI(api_key=..., base_url=..., organization=...)(5 sites): Module-level configuration is replaced by an explicit client object.AsyncOpenAI().chat.completions.create (awaited)(1 site): Async variants (acreate) are removed; useAsyncOpenAIclient and await the same method name.Files touched: 6.
How this was produced
Deterministic rewrites from a machine-readable MigrationSpec for this upgrade, then a review pass on the semantic residue; every changed file was parsed and checked with pyflakes for new undefined names before this PR was prepared. No behaviour beyond the migration was touched: no reformatting, no import reordering, no unrelated code.
Happy to adjust anything — if the project deliberately pins the old major version, say so and I will close this.
Notes for reviewers
smol_dev/prompts.pycallsfile_paths.from_response(completion)from the third-partyopenai_function_callpackage, which parsed openai 0.x dict responses; that dependency needs its own update for 1.x (not part of this change).import openailines are kept next to the new client import (they are unused now in six files; removing them was out of the migration's scope).