Beyond Chat: Processing Images, PDFs, and Documents with the OpenAI Adapter in Oracle Integration Cloud
Author(s): Sarfaraz Merchant Originally published on Towards AI. Beyond Chat: Processing Images, PDFs, and Documents with the OpenAI Adapter in Oracle Integration Cloud Exploring File Uploads, Image Processing, and Document Extraction using the Native OpenAI Adapter in OIC. When Oracle introduced the OpenAI Adapter in Oracle Integration Cloud (OIC), most of the examples I came across focused on text generation and chatbot-style interactions. Naturally, I assumed that if I wanted to process files such as images, PDFs, or Word documents, I would probably need to build custom REST integrations and call the OpenAI APIs directly. While exploring the adapter, I noticed a few operations related to file management. That got me curious. Can the OpenAI Adapter upload files? Can those files be processed later using a File ID? Can we extract structured data from invoices, images, or PDF documents without building custom REST calls? To answer these questions, I decided to build a small proof of concept. The results were quite interesting. Using only the native OpenAI Adapter, I was able to: Upload files to OpenAI Retrieve and reuse File IDs Process images and PDF documents Extract structured JSON responses Analyze multilingual content, including Arabic and Persian documents In this article, I’ll walk through the approach, the architecture, and a few practical use cases that I tested while building the POC. By the end, you’ll have a reusable pattern that can be applied to invoice extraction, document processing, content analysis, and many other AI-powered integration scenarios. OpenAI Adapter provides native operations for uploading and processing files. Understanding the Architecture While building the POC, I decided to separate the solution into two integrations. The first integration is responsible for uploading a file to OpenAI and obtaining a File ID. The second integration uses that File ID together with a prompt to process the document and return a structured response. I found this approach cleaner because the uploaded file becomes a reusable asset. The same file can be analyzed multiple times using different prompts without uploading it again. Integration 1 — Upload File The first integration accepts a file and uploads it using the OpenAI Adapter’s Upload File operation. Supported examples include: Images (JPG, PNG) PDF documents Microsoft Word documents The adapter returns a unique File ID similar to: file-xxxxxxxxxxxxxxxx This File ID can then be stored, logged, or passed to another integration for processing. Integration 2 — Process File The second integration receives: A File ID Processing instructions It then invokes the OpenAI Adapter using the Responses operation. Depending on the type of document and the prompt provided, OpenAI can: Extract invoice data Analyze documents Summarize content Return structured JSON Process multilingual text The response can be consumed directly within OIC and mapped to downstream systems. Solution Architecture. High-Level Flow The overall process looks like this: Document(Image/PDF/DOCX) | v+------------------+| Upload File || OpenAI Adapter |+------------------+ | v File ID | v+------------------+| Responses API || OpenAI Adapter |+------------------+ | v Structured Output (JSON) One thing I particularly liked about this pattern is that it relies entirely on the native OpenAI Adapter. There are no custom REST calls, no manual API payload construction, and no need to manage Base64-encoded content. Upload FIle to OpenAI Account. Process OpenAI Files. Building Integration 1 — Uploading Files to OpenAI The first integration is responsible for uploading a document to OpenAI and obtaining a File ID that can be reused later. In my case, I tested the following file types: JPG images PNG images PDF documents Microsoft Word documents Step 1 — Create the OpenAI Connection Start by creating a connection using the OpenAI Adapter. Provide: OpenAI API Key Connection Name Security Configuration Once the connection is successfully tested, it can be used within your integration. OpenAI Connection. Step 2 — Create the Upload File Integration Create an App-Driven Orchestration. 2.1 Add Trigger Rest Adapter to Accept File as input with: – Select the multipart attachment processing options Request is multipart with payload Multipart request is of type multipart/form-data with HTML form payload 2.2 Add the OpenAI Adapter and select the following operation: Upload File This operation allows OIC to upload a file directly to OpenAI without invoking the REST API manually. Step 3 — Configure the Request Mapping The Upload File operation expects two important pieces of information: Purpose The purpose determines how the uploaded file will be used. For image processing: vision For document processing (PDF, DOCX, TXT, etc.): user_data File Content Map the incoming attachment or file reference to the adapter’s File element. Example mapping: RequestWrapper ├── Purpose └── File └── streamReference The adapter handles the upload process and stores the file within OpenAI. Upload File Mapper. Step 4 — Execute the Integration After activation, invoke the integration with a sample document. If the upload succeeds, the response contains a File ID. Example: file-3UoRxBRyqV7pJRgPC4WSgi This File ID becomes the bridge between the upload step and the document processing step. Uploaded File to OpenAI Accuont. Storage FIles in OpenAI Account. Lesson Learned: File Names Matter While testing the Upload File operation, I ran into an issue that took a little time to troubleshoot. Some uploads failed when the file name contained spaces or special characters. For example: WhatsApp Image 2026-06-05 at 7.25.23 PM.jpeg Error if the File Name contains space. After renaming the file to a simpler format without spaces or special characters, the upload completed successfully. Example: invoice_20260605.jpeg If you encounter unexpected upload failures, one of the first things to check is the file name. Although this may vary depending on the adapter version and environment, using clean file names is a good practice and helped avoid issues during testing. Why the File ID Matters Initially, I assumed I would need to send Base64 content to OpenAI every time I wanted to analyze a document. The File ID approach is much cleaner. Once the document is uploaded: The file can be reused Multiple prompts can be executed against the same file There is no need to repeatedly transfer the document This makes the […]
