A programming framework for agentic AI
Fix function tool naming to avoid overriding the name input (#5165)
Pierrec3e84dc5caac
diff --git a/python/packages/autogen-core/src/autogen_core/_function_utils.py b/python/packages/autogen-core/src/autogen_core/_function_utils.pyindex 7f11e458a..503b89120 100644--- a/python/packages/autogen-core/src/autogen_core/_function_utils.py+++ b/python/packages/autogen-core/src/autogen_core/_function_utils.py@@ -304,18 +304,18 @@ def normalize_annotated_type(type_hint: Type[Any]) -> Type[Any]:def args_base_model_from_signature(name: str, sig: inspect.Signature) -> Type[BaseModel]:fields: Dict[str, tuple[Type[Any], Any]] = {}- for name, param in sig.parameters.items():+ for param_name, param in sig.parameters.items():# This is handled externally- if name == "cancellation_token":+ if param_name == "cancellation_token":continueif param.annotation is inspect.Parameter.empty:raise ValueError("No annotation")type = normalize_annotated_type(param.annotation)- description = type2description(name, param.annotation)+ description = type2description(param_name, param.annotation)default_value = param.default if param.default is not inspect.Parameter.empty else PydanticUndefined- fields[name] = (type, Field(default=default_value, description=description))+ fields[param_name] = (type, Field(default=default_value, description=description))return cast(BaseModel, create_model(name, **fields)) # type: ignore