-
Notifications
You must be signed in to change notification settings - Fork 388
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
Change: Internal Discriminator Modification #247
Conversation
Deploying pydantic-ai with Cloudflare Pages
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
one drive by comment otherwise LGTM.
Feel free to switch to isinstance
in another PR.
@@ -196,7 +196,7 @@ async def _messages_create( | |||
anthropic_messages: list[MessageParam] = [] | |||
|
|||
for m in messages: | |||
if m.role == 'system': | |||
if m.message_kind == 'system-prompt': |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
probably better to use isinstance
. @dmontagu already changed it in most places.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Good idea, will do!
Verifying that the chat app still works locally, then I'll merge. |
The chat app is actually broken on |
Following up on #232 (comment), where we discussed that this change should be added to a separate PR.
This PR changes the
Messages
structures such that each one has:message_kind
: a discriminator used to identify the message typerole
: either'model'
or'user'
, like Gemini has, and similar to Anthropic's'assistant'
or'user'
Message parts, which are used to construct a
ModelResponse
now have apart_kind
discriminator instead of just a plainkind
.