langchain.chains.openai_functions.openapi.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 – 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.