UNPKG

@langgraph-js/sdk

Version:

The UI SDK for LangGraph - seamlessly integrate your AI agents with frontend interfaces

22 lines (21 loc) 1.02 kB
import { Client } from "@langchain/langgraph-sdk"; export const createLangGraphServerClient = async (config) => { const client = new Client(config); client.threads.search = function (query) { return this.fetch("/threads/search", { method: "POST", json: { metadata: (query == null ? void 0 : query.metadata) ?? void 0, ids: (query == null ? void 0 : query.ids) ?? void 0, limit: (query == null ? void 0 : query.limit) ?? 10, offset: (query == null ? void 0 : query.offset) ?? 0, status: query == null ? void 0 : query.status, sort_by: query == null ? void 0 : query.sortBy, sort_order: query == null ? void 0 : query.sortOrder, select: (query == null ? void 0 : query.select) ?? void 0, without_details: (query == null ? void 0 : query.without_details) ?? false, }, }); }.bind(client.threads); return client; };