fix(sdk-js): match schema types, bump to 0.0.12

This commit is contained in:
Tat Dat Duong
2024-09-25 17:33:13 +02:00
parent 6136eb7471
commit 68fb04bb0c
2 changed files with 93 additions and 9 deletions
+1 -1
View File
@@ -1,6 +1,6 @@
{
"name": "@langchain/langgraph-sdk",
"version": "0.0.11",
"version": "0.0.12",
"description": "Client library for interacting with the LangGraph API",
"type": "module",
"packageManager": "yarn@1.22.19",
+92 -8
View File
@@ -12,6 +12,8 @@ type RunStatus =
type ThreadStatus = "idle" | "busy" | "interrupted";
type MultitaskStrategy = "reject" | "interrupt" | "rollback" | "enqueue";
export interface Config {
/**
* Tags for this call and any sub-calls (eg. a Chain calling an LLM).
@@ -76,60 +78,142 @@ export interface GraphSchema {
export type Metadata = Optional<Record<string, unknown>>;
export interface AssistantBase {
/** The ID of the assistant. */
assistant_id: string;
/** The ID of the graph. */
graph_id: string;
/** The assistant config. */
config: Config;
/** The time the assistant was created. */
created_at: string;
/** The assistant metadata. */
metadata: Metadata;
/** The version of the assistant. */
version: number;
}
export interface AssistantVersion extends AssistantBase {}
export interface Assistant extends AssistantBase {
/** The last time the assistant was updated. */
updated_at: string;
/** The name of the assistant */
name: string;
}
export type AssistantGraph = Record<string, Array<Record<string, unknown>>>;
export interface Thread {
export interface Thread<ValuesType = DefaultValues> {
/** The ID of the thread. */
thread_id: string;
/** The time the thread was created. */
created_at: string;
/** The last time the thread was updated. */
updated_at: string;
/** The thread metadata. */
metadata: Metadata;
/** The status of the thread */
status: ThreadStatus;
/** The current state of the thread. */
values: ValuesType;
}
export interface Cron {
/** The ID of the cron */
cron_id: string;
/** The ID of the thread */
thread_id: Optional<string>;
/** The end date to stop running the cron. */
end_time: Optional<string>;
/** The schedule to run, cron format. */
schedule: string;
/** The time the cron was created. */
created_at: string;
/** The last time the cron was updated. */
updated_at: string;
/** The run payload to use for creating new run. */
payload: Record<string, unknown>;
}
export type DefaultValues = Record<string, unknown>[] | Record<string, unknown>;
export interface ThreadState<ValuesType = DefaultValues> {
/** The state values */
values: ValuesType;
next: string[];
checkpoint_id: string;
metadata: Metadata;
created_at: Optional<string>;
parent_checkpoint_id: Optional<string>;
config: Config;
parent_config?: Config;
/** The next nodes to execute. If empty, the thread is done until new input is received */
next: string[];
/** Checkpoint of the thread state */
checkpoint: Checkpoint;
/** Metadata for this state */
metadata: Metadata;
/** Time of state creation */
created_at: Optional<string>;
/** The parent checkpoint. If missing, this is the root checkpoint */
parent_checkpoint: Optional<Checkpoint>;
/** Tasks to execute in this step. If already attempted, may contain an error */
tasks: Array<ThreadTask>;
}
export interface ThreadTask {
id: string;
name: string;
error: Optional<string>;
interrupts: Array<Record<string, unknown>>;
checkpoint: Optional<Checkpoint>;
state: Optional<ThreadState>;
}
export interface Run {
/** The ID of the run */
run_id: string;
/** The ID of the thread */
thread_id: string;
/** The assistant that wwas used for this run */
assistant_id: string;
/** The time the run was created */
created_at: string;
/** The last time the run was updated */
updated_at: string;
/** The status of the run. */
status: RunStatus;
/** Run metadata */
metadata: Metadata;
/** Strategy to handle concurrent runs on the same thread */
multitask_strategy: Optional<MultitaskStrategy>;
}
export interface Checkpoint {
thread_id: string;
checkpoint_ns: string;
checkpoint_id: Optional<string>;
checkpoint_map: Optional<Record<string, unknown>>;
}