-
Notifications
You must be signed in to change notification settings - Fork 493
Closed
Labels
bugSomething isn't workingSomething isn't working
Description
Describe the bug
No response
Steps to reproduce
from autogen.agentchat import UserProxyAgent
from typing import Annotated, Optional
user_proxy = UserProxyAgent(name='user_proxy')
@user_proxy.register_for_execution()
def func(
param1: Annotated[Optional[str], "my str"] = None
) -> Optional[str]:
return param1Traceback (most recent call last):
File ~/projects/ag2/.venv/lib/python3.10/site-packages/IPython/core/interactiveshell.py:3577 in run_code
exec(code_obj, self.user_global_ns, self.user_ns)
Cell In[1], [line 7](vscode-notebook-cell:?execution_count=1&line=7)
def func(
File ~/projects/ag2/autogen/agentchat/conversable_agent.py:2767 in _decorator
tool = Tool(func_or_tool=func_or_tool, name=name)
File ~/projects/ag2/autogen/tools/tool.py:50 in __init__
self._func = inject_params(func_or_tool)
File ~/projects/ag2/autogen/tools/dependency_injection.py:199 in inject_params
f = inject(f)
File ~/projects/ag2/.venv/lib/python3.10/site-packages/fast_depends/use.py:99 in inject
return decorator(func)
File ~/projects/ag2/.venv/lib/python3.10/site-packages/fast_depends/use.py:127 in func_wrapper
build_call_model(
File ~/projects/ag2/.venv/lib/python3.10/site-packages/fast_depends/core/build.py:64 in build_call_model
typed_params, return_annotation = get_typed_signature(call)
File ~/projects/ag2/.venv/lib/python3.10/site-packages/fast_depends/utils.py:87 in get_typed_signature
typed_params = [
File ~/projects/ag2/.venv/lib/python3.10/site-packages/fast_depends/utils.py:92 in <listcomp>
annotation=get_typed_annotation(
File ~/projects/ag2/.venv/lib/python3.10/site-packages/fast_depends/utils.py:137 in get_typed_annotation
solved_args = [get_typed_annotation(x, globalns, locals) for x in args]
File ~/projects/ag2/.venv/lib/python3.10/site-packages/fast_depends/utils.py:137 in <listcomp>
solved_args = [get_typed_annotation(x, globalns, locals) for x in args]
File ~/projects/ag2/.venv/lib/python3.10/site-packages/fast_depends/utils.py:131 in get_typed_annotation
annotation = ForwardRef(annotation)
File /opt/homebrew/Cellar/[email protected]/3.10.16/Frameworks/Python.framework/Versions/3.10/lib/python3.10/typing.py:670 in __init__
raise SyntaxError(f"Forward reference must be an expression -- got {arg!r}")
File <string>
SyntaxError: Forward reference must be an expression -- got 'my str'Model Used
No response
Expected Behavior
No response
Screenshots and logs
No response
Additional Information
No response
Metadata
Metadata
Assignees
Labels
bugSomething isn't workingSomething isn't working
Type
Projects
Status
Done