/* * 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 Answer = { /** * An answer to a question. */ text: string; /** * The evidence used to derive the answer. */ evidence?: Array | undefined; }; /** @internal */ export const Answer$inboundSchema: z.ZodType = z .object({ text: z.string(), evidence: z.array(z.string()).optional(), }); /** @internal */ export type Answer$Outbound = { text: string; evidence?: Array | undefined; }; /** @internal */ export const Answer$outboundSchema: z.ZodType< Answer$Outbound, z.ZodTypeDef, Answer > = z.object({ text: z.string(), evidence: z.array(z.string()).optional(), }); export function answerToJSON(answer: Answer): string { return JSON.stringify(Answer$outboundSchema.parse(answer)); } export function answerFromJSON( jsonString: string, ): SafeParseResult { return safeParse( jsonString, (x) => Answer$inboundSchema.parse(JSON.parse(x)), `Failed to parse 'Answer' from JSON`, ); }