Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Adapt codebase from OpenAI Python 0.28.1 to 1.x #2

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

xcvil
Copy link

@xcvil xcvil commented May 26, 2024

Summary

This merge request updates the codebase (case 1) from OpenAI Python 0.28.x to OpenAI Python 1.x. The transition ensures that the project remains up-to-date and compatible with the latest OpenAI APIs.

Changes

  • Initialized the OpenAI CLIENT object as a global variable to streamline API calls.
  • Updated all instances of embeddings and chat.completions methods to their new API signatures.
  • Added load_dotenv() before os.getenv() to ensure environment variables are loaded correctly.

Testing

I re-run to ensure that the updated methods work correctly with OpenAI Python 1.x.

Thank you for reviewing this merge request. Your feedback is appreciated.

@bstollnitz
Copy link
Owner

Thanks for your contribution, Xiaochen! I'm taking this year off to travel, so I don't plan to update my blog post for now. However, I've added a link to this PR in the repo's README file so that others can benefit from your work.

@xcvil
Copy link
Author

xcvil commented Jun 20, 2024

Thanks for your contribution, Xiaochen! I'm taking this year off to travel, so I don't plan to update my blog post for now. However, I've added a link to this PR in the repo's README file so that others can benefit from your work.

Thanks a lot Beatriz! Hope you enjoy your holiday!

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.

2 participants