apache / apache/burr

Streaming Event type, type hint, should support union type

Open
#607 12 comments 0 reactions 0 assignees View on GitHub
area/streaming area/typing good first issue help wanted kind/bug priority/high
Dominant language
Python
Stars
2.5k
Forks
195
Avg merge
6d 10h
Merged PRs (30d)
17

Description

# Current behavior
When it's a union type it complains:
```
union = MyModel1 | MyModel2

@streaming_action.pydantic(
reads=[...],
writes=[...],
state_input_type=...,
state_output_type=...
stream_type=union, # type hint says this is invalid
)
```

because it is typed with :

```
stream_type: Union[Type["BaseModel"], Type[dict]],
```

## Library & System Information
Latest burr

# Expected behavior
It should be fine.

# Additional context
The fix I think is to expand that stream type to handle a union of BaseModel types.

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.