Skip to content

Conversation

samuelcolvin
Copy link
Member

No description provided.

Copy link

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

Deploying pydantic-ai with  Cloudflare Pages  Cloudflare Pages

Latest commit: c5d06d3
Status: ✅  Deploy successful!
Preview URL: https://6bdff681.pydantic-ai.pages.dev
Branch Preview URL: https://resultdata-default.pydantic-ai.pages.dev

View logs


MyUnion: TypeAlias = 'Foo | Bar'
union_agent2: Agent[None, MyUnion] = Agent(
result_type=MyUnion, # type: ignore[arg-type]
Copy link
Contributor

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?

Copy link
Member Author

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

Copy link
Contributor

@sydney-runkle sydney-runkle left a 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 👍

@samuelcolvin samuelcolvin enabled auto-merge (squash) December 20, 2024 17:41
@samuelcolvin samuelcolvin merged commit 9ae0309 into main Dec 20, 2024
15 checks passed
@samuelcolvin samuelcolvin deleted the ResultData-default branch December 20, 2024 17:42
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