Skip to content

Conversation

@majiayu000
Copy link
Contributor

@majiayu000 majiayu000 commented Dec 30, 2025

Summary

  • Widened type hints for the stream_type parameter in streaming_action.pydantic

Changes

  • Expanded PartialType in burr/integrations/pydantic.py
  • Updated stream_type parameter type in streaming_action.pydantic in burr/core/action.py
  • Added test case test_streaming_pydantic_action_union_stream_type (may not cover Model1 | Model2 union objects)

Test plan

  • Added unit test for union type stream_type
  • All existing pydantic tests pass (31 tests)
  • All core action tests pass (46 tests)
  • Pre-commit checks pass

state_input_type: Type["BaseModel"],
state_output_type: Type["BaseModel"],
stream_type: Union[Type["BaseModel"], Type[dict]],
stream_type: Union[Type["BaseModel"], Type[dict], type],
Copy link
Contributor

@skrawcz skrawcz Dec 30, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

hmm, pyright didn't seem to like this for me -- rather this doesn't fix it for me.

@majiayu000 majiayu000 changed the title fix(pydantic): support union type hints for stream_type parameter fix(pydantic): widen stream_type hint to accept type objects Jan 1, 2026
Updated type hints to accept Union types for stream_type parameter
in streaming_action.pydantic decorator. This allows users to specify
union types like Union[Model1, Model2] for stream_type.

Closes apache#607

Signed-off-by: majiayu000 <1835304752@qq.com>
@majiayu000 majiayu000 force-pushed the fix/607-streaming-union-type-hint branch from 883a0fe to 14d7d10 Compare January 11, 2026 11:14
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