/* * 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 { EvalSampleStatus, EvalSampleStatus$inboundSchema, EvalSampleStatus$outboundSchema, } from "./evalsamplestatus.js"; export type EvalSampleObject = { id: string; object: "eval.sample"; runId: string; taskId: string; model: string; sampleIndex: number; status: EvalSampleStatus; datasetRow: { [k: string]: any } | null; prompt: string; target: string | null; responseId: string | null; outputText: string | null; /** * Model reasoning ('thinking') captured from the response's reasoning items, kept separate from `output_text` so graders and extraction never see it. Truncated at 64 KB of UTF-8 with a marker appended. Null when the model returned none, when the provider only sent encrypted reasoning, and for transcription tasks. */ reasoning: string | null; extractedOutput: string | null; scores: { [k: string]: any }; judge: { [k: string]: any } | null; error: { [k: string]: any } | null; createdAt: number; startedAt: number | null; completedAt: number | null; }; /** @internal */ export const EvalSampleObject$inboundSchema: z.ZodType< EvalSampleObject, z.ZodTypeDef, unknown > = z.object({ id: z.string(), object: z.literal("eval.sample"), run_id: z.string(), task_id: z.string(), model: z.string(), sample_index: z.number().int(), status: EvalSampleStatus$inboundSchema, dataset_row: z.nullable(z.record(z.any())), prompt: z.string(), target: z.nullable(z.string()), response_id: z.nullable(z.string()), output_text: z.nullable(z.string()), reasoning: z.nullable(z.string()), extracted_output: z.nullable(z.string()), scores: z.record(z.any()), judge: z.nullable(z.record(z.any())), error: z.nullable(z.record(z.any())), created_at: z.number().int(), started_at: z.nullable(z.number().int()), completed_at: z.nullable(z.number().int()), }).transform((v) => { return remap$(v, { "run_id": "runId", "task_id": "taskId", "sample_index": "sampleIndex", "dataset_row": "datasetRow", "response_id": "responseId", "output_text": "outputText", "extracted_output": "extractedOutput", "created_at": "createdAt", "started_at": "startedAt", "completed_at": "completedAt", }); }); /** @internal */ export type EvalSampleObject$Outbound = { id: string; object: "eval.sample"; run_id: string; task_id: string; model: string; sample_index: number; status: string; dataset_row: { [k: string]: any } | null; prompt: string; target: string | null; response_id: string | null; output_text: string | null; reasoning: string | null; extracted_output: string | null; scores: { [k: string]: any }; judge: { [k: string]: any } | null; error: { [k: string]: any } | null; created_at: number; started_at: number | null; completed_at: number | null; }; /** @internal */ export const EvalSampleObject$outboundSchema: z.ZodType< EvalSampleObject$Outbound, z.ZodTypeDef, EvalSampleObject > = z.object({ id: z.string(), object: z.literal("eval.sample"), runId: z.string(), taskId: z.string(), model: z.string(), sampleIndex: z.number().int(), status: EvalSampleStatus$outboundSchema, datasetRow: z.nullable(z.record(z.any())), prompt: z.string(), target: z.nullable(z.string()), responseId: z.nullable(z.string()), outputText: z.nullable(z.string()), reasoning: z.nullable(z.string()), extractedOutput: z.nullable(z.string()), scores: z.record(z.any()), judge: z.nullable(z.record(z.any())), error: z.nullable(z.record(z.any())), createdAt: z.number().int(), startedAt: z.nullable(z.number().int()), completedAt: z.nullable(z.number().int()), }).transform((v) => { return remap$(v, { runId: "run_id", taskId: "task_id", sampleIndex: "sample_index", datasetRow: "dataset_row", responseId: "response_id", outputText: "output_text", extractedOutput: "extracted_output", createdAt: "created_at", startedAt: "started_at", completedAt: "completed_at", }); }); export function evalSampleObjectToJSON( evalSampleObject: EvalSampleObject, ): string { return JSON.stringify( EvalSampleObject$outboundSchema.parse(evalSampleObject), ); } export function evalSampleObjectFromJSON( jsonString: string, ): SafeParseResult { return safeParse( jsonString, (x) => EvalSampleObject$inboundSchema.parse(JSON.parse(x)), `Failed to parse 'EvalSampleObject' from JSON`, ); }