Description 📝
The Synthesize.ipynb research notebook uses the deprecated openai==0.28 Python client and the davinci completion model, which are no longer supported by OpenAI and throw InvalidRequestError / deprecation warnings when researchers attempt to run the data synthesis pipeline.
Problem 🚨
openai==0.28 is deprecated and incompatible with the current OpenAI API.
openai.Completion.create with the davinci engine is no longer available.
- The hardcoded
openai.api_key assignment is a security anti-pattern.
- No error handling around API calls causes the entire batch loop to crash on quota/rate-limit errors.
Proposed Solution 💡
- Upgrade the pip dependency to
openai>=1.0.0.
- Initialize the client securely using
os.environ.get('OPENAI_API_KEY') instead of hardcoding the key.
- Replace the deprecated
openai.Completion.create / davinci call with the modern client.chat.completions.create syntax using gpt-3.5-turbo.
- Wrap API calls in a
try/except block to gracefully handle rate-limit or quota errors without crashing the batch loop.
References 🔗
Acceptance Criteria ✅
Description 📝
The
Synthesize.ipynbresearch notebook uses the deprecatedopenai==0.28Python client and thedavincicompletion model, which are no longer supported by OpenAI and throwInvalidRequestError/ deprecation warnings when researchers attempt to run the data synthesis pipeline.Problem 🚨
openai==0.28is deprecated and incompatible with the current OpenAI API.openai.Completion.createwith thedavinciengine is no longer available.openai.api_keyassignment is a security anti-pattern.Proposed Solution 💡
openai>=1.0.0.os.environ.get('OPENAI_API_KEY')instead of hardcoding the key.openai.Completion.create/davincicall with the modernclient.chat.completions.createsyntax usinggpt-3.5-turbo.try/exceptblock to gracefully handle rate-limit or quota errors without crashing the batch loop.References 🔗
Acceptance Criteria ✅
Synthesize.ipynbruns without deprecation warnings orInvalidRequestError.gpt-3.5-turboviaclient.chat.completions.create.