Skip to content
Draft
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 7 additions & 5 deletions flo_ai/flo_ai/arium/llm_router.py
Original file line number Diff line number Diff line change
Expand Up @@ -1038,12 +1038,14 @@ async def wrapper(
):
return await router_instance.route(memory, execution_context)

# Preserve the original function's type annotations including return type
wrapper.__annotations__ = func.__annotations__.copy()

# Ensure the return annotation is properly set
# Only copy the return annotation if needed for validation
# Avoid copying arbitrary string annotations which could be evaluated
# by get_type_hints() and potentially execute code
if 'return' in func.__annotations__:
wrapper.__annotations__['return'] = func.__annotations__['return']
return_annotation = func.__annotations__['return']
# Only copy if it's an actual type object, not a forward reference string
if not isinstance(return_annotation, str):
wrapper.__annotations__['return'] = return_annotation

return wrapper

Expand Down
Loading