* Retrieves a run.
(
key: IntegrationTaskKey,
threadId: string,
runId: string,
options: OpenAIRequestOptions = {}
)
| 409 | * Retrieves a run. |
| 410 | */ |
| 411 | async retrieve( |
| 412 | key: IntegrationTaskKey, |
| 413 | threadId: string, |
| 414 | runId: string, |
| 415 | options: OpenAIRequestOptions = {} |
| 416 | ): Promise<OpenAI.Beta.Threads.Run> { |
| 417 | return this.runTask( |
| 418 | key, |
| 419 | async (client, task, io) => { |
| 420 | const { data, response } = await client.beta.threads.runs |
| 421 | .retrieve(threadId, runId, { |
| 422 | idempotencyKey: task.idempotencyKey, |
| 423 | ...options, |
| 424 | }) |
| 425 | .withResponse(); |
| 426 | |
| 427 | task.outputProperties = createTaskOutputProperties(undefined, response.headers); |
| 428 | |
| 429 | return data; |
| 430 | }, |
| 431 | { |
| 432 | name: "Retrieve Run", |
| 433 | properties: [ |
| 434 | { label: "threadId", text: threadId }, |
| 435 | { label: "runId", text: runId }, |
| 436 | ], |
| 437 | }, |
| 438 | handleOpenAIError |
| 439 | ); |
| 440 | } |
| 441 | |
| 442 | /** |
| 443 | * Cancels a run that is `in_progress`. |
no test coverage detected