mirror of
https://github.com/langchain-ai/langgraphjs.git
synced 2026-07-22 17:15:25 -04:00
chore: updated types (#1723)
This commit is contained in:
@@ -0,0 +1,5 @@
|
||||
---
|
||||
"@langchain/langgraph-api": patch
|
||||
---
|
||||
|
||||
Updated types to match python api
|
||||
@@ -14,6 +14,7 @@ import { getRuntimeGraphSchema } from "../graph/parser/index.mjs";
|
||||
import { HTTPException } from "hono/http-exception";
|
||||
import * as schemas from "../schemas.mjs";
|
||||
import { assistants } from "../storage/context.mjs";
|
||||
import { AssistantSelectField } from "../storage/types.mjs";
|
||||
const api = new Hono();
|
||||
|
||||
const RunnableConfigSchema = z.object({
|
||||
@@ -82,7 +83,7 @@ api.post(
|
||||
offset: payload.offset ?? 0,
|
||||
sort_by: payload.sort_by,
|
||||
sort_order: payload.sort_order,
|
||||
select: payload.select,
|
||||
select: payload.select as AssistantSelectField[],
|
||||
},
|
||||
c.var.auth
|
||||
)) {
|
||||
|
||||
@@ -7,7 +7,7 @@ import { z } from "zod";
|
||||
import * as schemas from "../schemas.mjs";
|
||||
import { stateSnapshotToThreadState } from "../state.mjs";
|
||||
import { threads } from "../storage/context.mjs";
|
||||
import type { RunnableConfig } from "../storage/types.mjs";
|
||||
import type { RunnableConfig, ThreadSelectField } from "../storage/types.mjs";
|
||||
import { jsonExtra } from "../utils/hono.mjs";
|
||||
|
||||
const api = new Hono();
|
||||
@@ -52,6 +52,7 @@ api.post(
|
||||
offset: payload.offset ?? 0,
|
||||
sort_by: payload.sort_by ?? "created_at",
|
||||
sort_order: payload.sort_order ?? "desc",
|
||||
select: payload.select as ThreadSelectField[],
|
||||
},
|
||||
c.var.auth
|
||||
)) {
|
||||
|
||||
@@ -369,6 +369,7 @@ export const ThreadSearchRequest = z
|
||||
.describe("Sort by field.")
|
||||
.optional(),
|
||||
sort_order: z.enum(["asc", "desc"]).describe("Sort order.").optional(),
|
||||
select: z.array(z.string()).optional(),
|
||||
})
|
||||
.describe("Payload for listing threads.");
|
||||
|
||||
|
||||
@@ -17,6 +17,29 @@ export type StorageEnv = {
|
||||
|
||||
export type Metadata = Record<string, unknown>;
|
||||
|
||||
export type AssistantSelectField =
|
||||
| "assistant_id"
|
||||
| "graph_id"
|
||||
| "name"
|
||||
| "description"
|
||||
| "config"
|
||||
| "context"
|
||||
| "created_at"
|
||||
| "updated_at"
|
||||
| "metadata"
|
||||
| "version";
|
||||
|
||||
export type ThreadSelectField =
|
||||
| "thread_id"
|
||||
| "created_at"
|
||||
| "updated_at"
|
||||
| "metadata"
|
||||
| "config"
|
||||
| "context"
|
||||
| "status"
|
||||
| "values"
|
||||
| "interrupts";
|
||||
|
||||
export type ThreadStatus = "idle" | "busy" | "interrupted" | "error";
|
||||
|
||||
export type RunStatus =
|
||||
@@ -292,6 +315,7 @@ export interface ThreadsRepo {
|
||||
offset: number;
|
||||
sort_by?: "thread_id" | "status" | "created_at" | "updated_at";
|
||||
sort_order?: "asc" | "desc";
|
||||
select?: ThreadSelectField[];
|
||||
},
|
||||
auth: AuthContext | undefined
|
||||
): AsyncGenerator<{ thread: Thread; total: number }>;
|
||||
@@ -397,7 +421,7 @@ export interface AssistantsRepo {
|
||||
| "name"
|
||||
| "graph_id";
|
||||
sort_order?: "asc" | "desc";
|
||||
select?: string[];
|
||||
select?: AssistantSelectField[];
|
||||
},
|
||||
auth: AuthContext | undefined
|
||||
): AsyncGenerator<{ assistant: Assistant; total: number }>;
|
||||
|
||||
Reference in New Issue
Block a user