mirror of
https://github.com/langchain-ai/langgraph.git
synced 2026-08-29 19:29:43 +02:00
feat: threads sorting sdk spec (#4362)
This commit is contained in:
@@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "@langchain/langgraph-sdk",
|
||||
"version": "0.0.68",
|
||||
"version": "0.0.69",
|
||||
"description": "Client library for interacting with the LangGraph API",
|
||||
"type": "module",
|
||||
"packageManager": "yarn@1.22.19",
|
||||
|
||||
+27
-17
@@ -1,42 +1,41 @@
|
||||
import {
|
||||
Assistant,
|
||||
AssistantGraph,
|
||||
AssistantVersion,
|
||||
CancelAction,
|
||||
Checkpoint,
|
||||
Config,
|
||||
Cron,
|
||||
CronCreateForThreadResponse,
|
||||
CronCreateResponse,
|
||||
DefaultValues,
|
||||
GraphSchema,
|
||||
Item,
|
||||
ListNamespaceResponse,
|
||||
Metadata,
|
||||
Run,
|
||||
RunStatus,
|
||||
SearchItemsResponse,
|
||||
Subgraphs,
|
||||
Thread,
|
||||
ThreadState,
|
||||
Cron,
|
||||
AssistantVersion,
|
||||
Subgraphs,
|
||||
Checkpoint,
|
||||
SearchItemsResponse,
|
||||
ListNamespaceResponse,
|
||||
Item,
|
||||
ThreadStatus,
|
||||
CronCreateResponse,
|
||||
CronCreateForThreadResponse,
|
||||
} from "./schema.js";
|
||||
import { AsyncCaller, AsyncCallerParams } from "./utils/async_caller.js";
|
||||
import { IterableReadableStream } from "./utils/stream.js";
|
||||
import type {
|
||||
Command,
|
||||
CronsCreatePayload,
|
||||
OnConflictBehavior,
|
||||
RunsCreatePayload,
|
||||
RunsStreamPayload,
|
||||
RunsWaitPayload,
|
||||
StreamEvent,
|
||||
CronsCreatePayload,
|
||||
OnConflictBehavior,
|
||||
Command,
|
||||
} from "./types.js";
|
||||
import { mergeSignals } from "./utils/signals.js";
|
||||
import type { StreamMode, TypedAsyncGenerator } from "./types.stream.js";
|
||||
import { AsyncCaller, AsyncCallerParams } from "./utils/async_caller.js";
|
||||
import { getEnvironmentVariable } from "./utils/env.js";
|
||||
import { _getFetchImplementation } from "./singletons/fetch.js";
|
||||
import type { TypedAsyncGenerator, StreamMode } from "./types.stream.js";
|
||||
import { mergeSignals } from "./utils/signals.js";
|
||||
import { BytesLineDecoder, SSEDecoder } from "./utils/sse.js";
|
||||
import { IterableReadableStream } from "./utils/stream.js";
|
||||
/**
|
||||
* Get the API key from the environment.
|
||||
* Precedence:
|
||||
@@ -619,6 +618,15 @@ export class ThreadsClient<
|
||||
* Must be one of 'idle', 'busy', 'interrupted' or 'error'.
|
||||
*/
|
||||
status?: ThreadStatus;
|
||||
/**
|
||||
* Sort by.
|
||||
*/
|
||||
sortBy?: "id" | "status" | "created_at" | "updated_at";
|
||||
/**
|
||||
* Sort order.
|
||||
* Must be one of 'asc' or 'desc'.
|
||||
*/
|
||||
sortOrder?: "asc" | "desc";
|
||||
}): Promise<Thread<ValuesType>[]> {
|
||||
return this.fetch<Thread<ValuesType>[]>("/threads/search", {
|
||||
method: "POST",
|
||||
@@ -627,6 +635,8 @@ export class ThreadsClient<
|
||||
limit: query?.limit ?? 10,
|
||||
offset: query?.offset ?? 0,
|
||||
status: query?.status,
|
||||
sort_by: query?.sortBy,
|
||||
sort_order: query?.sortOrder,
|
||||
},
|
||||
});
|
||||
}
|
||||
|
||||
@@ -1043,6 +1043,8 @@ class ThreadsClient:
|
||||
status: Optional[ThreadStatus] = None,
|
||||
limit: int = 10,
|
||||
offset: int = 0,
|
||||
sort_by: Literal["id", "status", "created_at", "updated_at"] = "created_at",
|
||||
sort_order: Literal["asc", "desc"] = "asc",
|
||||
headers: Optional[dict[str, str]] = None,
|
||||
) -> list[Thread]:
|
||||
"""Search for threads.
|
||||
@@ -1079,6 +1081,10 @@ class ThreadsClient:
|
||||
payload["values"] = values
|
||||
if status:
|
||||
payload["status"] = status
|
||||
if sort_by:
|
||||
payload["sort_by"] = sort_by
|
||||
if sort_order:
|
||||
payload["sort_order"] = sort_order
|
||||
return await self.http.post(
|
||||
"/threads/search",
|
||||
json=payload,
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
[tool.poetry]
|
||||
name = "langgraph-sdk"
|
||||
version = "0.1.61"
|
||||
version = "0.1.62"
|
||||
description = "SDK for interacting with LangGraph API"
|
||||
authors = []
|
||||
license = "MIT"
|
||||
|
||||
Reference in New Issue
Block a user