From d0cc7dfc8f958f7f507ff5c1b4c1ee9067f456ae Mon Sep 17 00:00:00 2001 From: Marian Szenfeld Date: Mon, 23 Dec 2024 12:47:21 +0100 Subject: [PATCH] refactor(prompt): use `Union` in `cast` --- pydantic_ai_slim/pydantic_ai/prompt.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pydantic_ai_slim/pydantic_ai/prompt.py b/pydantic_ai_slim/pydantic_ai/prompt.py index 1b2899e2..f9a806ae 100644 --- a/pydantic_ai_slim/pydantic_ai/prompt.py +++ b/pydantic_ai_slim/pydantic_ai/prompt.py @@ -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)}')