Skip to content

Commit e5632db

Browse files
committed
update
1 parent ceb24c9 commit e5632db

File tree

2 files changed

+5
-1
lines changed

2 files changed

+5
-1
lines changed

camel/toolkits/function_tool.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -144,6 +144,7 @@ def _create_mol(name, field):
144144
return create_model(name, **field)
145145

146146
model = _create_mol(to_pascal(func.__name__), fields)
147+
model.model_rebuild()
147148
parameters_dict = get_pydantic_object_schema(model)
148149

149150
# The `"title"` is generated by `model.model_json_schema()`

camel/utils/mcp.py

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -78,7 +78,10 @@ def _is_pydantic_serializable(type_annotation: Any) -> Tuple[bool, str]:
7878

7979
# Try to create a simple pydantic model with this type
8080
try:
81-
create_model("TestModel", test_field=(type_annotation, ...))
81+
test_model = create_model(
82+
"TestModel", test_field=(type_annotation, ...)
83+
)
84+
test_model.model_rebuild()
8285
# If model creation succeeds, the type is serializable
8386
return True, ""
8487
except (PydanticSchemaGenerationError, TypeError, ValueError) as e:

0 commit comments

Comments
 (0)