/* * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. */ import * as z from "zod/v4-mini"; import { safeParse } from "../lib/schemas.js"; import { ClosedEnum } from "../types/enums.js"; import { Result as SafeParseResult } from "../types/fp.js"; import * as types from "../types/primitives.js"; import { SDKValidationError } from "./errors/sdk-validation-error.js"; export const MemoryEvalRunResponseStatus = { Completed: "completed", } as const; export type MemoryEvalRunResponseStatus = ClosedEnum< typeof MemoryEvalRunResponseStatus >; export type Scores = { recallAtK: number; precisionAtK: number; avgContextCharacters: number; cases: number; }; export type Result = { query: string; hit: boolean; returned: number; contextCharacters: number; }; export type MemoryEvalRunResponse = { evalRunId: string; status: MemoryEvalRunResponseStatus; scores: Scores; avgSearchLatencyMs?: number | undefined; results: Array; }; /** @internal */ export const MemoryEvalRunResponseStatus$inboundSchema: z.ZodMiniEnum< typeof MemoryEvalRunResponseStatus > = z.enum(MemoryEvalRunResponseStatus); /** @internal */ export const Scores$inboundSchema: z.ZodMiniType = z.object({ recallAtK: types.number(), precisionAtK: types.number(), avgContextCharacters: types.number(), cases: types.number(), }); export function scoresFromJSON( jsonString: string, ): SafeParseResult { return safeParse( jsonString, (x) => Scores$inboundSchema.parse(JSON.parse(x)), `Failed to parse 'Scores' from JSON`, ); } /** @internal */ export const Result$inboundSchema: z.ZodMiniType = z.object({ query: types.string(), hit: types.boolean(), returned: types.number(), contextCharacters: types.number(), }); export function resultFromJSON( jsonString: string, ): SafeParseResult { return safeParse( jsonString, (x) => Result$inboundSchema.parse(JSON.parse(x)), `Failed to parse 'Result' from JSON`, ); } /** @internal */ export const MemoryEvalRunResponse$inboundSchema: z.ZodMiniType< MemoryEvalRunResponse, unknown > = z.object({ evalRunId: types.string(), status: MemoryEvalRunResponseStatus$inboundSchema, scores: z.lazy(() => Scores$inboundSchema), avgSearchLatencyMs: types.optional(types.number()), results: z.array(z.lazy(() => Result$inboundSchema)), }); export function memoryEvalRunResponseFromJSON( jsonString: string, ): SafeParseResult { return safeParse( jsonString, (x) => MemoryEvalRunResponse$inboundSchema.parse(JSON.parse(x)), `Failed to parse 'MemoryEvalRunResponse' from JSON`, ); }