MCPcopy
hub / github.com/openai/openai-agents-python / _strip_annotated

Function _strip_annotated

src/agents/function_schema.py:190–203  ·  view source on GitHub ↗

Returns the underlying annotation and any metadata from typing.Annotated.

(annotation: Any)

Source from the content-addressed store, hash-verified

188
189
190def _strip_annotated(annotation: Any) -> tuple[Any, tuple[Any, ...]]:
191 """Returns the underlying annotation and any metadata from typing.Annotated."""
192
193 metadata: tuple[Any, ...] = ()
194 ann = annotation
195
196 while get_origin(ann) is Annotated:
197 args = get_args(ann)
198 if not args:
199 break
200 ann = args[0]
201 metadata = (*metadata, *args[1:])
202
203 return ann, metadata
204
205
206def _extract_description_from_metadata(metadata: tuple[Any, ...]) -> str | None:

Callers 1

function_schemaFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected