From d490def095db83bb9dcb62fb1b172820ccc3606b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Iker=20Le=C3=B1ena?= <91603522+LenenaIker@users.noreply.github.com> Date: Mon, 19 May 2025 11:35:58 +0200 Subject: [PATCH] Update _pydantic_helper.py This function was giving me an error when using Pydantic objects with Mistral. Now is working properly. --- src/mistralai/extra/utils/_pydantic_helper.py | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/mistralai/extra/utils/_pydantic_helper.py b/src/mistralai/extra/utils/_pydantic_helper.py index 08523f41..4ab800c8 100644 --- a/src/mistralai/extra/utils/_pydantic_helper.py +++ b/src/mistralai/extra/utils/_pydantic_helper.py @@ -15,6 +15,8 @@ def rec_strict_json_schema(schema_node: Any) -> Any: elif isinstance(schema_node, list): for i, value in enumerate(schema_node): schema_node[i] = rec_strict_json_schema(value) + elif not schema_node: + pass else: raise ValueError(f"Unexpected type: {schema_node}") return schema_node