UNPKG

@copilotkit/shared

Version:

<img src="https://github.com/user-attachments/assets/0a6b64d9-e193-4940-a3f6-60334ac34084" alt="banner" style="border-radius: 12px; border: 2px solid #d6d4fa;" />

34 lines (31 loc) 1.15 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 jsonSchemaToActionParameters(jsonSchema: JSONSchema): Parameter[]; declare function convertJsonSchemaToZodSchema(jsonSchema: any, required: boolean): z.ZodSchema; export { JSONSchema, JSONSchemaArray, JSONSchemaBoolean, JSONSchemaNumber, JSONSchemaObject, JSONSchemaString, actionParametersToJsonSchema, convertJsonSchemaToZodSchema, jsonSchemaToActionParameters };