get_function_schema

get_function_schema(
    f: Callable[..., Any],
    *,
    name: str | None = None,
    description: str
) -> dict[str, typing.Any]

Get a JSON schema for a function as defined by the OpenAI API

Parameters:
NameDescription
fThe function to get the JSON schema for

Type: Callable[..., Any]
nameThe name of the function

Type: str | None

Default: None
descriptionThe description of the function

Type: str
Returns:
TypeDescription
dict[str, typing.Any]A JSON schema for the function