Method | Purpose | |
---|---|---|
create_messages | Generates a verbatim, chat-formatted rendition of the document. | Retrieval-augmented generation or “chat with your PDF”. |
create_inputs | Wraps the document in a developer prompt targeting a supplied JSON schema. | Function-calling or structured extraction with JSON mode. |
extract | Executes the extraction and returns the parsed object (optionally with consensus voting). | One-step OCR + LLM parsing when only the structured output is required. |
parse | Converts any document into structured text content with page-by-page extraction. | Perfect for RAG, text extraction, and preparing documents for further processing or indexing. |
MIMEData
objects, which encapsulate the file content and metadata. This structure allows you to work with documents in a consistent way regardless of their original format. The url
field directly matches OpenAI’s expected format for image inputs.
document
parameter as a file path, bytes, or a PIL.Image.Image
object, and we will automatically convert it to a MIMEData
object for you.