Merge pull request #2348 from langchain-ai/brace/filter-status-js

feat(js-sdk): Add status field in search args
This commit is contained in:
Brace Sproul
2024-11-05 16:40:23 -08:00
committed by GitHub
3 changed files with 9 additions and 1 deletions
+7
View File
@@ -16,6 +16,7 @@ import {
SearchItemsResponse,
ListNamespaceResponse,
Item,
ThreadStatus,
} from "./schema.js";
import { AsyncCaller, AsyncCallerParams } from "./utils/async_caller.js";
import {
@@ -516,6 +517,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",
@@ -523,6 +529,7 @@ export class ThreadsClient extends BaseClient {
metadata: query?.metadata ?? undefined,
limit: query?.limit ?? 10,
offset: query?.offset ?? 0,
status: query?.status,
},
});
}
+1
View File
@@ -11,6 +11,7 @@ export type {
Run,
Thread,
ThreadState,
ThreadStatus,
Cron,
Checkpoint,
} from "./schema.js";
+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";