Resolve postponed annotations before validation and schema creation
This commit is contained in:
parent
691140f9f8
commit
5e819525db
1 changed files with 37 additions and 4 deletions
7
great_ai/helper/get_function_type_hints.py
Normal file
7
great_ai/helper/get_function_type_hints.py
Normal file
|
|
@ -0,0 +1,7 @@
|
|||
import inspect
|
||||
from typing import Any, Callable, Dict, get_type_hints
|
||||
|
||||
|
||||
def get_function_type_hints(func: Callable) -> Dict[str, Any]:
|
||||
"""Resolve postponed annotations in the original function's namespace."""
|
||||
return get_type_hints(inspect.unwrap(func), include_extras=True)
|
||||
Loading…
Reference in a new issue