Skip to content

Commit

Permalink
refactor(prompt): use Union in cast
Browse files Browse the repository at this point in the history
  • Loading branch information
mszenfeld committed Dec 23, 2024
1 parent d2fd3d4 commit d0cc7df
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion pydantic_ai_slim/pydantic_ai/prompt.py
Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,7 @@ def _normalize_type(content: Any) -> dict[str, Any] | list[Any] | BasicType:
elif isinstance(content, Iterable) and not isinstance(content, (str, dict)):
return list(cast(Iterable[Any], content))
elif isinstance(content, (str, int, float, bool, dict)):
return cast(BasicType | dict[str, Any], content)
return cast(Union[BasicType, dict[str, Any]], content)
else:
raise TypeError(f'Unsupported content type: {type(content)}')

Expand Down

0 comments on commit d0cc7df

Please sign in to comment.