Awaiting completion with threads/runs now works with the "requires_action" status
This commit is contained in:
@@ -0,0 +1,5 @@
|
|||||||
|
---
|
||||||
|
"@trigger.dev/openai": patch
|
||||||
|
---
|
||||||
|
|
||||||
|
Awaiting completion with threads/runs now works with the "requires_action" status
|
||||||
@@ -16,7 +16,7 @@ export class Threads {
|
|||||||
constructor(
|
constructor(
|
||||||
private runTask: OpenAIRunTask,
|
private runTask: OpenAIRunTask,
|
||||||
private options: OpenAIIntegrationOptions
|
private options: OpenAIIntegrationOptions
|
||||||
) { }
|
) {}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Create a thread and run it in one task.
|
* Create a thread and run it in one task.
|
||||||
@@ -113,7 +113,7 @@ export class Threads {
|
|||||||
responseFilter: {
|
responseFilter: {
|
||||||
status: [200],
|
status: [200],
|
||||||
body: {
|
body: {
|
||||||
status: ["completed", "expired", "cancelled", "failed"],
|
status: ["completed", "expired", "cancelled", "failed", "requires_action"],
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
});
|
});
|
||||||
@@ -262,7 +262,7 @@ class Runs {
|
|||||||
constructor(
|
constructor(
|
||||||
private runTask: OpenAIRunTask,
|
private runTask: OpenAIRunTask,
|
||||||
private options: OpenAIIntegrationOptions
|
private options: OpenAIIntegrationOptions
|
||||||
) { }
|
) {}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Creates a run and waits for it to complete by polling in the background.
|
* Creates a run and waits for it to complete by polling in the background.
|
||||||
@@ -306,7 +306,7 @@ class Runs {
|
|||||||
responseFilter: {
|
responseFilter: {
|
||||||
status: [200],
|
status: [200],
|
||||||
body: {
|
body: {
|
||||||
status: ["completed", "expired", "cancelled", "failed"],
|
status: ["completed", "expired", "cancelled", "failed", "requires_action"],
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
});
|
});
|
||||||
@@ -355,7 +355,7 @@ class Runs {
|
|||||||
responseFilter: {
|
responseFilter: {
|
||||||
status: [200],
|
status: [200],
|
||||||
body: {
|
body: {
|
||||||
status: ["completed", "expired", "cancelled", "failed"],
|
status: ["completed", "expired", "cancelled", "failed", "requires_action"],
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
});
|
});
|
||||||
@@ -552,7 +552,7 @@ class Messages {
|
|||||||
constructor(
|
constructor(
|
||||||
private runTask: OpenAIRunTask,
|
private runTask: OpenAIRunTask,
|
||||||
private options: OpenAIIntegrationOptions
|
private options: OpenAIIntegrationOptions
|
||||||
) { }
|
) {}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Returns messages for a given thread.
|
* Returns messages for a given thread.
|
||||||
@@ -562,12 +562,12 @@ class Messages {
|
|||||||
threadId: string,
|
threadId: string,
|
||||||
params?: Prettify<OpenAI.Beta.Threads.MessageListParams>,
|
params?: Prettify<OpenAI.Beta.Threads.MessageListParams>,
|
||||||
options?: OpenAIRequestOptions
|
options?: OpenAIRequestOptions
|
||||||
): Promise<OpenAI.Beta.Threads.ThreadMessage[]>
|
): Promise<OpenAI.Beta.Threads.ThreadMessage[]>;
|
||||||
list(
|
list(
|
||||||
key: IntegrationTaskKey,
|
key: IntegrationTaskKey,
|
||||||
threadId: string,
|
threadId: string,
|
||||||
options?: OpenAIRequestOptions
|
options?: OpenAIRequestOptions
|
||||||
): Promise<OpenAI.Beta.Threads.ThreadMessage[]>
|
): Promise<OpenAI.Beta.Threads.ThreadMessage[]>;
|
||||||
async list(
|
async list(
|
||||||
key: IntegrationTaskKey,
|
key: IntegrationTaskKey,
|
||||||
threadId: string,
|
threadId: string,
|
||||||
@@ -615,7 +615,7 @@ class Messages {
|
|||||||
async listAll(
|
async listAll(
|
||||||
key: IntegrationTaskKey,
|
key: IntegrationTaskKey,
|
||||||
threadId: string,
|
threadId: string,
|
||||||
options: OpenAIRequestOptions = {},
|
options: OpenAIRequestOptions = {}
|
||||||
): Promise<OpenAI.Beta.Threads.ThreadMessage[]> {
|
): Promise<OpenAI.Beta.Threads.ThreadMessage[]> {
|
||||||
return this.runTask(
|
return this.runTask(
|
||||||
key,
|
key,
|
||||||
|
|||||||
Reference in New Issue
Block a user