UNPKG

@langgraph-js/sdk

Version:

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

37 lines (36 loc) 1.13 kB
/** * copy and modify from copilotkit * https://github.com/copilotkit/copilotkit * * MIT License */ import { z, ZodRawShape } from "zod"; import { Parameter } from "./copilotkit-actions.js"; export type JSONSchemaString = { type: "string"; description?: string; enum?: string[]; }; export type JSONSchemaNumber = { type: "number"; description?: string; }; export type JSONSchemaBoolean = { type: "boolean"; description?: string; }; export type JSONSchemaObject = { type: "object"; properties?: Record<string, JSONSchema>; required?: string[]; description?: string; }; export type JSONSchemaArray = { type: "array"; items: JSONSchema; description?: string; }; export type JSONSchema = JSONSchemaString | JSONSchemaNumber | JSONSchemaBoolean | JSONSchemaObject | JSONSchemaArray; export declare function actionParametersToJsonSchema(actionParameters: Parameter[]): JSONSchema; export declare function convertJsonSchemaToZodRawShape(jsonSchema: any): ZodRawShape; export declare function convertJsonSchemaToZodSchema(jsonSchema: any, required: boolean): z.ZodSchema;