rdesign/frontend/node_modules/@copilotkit/shared/dist/utils/json-schema.d.mts

36 lines
1.3 KiB
TypeScript

import { Parameter } from "../types/action.mjs";
import { z } from "zod";
//#region src/utils/json-schema.d.ts
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;
declare function getZodParameters<T extends [] | Parameter[] | undefined>(parameters: T): any;
//#endregion
export { JSONSchema, JSONSchemaArray, JSONSchemaBoolean, JSONSchemaNumber, JSONSchemaObject, JSONSchemaString, actionParametersToJsonSchema, convertJsonSchemaToZodSchema, getZodParameters, jsonSchemaToActionParameters };
//# sourceMappingURL=json-schema.d.mts.map