/* * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. */ import * as z from "zod/v3"; import { safeParse } from "../../lib/schemas.js"; import { Result as SafeParseResult } from "../../types/fp.js"; import { SDKValidationError } from "../errors/sdkvalidationerror.js"; export type Variables = string | any; export type PromptTemplate = { id: string; variables?: { [k: string]: string | any } | undefined; version?: string | undefined; }; /** @internal */ export const Variables$inboundSchema: z.ZodType< Variables, z.ZodTypeDef, unknown > = z.union([z.string(), z.any()]); /** @internal */ export type Variables$Outbound = string | any; /** @internal */ export const Variables$outboundSchema: z.ZodType< Variables$Outbound, z.ZodTypeDef, Variables > = z.union([z.string(), z.any()]); export function variablesToJSON(variables: Variables): string { return JSON.stringify(Variables$outboundSchema.parse(variables)); } export function variablesFromJSON( jsonString: string, ): SafeParseResult { return safeParse( jsonString, (x) => Variables$inboundSchema.parse(JSON.parse(x)), `Failed to parse 'Variables' from JSON`, ); } /** @internal */ export const PromptTemplate$inboundSchema: z.ZodType< PromptTemplate, z.ZodTypeDef, unknown > = z.object({ id: z.string(), variables: z.record(z.union([z.string(), z.any()])).optional(), version: z.string().optional(), }); /** @internal */ export type PromptTemplate$Outbound = { id: string; variables?: { [k: string]: string | any } | undefined; version?: string | undefined; }; /** @internal */ export const PromptTemplate$outboundSchema: z.ZodType< PromptTemplate$Outbound, z.ZodTypeDef, PromptTemplate > = z.object({ id: z.string(), variables: z.record(z.union([z.string(), z.any()])).optional(), version: z.string().optional(), }); export function promptTemplateToJSON(promptTemplate: PromptTemplate): string { return JSON.stringify(PromptTemplate$outboundSchema.parse(promptTemplate)); } export function promptTemplateFromJSON( jsonString: string, ): SafeParseResult { return safeParse( jsonString, (x) => PromptTemplate$inboundSchema.parse(JSON.parse(x)), `Failed to parse 'PromptTemplate' from JSON`, ); }