@langchain/langgraph-sdk
Version:
Client library for interacting with the LangGraph API
155 lines (154 loc) • 4.86 kB
TypeScript
import { Assistant, AssistantGraph, AssistantSelectField, AssistantSortBy, AssistantVersion, AssistantsSearchResponse, Config, GraphSchema, Metadata, SortOrder, Subgraphs } from "../../schema.js";
import { OnConflictBehavior } from "../../types.js";
import { BaseClient } from "../base.js";
//#region src/client/assistants/index.d.ts
declare class AssistantsClient extends BaseClient {
/**
* Get an assistant by ID.
*
* @param assistantId The ID of the assistant.
* @returns Assistant
*/
get(assistantId: string, options?: {
signal?: AbortSignal;
}): Promise<Assistant>;
/**
* Get the JSON representation of the graph assigned to a runnable
* @param assistantId The ID of the assistant.
* @param options.xray Whether to include subgraphs in the serialized graph representation. If an integer value is provided, only subgraphs with a depth less than or equal to the value will be included.
* @returns Serialized graph
*/
getGraph(assistantId: string, options?: {
xray?: boolean | number;
signal?: AbortSignal;
}): Promise<AssistantGraph>;
/**
* Get the state and config schema of the graph assigned to a runnable
* @param assistantId The ID of the assistant.
* @returns Graph schema
*/
getSchemas(assistantId: string, options?: {
signal?: AbortSignal;
}): Promise<GraphSchema>;
/**
* Get the schemas of an assistant by ID.
*
* @param assistantId The ID of the assistant to get the schema of.
* @param options Additional options for getting subgraphs, such as namespace or recursion extraction.
* @returns The subgraphs of the assistant.
*/
getSubgraphs(assistantId: string, options?: {
namespace?: string;
recurse?: boolean;
signal?: AbortSignal;
}): Promise<Subgraphs>;
/**
* Create a new assistant.
* @param payload Payload for creating an assistant.
* @returns The created assistant.
*/
create(payload: {
graphId: string;
config?: Config;
context?: unknown;
metadata?: Metadata;
assistantId?: string;
ifExists?: OnConflictBehavior;
name?: string;
description?: string;
signal?: AbortSignal;
}): Promise<Assistant>;
/**
* Update an assistant.
* @param assistantId ID of the assistant.
* @param payload Payload for updating the assistant.
* @returns The updated assistant.
*/
update(assistantId: string, payload: {
graphId?: string;
config?: Config;
context?: unknown;
metadata?: Metadata;
name?: string;
description?: string;
signal?: AbortSignal;
}): Promise<Assistant>;
/**
* Delete an assistant.
*
* @param assistantId ID of the assistant.
* @param deleteThreads If true, delete all threads with `metadata.assistant_id` equal to `assistantId`. Defaults to false.
*/
delete(assistantId: string, options?: {
signal?: AbortSignal;
deleteThreads?: boolean;
}): Promise<void>;
/**
* List assistants.
* @param query Query options.
* @returns List of assistants or, when includePagination is true, a mapping with the assistants and next cursor.
*/
search(query: {
graphId?: string;
name?: string;
metadata?: Metadata;
limit?: number;
offset?: number;
sortBy?: AssistantSortBy;
sortOrder?: SortOrder;
select?: AssistantSelectField[];
includePagination: true;
signal?: AbortSignal;
}): Promise<AssistantsSearchResponse>;
search(query?: {
graphId?: string;
name?: string;
metadata?: Metadata;
limit?: number;
offset?: number;
sortBy?: AssistantSortBy;
sortOrder?: SortOrder;
select?: AssistantSelectField[];
includePagination?: false;
signal?: AbortSignal;
}): Promise<Assistant[]>;
/**
* Count assistants matching filters.
*
* @param query.metadata Metadata to filter by. Exact match for each key/value.
* @param query.graphId Optional graph id to filter by.
* @param query.name Optional name to filter by.
* @returns Number of assistants matching the criteria.
*/
count(query?: {
metadata?: Metadata;
graphId?: string;
name?: string;
signal?: AbortSignal;
}): Promise<number>;
/**
* List all versions of an assistant.
*
* @param assistantId ID of the assistant.
* @returns List of assistant versions.
*/
getVersions(assistantId: string, payload?: {
metadata?: Metadata;
limit?: number;
offset?: number;
signal?: AbortSignal;
}): Promise<AssistantVersion[]>;
/**
* Change the version of an assistant.
*
* @param assistantId ID of the assistant.
* @param version The version to change to.
* @returns The updated assistant.
*/
setLatest(assistantId: string, version: number, options?: {
signal?: AbortSignal;
}): Promise<Assistant>;
}
//#endregion
export { AssistantsClient };
//# sourceMappingURL=index.d.ts.map