Toggle Menu
Prev Up Next

# `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]
  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]