Implementation:Openai Openai node Files WaitForProcessing
Appearance
| Knowledge Sources | |
|---|---|
| Domains | Fine_Tuning, Async_Processing |
| Last Updated | 2026-02-15 00:00 GMT |
Overview
Concrete tool for polling file processing status until completion provided by the openai-node SDK.
Description
The Files.waitForProcessing() method polls the /files/{id} endpoint at configurable intervals until the file reaches processed status or the timeout is exceeded. It also supports Files.retrieve() for a single status check.
Usage
Call client.files.waitForProcessing(fileId) after uploading a training file and before creating a fine-tuning job.
Code Reference
Source Location
- Repository: openai-node
- File: src/resources/files.ts
- Lines: L44-46 (retrieve), L79-100 (waitForProcessing)
Signature
class Files extends APIResource {
retrieve(
fileID: string,
options?: RequestOptions,
): APIPromise<FileObject>;
waitForProcessing(
id: string,
opts?: { pollInterval?: number; maxWait?: number },
): Promise<FileObject>;
}
Import
import OpenAI from 'openai';
// Access via: client.files.waitForProcessing(...)
I/O Contract
Inputs
| Name | Type | Required | Description |
|---|---|---|---|
| id | string | Yes | File ID from upload |
| pollInterval | number | No (default 5000ms) | Polling interval in milliseconds |
| maxWait | number | No (default 30 minutes) | Maximum wait time in milliseconds |
Outputs
| Name | Type | Description |
|---|---|---|
| fileObject | FileObject | File with updated status field ('processed') |
Usage Examples
import OpenAI from 'openai';
const client = new OpenAI();
// Upload file
const file = await client.files.create({
file: fs.createReadStream('training.jsonl'),
purpose: 'fine-tune',
});
// Wait for processing
const processedFile = await client.files.waitForProcessing(file.id);
console.log('Status:', processedFile.status); // 'processed'
Related Pages
Implements Principle
Page Connections
Double-click a node to navigate. Hold to expand connections.
Principle
Implementation
Heuristic
Environment