We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
2 parents 46303ab + 6360935 commit 4123f9aCopy full SHA for 4123f9a
function_schema/core.py
@@ -9,6 +9,7 @@
9
Union,
10
get_args,
11
get_origin,
12
+ get_type_hints,
13
)
14
15
from .types import FunctionSchema, Doc
@@ -81,9 +82,15 @@ def get_function_schema(
81
82
"properties": {},
83
"required": [],
84
}
85
+ type_hints = get_type_hints(func, include_extras=True)
86
for name, param in params.items():
- param_args = get_args(param.annotation)
- is_annotated = get_origin(param.annotation) is Annotated
87
+ type_hint = type_hints.get(name)
88
+ if type_hint is not None:
89
+ param_args = get_args(type_hint)
90
+ is_annotated = get_origin(type_hint) is Annotated
91
+ else:
92
+ param_args = []
93
+ is_annotated = False
94
95
enum_ = None
96
default_value = inspect._empty
0 commit comments