Skip to content

fix: upgrade deprecated openai api and model davinci to gpt-3.5-turbo#20

Open
lucumango wants to merge 1 commit into
ruxailab:mainfrom
lucumango:fix/openai-api-upgrade
Open

fix: upgrade deprecated openai api and model davinci to gpt-3.5-turbo#20
lucumango wants to merge 1 commit into
ruxailab:mainfrom
lucumango:fix/openai-api-upgrade

Conversation

@lucumango
Copy link
Copy Markdown

@lucumango lucumango commented Mar 4, 2026

Updated the Synthesize.ipynb research notebook to use the modern openai>=1.0.0 Python client and migrating the text generation away from deprecated models.

The davinci model and the openai==0.28 library are currently deprecated and throw an InvalidRequestError/deprecation warning when researchers attempt to run the data synthesis notebook.

Summary:

  • Updated !pip install openai==0.28 to !pip install "openai>=1.0.0" pandas.
  • Removed the hardcoded assignment of openai.api_key. The script now securely initializes the client using the OPENAI_API_KEY from the system's environment variables (os.environ.get).
  • Replaced the deprecated openai.Completion.create utilizing the davinci engine with the modern client.chat.completions.create syntax using gpt-3.5-turbo.
  • Wrapped the API call in a basic try/except block to gracefully handle potential API rate limits or quota errors without crashing the entire batch loop.
  • Verified syntax against the new openai v1.x client specifications.

Fixes #21

@lucumango
Copy link
Copy Markdown
Author

More on deprecations: https://developers.openai.com/api/docs/deprecations/
Captura de pantalla 2026-03-04 a la(s) 2 20 12 a  m

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[🐛 Fix]: Upgrade deprecated OpenAI API client and replace davinci model with gpt-3.5-turbo

1 participant