-
Notifications
You must be signed in to change notification settings - Fork 318
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
add a default to ResultData
, some related cleanup
#512
Conversation
Deploying pydantic-ai with Cloudflare Pages
|
@@ -178,6 +178,13 @@ def run_sync3() -> None: | |||
assert_type(result.data, Union[Foo, Bar]) | |||
|
|||
|
|||
MyUnion: TypeAlias = 'Foo | Bar' | |||
union_agent2: Agent[None, MyUnion] = Agent( | |||
result_type=MyUnion, # type: ignore[arg-type] |
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.
Why do we need the type ignore here? What's the error?
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.
we need the type here so we can enforce the return type. The error is that a union is not a type, but a typeform, docs about waiting for PEP 747 - https://ai.pydantic.dev/results/?h=pep#structured-result-validation
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.
Looking good, left a few nit picky comments 👍
Co-authored-by: Sydney Runkle <54324534+sydney-runkle@users.noreply.github.com>
No description provided.