/* * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. */ import * as z from "zod/v3"; import { remap as remap$ } from "../../lib/primitives.js"; import { safeParse } from "../../lib/schemas.js"; import { Result as SafeParseResult } from "../../types/fp.js"; import { SDKValidationError } from "../errors/sdkvalidationerror.js"; import { Answer, Answer$inboundSchema, Answer$Outbound, Answer$outboundSchema, } from "./answer.js"; export type EvaluatedAnswerStep = { type?: "evaluated_answer" | undefined; think: string; currentQuestion: string; errored?: boolean | undefined; answer: Answer; /** * A list of questions ids that are no longer relevant to the current answer referenced by their IDs. */ otherResolvedQuestionIds?: Array | undefined; evalPassed: boolean; evalReason: string; }; /** @internal */ export const EvaluatedAnswerStep$inboundSchema: z.ZodType< EvaluatedAnswerStep, z.ZodTypeDef, unknown > = z.object({ type: z.literal("evaluated_answer").default("evaluated_answer"), think: z.string(), current_question: z.string(), errored: z.boolean().default(false), answer: Answer$inboundSchema, other_resolved_question_ids: z.array(z.string()).optional(), eval_passed: z.boolean(), eval_reason: z.string(), }).transform((v) => { return remap$(v, { "current_question": "currentQuestion", "other_resolved_question_ids": "otherResolvedQuestionIds", "eval_passed": "evalPassed", "eval_reason": "evalReason", }); }); /** @internal */ export type EvaluatedAnswerStep$Outbound = { type: "evaluated_answer"; think: string; current_question: string; errored: boolean; answer: Answer$Outbound; other_resolved_question_ids?: Array | undefined; eval_passed: boolean; eval_reason: string; }; /** @internal */ export const EvaluatedAnswerStep$outboundSchema: z.ZodType< EvaluatedAnswerStep$Outbound, z.ZodTypeDef, EvaluatedAnswerStep > = z.object({ type: z.literal("evaluated_answer").default("evaluated_answer" as const), think: z.string(), currentQuestion: z.string(), errored: z.boolean().default(false), answer: Answer$outboundSchema, otherResolvedQuestionIds: z.array(z.string()).optional(), evalPassed: z.boolean(), evalReason: z.string(), }).transform((v) => { return remap$(v, { currentQuestion: "current_question", otherResolvedQuestionIds: "other_resolved_question_ids", evalPassed: "eval_passed", evalReason: "eval_reason", }); }); export function evaluatedAnswerStepToJSON( evaluatedAnswerStep: EvaluatedAnswerStep, ): string { return JSON.stringify( EvaluatedAnswerStep$outboundSchema.parse(evaluatedAnswerStep), ); } export function evaluatedAnswerStepFromJSON( jsonString: string, ): SafeParseResult { return safeParse( jsonString, (x) => EvaluatedAnswerStep$inboundSchema.parse(JSON.parse(x)), `Failed to parse 'EvaluatedAnswerStep' from JSON`, ); }