Skip to content

Commit c3e84dc

Browse files
authored
Fix function tool naming to avoid overriding the name input (#5165)
fix function tool naming to avoid overriding the name input
1 parent 141247f commit c3e84dc

File tree

1 file changed

+4
-4
lines changed

1 file changed

+4
-4
lines changed

python/packages/autogen-core/src/autogen_core/_function_utils.py

+4-4
Original file line numberDiff line numberDiff line change
@@ -304,18 +304,18 @@ def normalize_annotated_type(type_hint: Type[Any]) -> Type[Any]:
304304

305305
def args_base_model_from_signature(name: str, sig: inspect.Signature) -> Type[BaseModel]:
306306
fields: Dict[str, tuple[Type[Any], Any]] = {}
307-
for name, param in sig.parameters.items():
307+
for param_name, param in sig.parameters.items():
308308
# This is handled externally
309-
if name == "cancellation_token":
309+
if param_name == "cancellation_token":
310310
continue
311311

312312
if param.annotation is inspect.Parameter.empty:
313313
raise ValueError("No annotation")
314314

315315
type = normalize_annotated_type(param.annotation)
316-
description = type2description(name, param.annotation)
316+
description = type2description(param_name, param.annotation)
317317
default_value = param.default if param.default is not inspect.Parameter.empty else PydanticUndefined
318318

319-
fields[name] = (type, Field(default=default_value, description=description))
319+
fields[param_name] = (type, Field(default=default_value, description=description))
320320

321321
return cast(BaseModel, create_model(name, **fields)) # type: ignore

0 commit comments

Comments
 (0)