UNPKG

selvedge

Version:

A type-safe, declarative DSL for building robust, composable LLM prompts and programs in TypeScript. Selvedge simplifies prompt engineering, structured output, and multi-model orchestration.

26 lines 1.07 kB
/** * Schema utilities for Selvedge * * This module provides utilities for working with Zod schemas in the Selvedge library. */ import * as z from 'zod'; import { generateExampleFromSchema, generateJsonExampleFromSchema } from '@examples'; import { inferSchema, inferSchemaFromObject, createSchema } from '@inference'; export { z, generateExampleFromSchema, generateJsonExampleFromSchema, inferSchema, inferSchemaFromObject, createSchema }; export type InferZodSchema<T> = T extends z.ZodType<any> ? T : z.ZodType<T>; /** * Validate a value against a schema * * @param schema - The schema to validate against * @param value - The value to validate * @param options - Validation options * @returns The validated value or null if validation fails */ export declare function validateWithSchema<T>(schema: z.ZodType<T>, value: unknown, options?: { silent?: boolean; }): T | null; /** * Create a schema cache to avoid recreating schemas */ export declare const schemaCache: Map<string, z.ZodType<any, z.ZodTypeDef, any>>; //# sourceMappingURL=index.d.ts.map