A programming framework for agentic AI
fix `ImportFromModule` is unhashable issue (#3362)
zcipod3aa0528a12a2
diff --git a/autogen/coding/func_with_reqs.py b/autogen/coding/func_with_reqs.pyindex 6f1995738..f255f1df0 100644--- a/autogen/coding/func_with_reqs.py+++ b/autogen/coding/func_with_reqs.py@@ -6,7 +6,7 @@ import inspectfrom dataclasses import dataclass, fieldfrom importlib.abc import SourceLoaderfrom textwrap import dedent, indent-from typing import Any, Callable, Generic, List, TypeVar, Union+from typing import Any, Callable, Generic, List, Set, TypeVar, Unionfrom typing_extensions import ParamSpec@@ -159,12 +159,12 @@ def _build_python_functions_file(funcs: List[Union[FunctionWithRequirements[Any, P], Callable[..., Any], FunctionWithRequirementsStr]]) -> str:# First collect all global imports- global_imports = set()+ global_imports: Set[str] = set()for func in funcs:if isinstance(func, (FunctionWithRequirements, FunctionWithRequirementsStr)):- global_imports.update(func.global_imports)+ global_imports.update(map(_import_to_str, func.global_imports))- content = "\n".join(map(_import_to_str, global_imports)) + "\n\n"+ content = "\n".join(global_imports) + "\n\n"for func in funcs:content += _to_code(func) + "\n\n"