leobin001 opened a new pull request, #672:
URL: https://github.com/apache/burr/pull/672
Fixes #607
## Summary
This PR allows `stream_type` parameter in `@streaming_action.pydantic` to
accept Union types like `MyModel1 | MyModel2`.
## Problem
Previously, the type hint was:
```python
stream_type: Union[Type[BaseModel], Type[dict]]
```
This caused type checkers to complain when users tried to pass Union types
like:
```python
union = MyModel1 | MyModel2
@streaming_action.pydantic(
...
stream_type=union, # Type error!
)
```
## Solution
Changed the type hints to `typing.Any` to support Union combinations of
BaseModel types while maintaining backward compatibility.
## Changes
- Updated `PartialType` in `burr/integrations/pydantic.py` to `typing.Any`
- Updated `stream_type` parameter in `streaming_action.pydantic()` to `Any`
- Updated `_validate_and_extract_signature_types_streaming()` signature
## Testing
The change is backward compatible - all existing code using
`Type[BaseModel]` or `Type[dict]` will continue to work, and now Union types
are also supported.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]