openapi_spec_to_openai_fn#

langchain.chains.openai_functions.openapi.openapi_spec_to_openai_fn(
spec: OpenAPISpec,
) tuple[list[dict[str, Any]], Callable][source]#

OpenAPI spec to OpenAI function JSON Schema.

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]