* Returns all messages for a given thread.
(
key: IntegrationTaskKey,
threadId: string,
options: OpenAIRequestOptions = {}
)
| 613 | * Returns all messages for a given thread. |
| 614 | */ |
| 615 | async listAll( |
| 616 | key: IntegrationTaskKey, |
| 617 | threadId: string, |
| 618 | options: OpenAIRequestOptions = {} |
| 619 | ): Promise<OpenAI.Beta.Threads.ThreadMessage[]> { |
| 620 | return this.runTask( |
| 621 | key, |
| 622 | async (client, task, io) => { |
| 623 | const { data: page, response } = await client.beta.threads.messages |
| 624 | .list(threadId, { |
| 625 | idempotencyKey: task.idempotencyKey, |
| 626 | ...options, |
| 627 | }) |
| 628 | .withResponse(); |
| 629 | |
| 630 | const allMessages = []; |
| 631 | |
| 632 | for await (const message of page) { |
| 633 | allMessages.push(message); |
| 634 | } |
| 635 | |
| 636 | task.outputProperties = createTaskOutputProperties(undefined, response.headers); |
| 637 | |
| 638 | return allMessages; |
| 639 | }, |
| 640 | { |
| 641 | name: "List All Messages", |
| 642 | properties: [{ label: "threadId", text: threadId }], |
| 643 | }, |
| 644 | handleOpenAIError |
| 645 | ); |
| 646 | } |
| 647 | |
| 648 | /** |
| 649 | * Create a message. |
nothing calls this directly
no test coverage detected