MCPcopy
hub / github.com/OpenBMB/ChatDev / _resolve_annotations

Function _resolve_annotations

utils/function_catalog.py:176–192  ·  view source on GitHub ↗
(fn: Any)

Source from the content-addressed store, hash-verified

174
175
176def _resolve_annotations(fn: Any) -> Mapping[str, Any]:
177 fallback = getattr(fn, "__annotations__", {}) or {}
178 get_annotations = getattr(inspect, "get_annotations", None)
179 if get_annotations is None:
180 return fallback
181 try:
182 return inspect.get_annotations(fn, eval_str=True, include_extras=True)
183 except TypeError:
184 try:
185 return inspect.get_annotations(fn, eval_str=True)
186 except TypeError:
187 try:
188 return inspect.get_annotations(fn)
189 except Exception:
190 return fallback
191 except Exception:
192 return fallback
193
194
195def _build_parameters_schema(signature: inspect.Signature, annotations: Mapping[str, Any]) -> Dict[str, Any]:

Callers 1

_build_function_metadataFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected