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

Update llm_monitors to work with openai>=1.0.0 #154

Merged
merged 2 commits into from
Nov 27, 2023
Merged

Conversation

gustavocidornelas
Copy link
Contributor

Summary

  • openai>=1.0.0 has a different Python API (discussion). Instead of openai.ChatCompletions.create, for example, the method of interest is:
from openai import OpenAI
client = OpenAI()
client.chat.completions.create(...)
  • I've updated the llm_monitors to work with both versions. This is done by checking the openai.__version__ and monkey-patching the correct method depending on the case.
  • The notebook example was also updated. I added comments indicating how the monitors work for each openai version.

@whoseoyster whoseoyster merged commit 14e2129 into main Nov 27, 2023
2 checks passed
@whoseoyster whoseoyster deleted the cid/fix-openai-api branch November 27, 2023 00:22
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