openapi_spec_to_openai_fn#

langchain.chains.openai_functions.openapi.openapi_spec_to_openai_fn(
spec: OpenAPISpec,
) tuple[list[dict[str, Any]], Callable][source]#
Convert a valid OpenAPI spec to the JSON Schema format expected for OpenAI

functions.

Parameters:

spec (OpenAPISpec) – OpenAPI spec to convert.

Returns:

Tuple of the OpenAI functions JSON schema and a default function for executing

a request based on the OpenAI function schema.

Return type:

tuple[list[dict[str, Any]], Callable]