Skip to content

Commit

Permalink
feat(js-sdk): Add status field in search args
Browse files Browse the repository at this point in the history
  • Loading branch information
bracesproul committed Nov 6, 2024
1 parent f7a93f9 commit 82c9aa8
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 1 deletion.
7 changes: 7 additions & 0 deletions libs/sdk-js/src/client.ts
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ import {
SearchItemsResponse,
ListNamespaceResponse,
Item,
ThreadStatus,
} from "./schema.js";
import { AsyncCaller, AsyncCallerParams } from "./utils/async_caller.js";
import {
Expand Down Expand Up @@ -515,13 +516,19 @@ 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",
json: {
metadata: query?.metadata ?? undefined,
limit: query?.limit ?? 10,
offset: query?.offset ?? 0,
status: query?.status,
},
});
}
Expand Down
2 changes: 1 addition & 1 deletion libs/sdk-js/src/schema.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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";

Expand Down

0 comments on commit 82c9aa8

Please sign in to comment.