ThyTran1402 commented on issue #607:
URL: https://github.com/apache/burr/issues/607#issuecomment-4757272399

   Hi @andreahlert,
   
   I was able to find the root cause of this issue that `stream_type` parameter 
was defined with a restrictive type of annotation: 
   On `burr/core/action.py`:
   ```python
   stream_type: Union[Type["BaseModel"], Type[dict]]
   ```
   On `burr/integrations/pydantic.py`:
   ```python
   PartialType = Union[Type[pydantic.BaseModel], Type[dict]]
   ```
   It only accepted: 
   - A single `Type[BaseModel]` which is a class that is a BaseModel
   - The `Type[dict]` which is the dict type itself
   - 
   But NOT union types like `Model1 | Model2` or `Union[Model1, Model2]`, which 
are represented as `types.UnionType` objects at runtime.
   
   So, I think we need to expand the type definitions to accept union types by 
adding `object` to Union. I opened PR for this. Let me know what your thoughts 
about it.
   
   Thank you!


-- 
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]

Reply via email to