MCPcopy Index your code
hub / github.com/triggerdotdev/trigger.dev / waitForProcessing

Method waitForProcessing

integrations/openai/src/files.ts:146–191  ·  view source on GitHub ↗
(
    key: IntegrationTaskKey,
    id: string,
    options: OpenAIRequestOptions = {}
  )

Source from the content-addressed store, hash-verified

144 }
145
146 async waitForProcessing(
147 key: IntegrationTaskKey,
148 id: string,
149 options: OpenAIRequestOptions = {}
150 ): Promise<OpenAI.Files.FileObject> {
151 return this.runTask(
152 key,
153 async (client, task, io) => {
154 const url = createBackgroundFetchUrl(
155 client,
156 `/files/${id}`,
157 this.options.defaultQuery,
158 options
159 );
160
161 const headers = this.options.defaultHeaders ?? {};
162
163 const processedFile = await io.backgroundPoll<OpenAI.Files.FileObject>("poll", {
164 url,
165 requestInit: {
166 headers: createBackgroundFetchHeaders(client, task.idempotencyKey, headers, options),
167 },
168 interval: 10,
169 timeout: 600,
170 responseFilter: {
171 status: [200],
172 body: {
173 status: ["processed", "error", "deleted"],
174 },
175 },
176 });
177
178 return processedFile;
179 },
180 {
181 name: "Wait for processing",
182 properties: [
183 {
184 label: "fileId",
185 text: id,
186 },
187 ],
188 },
189 handleOpenAIError
190 );
191 }
192
193 retrieve(
194 key: IntegrationTaskKey,

Callers

nothing calls this directly

Calls 3

createBackgroundFetchUrlFunction · 0.90
runTaskMethod · 0.45

Tested by

no test coverage detected