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

Fix handling of OpenAI system prompts #522

Open
wants to merge 7 commits into
base: main
Choose a base branch
from

Conversation

dmontagu
Copy link
Contributor

@dmontagu dmontagu commented Dec 21, 2024

It seems the most recent openai models want you to use role 'developer' rather than 'system'. This is documented here: https://platform.openai.com/docs/guides/text-generation#developer-messages.

This requires openai SDK version 1.59.0 which was published as a release on github about an hour ago but isn't on PyPI yet.

I updated the dependencies in this PR to use the github branch but we should change that to the real 1.59.0 release before merging, it just isn't available yet.

@dmontagu
Copy link
Contributor Author

dmontagu commented Dec 21, 2024

Hmm it seems maybe this doesn't work for all models, we need to check. If not, we can revert to an earlier commit in the history.

We should test it out and either use this approach if it works with the 1.59.0 SDK, or maybe use the contents of this commit (as you can see it in this PR): c7d1c35 (#522)

@dmontagu dmontagu force-pushed the dmontagu/fix-handling-with-o1-system-role branch from cf9444e to 6301c7a Compare December 21, 2024 22:19
Copy link

cloudflare-workers-and-pages bot commented Dec 21, 2024

Deploying pydantic-ai with  Cloudflare Pages  Cloudflare Pages

Latest commit: 6301c7a
Status: ✅  Deploy successful!
Preview URL: https://21c34e60.pydantic-ai.pages.dev
Branch Preview URL: https://dmontagu-fix-handling-with-o-f12g.pydantic-ai.pages.dev

View logs

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.

1 participant