UNPKG

@copilotkit/shared

Version:

<div align="center"> <a href="https://copilotkit.ai" target="_blank"> <img src="https://github.com/copilotkit/copilotkit/raw/main/assets/banner.png" alt="CopilotKit Logo"> </a>

33 lines (30 loc) 1.03 kB
import { z } from 'zod'; import { Parameter } from '../types/action.js'; type JSONSchemaString = { type: "string"; description?: string; enum?: string[]; }; type JSONSchemaNumber = { type: "number"; description?: string; }; type JSONSchemaBoolean = { type: "boolean"; description?: string; }; type JSONSchemaObject = { type: "object"; properties?: Record<string, JSONSchema>; required?: string[]; description?: string; }; type JSONSchemaArray = { type: "array"; items: JSONSchema; description?: string; }; type JSONSchema = JSONSchemaString | JSONSchemaNumber | JSONSchemaBoolean | JSONSchemaObject | JSONSchemaArray; declare function actionParametersToJsonSchema(actionParameters: Parameter[]): JSONSchema; declare function convertJsonSchemaToZodSchema(jsonSchema: any, required: boolean): z.ZodSchema; export { JSONSchema, JSONSchemaArray, JSONSchemaBoolean, JSONSchemaNumber, JSONSchemaObject, JSONSchemaString, actionParametersToJsonSchema, convertJsonSchemaToZodSchema };