feat(js-sdk): Add status field in search args

This commit is contained in:
bracesproul
2024-11-05 16:03:24 -08:00
parent f7a93f99ef
commit 82c9aa8485
2 changed files with 8 additions and 1 deletions
+7
View File
@@ -15,6 +15,7 @@ import {
SearchItemsResponse,
ListNamespaceResponse,
Item,
ThreadStatus,
} from "./schema.js";
import { AsyncCaller, AsyncCallerParams } from "./utils/async_caller.js";
import {
@@ -515,6 +516,11 @@ export class ThreadsClient extends BaseClient {
* Offset to start from.
*/
offset?: number;
/**
* Thread status to filter on.
* Must be one of 'idle', 'busy', 'interrupted' or 'error'.
*/
status?: ThreadStatus;
}): Promise<Thread[]> {
return this.fetch<Thread[]>("/threads/search", {
method: "POST",
@@ -522,6 +528,7 @@ export class ThreadsClient extends BaseClient {
metadata: query?.metadata ?? undefined,
limit: query?.limit ?? 10,
offset: query?.offset ?? 0,
status: query?.status,
},
});
}
+1 -1
View File
@@ -10,7 +10,7 @@ type RunStatus =
| "timeout"
| "interrupted";
type ThreadStatus = "idle" | "busy" | "interrupted" | "error";
export type ThreadStatus = "idle" | "busy" | "interrupted" | "error";
type MultitaskStrategy = "reject" | "interrupt" | "rollback" | "enqueue";