/* * 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 { collectExtraKeys as collectExtraKeys$, safeParse, } from "../../lib/schemas.js"; import { ClosedEnum } from "../../types/enums.js"; import { Result as SafeParseResult } from "../../types/fp.js"; import * as components from "../components/index.js"; import { SDKValidationError } from "../errors/sdkvalidationerror.js"; export type RerunFailedEvalSamplesRequest = { runId: string; /** * Optional external end-user identifier forwarded by the API gateway. */ xOnBehalfOf?: string | undefined; }; export type RerunFailedEvalSamplesStop = string | Array; export const RerunFailedEvalSamplesTruncation = { Auto: "auto", Disabled: "disabled", } as const; export type RerunFailedEvalSamplesTruncation = ClosedEnum< typeof RerunFailedEvalSamplesTruncation >; export const RerunFailedEvalSamplesServiceTier = { Auto: "auto", Default: "default", Flex: "flex", Priority: "priority", } as const; export type RerunFailedEvalSamplesServiceTier = ClosedEnum< typeof RerunFailedEvalSamplesServiceTier >; export type RerunFailedEvalSamplesPrefillThink = boolean | string; export type RerunFailedEvalSamplesGeneration = { instructions?: string | undefined; temperature?: number | undefined; topP?: number | undefined; maxOutputTokens?: number | undefined; /** * lm-eval alias for max_output_tokens. */ maxGenToks?: number | undefined; stop?: string | Array | undefined; /** * lm-eval generate_until stop sequences. */ until?: Array | undefined; maxToolCalls?: number | undefined; reasoning?: any | undefined; text?: any | undefined; tools?: Array | undefined; toolChoice?: any | undefined; parallelToolCalls?: boolean | undefined; truncation?: RerunFailedEvalSamplesTruncation | undefined; serviceTier?: RerunFailedEvalSamplesServiceTier | undefined; presencePenalty?: number | undefined; frequencyPenalty?: number | undefined; topK?: number | undefined; minP?: number | undefined; repetitionPenalty?: number | undefined; doSample?: boolean | undefined; extraBody?: { [k: string]: any } | undefined; chatTemplateKwargs?: { [k: string]: any } | undefined; prefillThink?: boolean | string | undefined; useCache?: boolean | undefined; timeoutSeconds?: number | undefined; maxRetries?: number | undefined; maxEmptyRetries?: number | undefined; additionalProperties?: { [k: string]: any } | undefined; }; export type RerunFailedEvalSamplesRequestCounts = { total: number; completed: number; failed: number; }; /** * OK */ export type RerunFailedEvalSamplesResponseBody = { id: string; object: "eval.run"; suiteId: string; suiteVersion: number; suiteVersionId: string; /** * The org that owns this run. */ orgId: string; /** * The team that owns this run. */ teamId: string; status: components.EvalRunStatus; models: Array; taskIds: Array | null; judgeModel: string | null; embeddingModel: string | null; generation: RerunFailedEvalSamplesGeneration; requestCounts: RerunFailedEvalSamplesRequestCounts; metrics: { [k: string]: any } | null; error: { [k: string]: any } | null; artifactFileIds: Array; metadata: { [k: string]: string }; createdAt: number; startedAt: number | null; completedAt: number | null; cancelledAt: number | null; failedAt: number | null; }; /** @internal */ export const RerunFailedEvalSamplesRequest$inboundSchema: z.ZodType< RerunFailedEvalSamplesRequest, z.ZodTypeDef, unknown > = z.object({ run_id: z.string(), "X-On-Behalf-Of": z.string().optional(), }).transform((v) => { return remap$(v, { "run_id": "runId", "X-On-Behalf-Of": "xOnBehalfOf", }); }); /** @internal */ export type RerunFailedEvalSamplesRequest$Outbound = { run_id: string; "X-On-Behalf-Of"?: string | undefined; }; /** @internal */ export const RerunFailedEvalSamplesRequest$outboundSchema: z.ZodType< RerunFailedEvalSamplesRequest$Outbound, z.ZodTypeDef, RerunFailedEvalSamplesRequest > = z.object({ runId: z.string(), xOnBehalfOf: z.string().optional(), }).transform((v) => { return remap$(v, { runId: "run_id", xOnBehalfOf: "X-On-Behalf-Of", }); }); export function rerunFailedEvalSamplesRequestToJSON( rerunFailedEvalSamplesRequest: RerunFailedEvalSamplesRequest, ): string { return JSON.stringify( RerunFailedEvalSamplesRequest$outboundSchema.parse( rerunFailedEvalSamplesRequest, ), ); } export function rerunFailedEvalSamplesRequestFromJSON( jsonString: string, ): SafeParseResult { return safeParse( jsonString, (x) => RerunFailedEvalSamplesRequest$inboundSchema.parse(JSON.parse(x)), `Failed to parse 'RerunFailedEvalSamplesRequest' from JSON`, ); } /** @internal */ export const RerunFailedEvalSamplesStop$inboundSchema: z.ZodType< RerunFailedEvalSamplesStop, z.ZodTypeDef, unknown > = z.union([z.string(), z.array(z.string())]); /** @internal */ export type RerunFailedEvalSamplesStop$Outbound = string | Array; /** @internal */ export const RerunFailedEvalSamplesStop$outboundSchema: z.ZodType< RerunFailedEvalSamplesStop$Outbound, z.ZodTypeDef, RerunFailedEvalSamplesStop > = z.union([z.string(), z.array(z.string())]); export function rerunFailedEvalSamplesStopToJSON( rerunFailedEvalSamplesStop: RerunFailedEvalSamplesStop, ): string { return JSON.stringify( RerunFailedEvalSamplesStop$outboundSchema.parse(rerunFailedEvalSamplesStop), ); } export function rerunFailedEvalSamplesStopFromJSON( jsonString: string, ): SafeParseResult { return safeParse( jsonString, (x) => RerunFailedEvalSamplesStop$inboundSchema.parse(JSON.parse(x)), `Failed to parse 'RerunFailedEvalSamplesStop' from JSON`, ); } /** @internal */ export const RerunFailedEvalSamplesTruncation$inboundSchema: z.ZodNativeEnum< typeof RerunFailedEvalSamplesTruncation > = z.nativeEnum(RerunFailedEvalSamplesTruncation); /** @internal */ export const RerunFailedEvalSamplesTruncation$outboundSchema: z.ZodNativeEnum< typeof RerunFailedEvalSamplesTruncation > = RerunFailedEvalSamplesTruncation$inboundSchema; /** @internal */ export const RerunFailedEvalSamplesServiceTier$inboundSchema: z.ZodNativeEnum< typeof RerunFailedEvalSamplesServiceTier > = z.nativeEnum(RerunFailedEvalSamplesServiceTier); /** @internal */ export const RerunFailedEvalSamplesServiceTier$outboundSchema: z.ZodNativeEnum< typeof RerunFailedEvalSamplesServiceTier > = RerunFailedEvalSamplesServiceTier$inboundSchema; /** @internal */ export const RerunFailedEvalSamplesPrefillThink$inboundSchema: z.ZodType< RerunFailedEvalSamplesPrefillThink, z.ZodTypeDef, unknown > = z.union([z.boolean(), z.string()]); /** @internal */ export type RerunFailedEvalSamplesPrefillThink$Outbound = boolean | string; /** @internal */ export const RerunFailedEvalSamplesPrefillThink$outboundSchema: z.ZodType< RerunFailedEvalSamplesPrefillThink$Outbound, z.ZodTypeDef, RerunFailedEvalSamplesPrefillThink > = z.union([z.boolean(), z.string()]); export function rerunFailedEvalSamplesPrefillThinkToJSON( rerunFailedEvalSamplesPrefillThink: RerunFailedEvalSamplesPrefillThink, ): string { return JSON.stringify( RerunFailedEvalSamplesPrefillThink$outboundSchema.parse( rerunFailedEvalSamplesPrefillThink, ), ); } export function rerunFailedEvalSamplesPrefillThinkFromJSON( jsonString: string, ): SafeParseResult { return safeParse( jsonString, (x) => RerunFailedEvalSamplesPrefillThink$inboundSchema.parse(JSON.parse(x)), `Failed to parse 'RerunFailedEvalSamplesPrefillThink' from JSON`, ); } /** @internal */ export const RerunFailedEvalSamplesGeneration$inboundSchema: z.ZodType< RerunFailedEvalSamplesGeneration, z.ZodTypeDef, unknown > = collectExtraKeys$( z.object({ instructions: z.string().optional(), temperature: z.number().optional(), top_p: z.number().optional(), max_output_tokens: z.number().int().optional(), max_gen_toks: z.number().int().optional(), stop: z.union([z.string(), z.array(z.string())]).optional(), until: z.array(z.string()).optional(), max_tool_calls: z.number().int().optional(), reasoning: z.any().optional(), text: z.any().optional(), tools: z.array(z.nullable(z.any())).optional(), tool_choice: z.any().optional(), parallel_tool_calls: z.boolean().optional(), truncation: RerunFailedEvalSamplesTruncation$inboundSchema.optional(), service_tier: RerunFailedEvalSamplesServiceTier$inboundSchema.optional(), presence_penalty: z.number().optional(), frequency_penalty: z.number().optional(), top_k: z.number().int().optional(), min_p: z.number().optional(), repetition_penalty: z.number().optional(), do_sample: z.boolean().optional(), extra_body: z.record(z.any()).optional(), chat_template_kwargs: z.record(z.any()).optional(), prefill_think: z.union([z.boolean(), z.string()]).optional(), use_cache: z.boolean().optional(), timeout_seconds: z.number().int().optional(), max_retries: z.number().int().optional(), max_empty_retries: z.number().int().optional(), }).catchall(z.any()), "additionalProperties", true, ).transform((v) => { return remap$(v, { "top_p": "topP", "max_output_tokens": "maxOutputTokens", "max_gen_toks": "maxGenToks", "max_tool_calls": "maxToolCalls", "tool_choice": "toolChoice", "parallel_tool_calls": "parallelToolCalls", "service_tier": "serviceTier", "presence_penalty": "presencePenalty", "frequency_penalty": "frequencyPenalty", "top_k": "topK", "min_p": "minP", "repetition_penalty": "repetitionPenalty", "do_sample": "doSample", "extra_body": "extraBody", "chat_template_kwargs": "chatTemplateKwargs", "prefill_think": "prefillThink", "use_cache": "useCache", "timeout_seconds": "timeoutSeconds", "max_retries": "maxRetries", "max_empty_retries": "maxEmptyRetries", }); }); /** @internal */ export type RerunFailedEvalSamplesGeneration$Outbound = { instructions?: string | undefined; temperature?: number | undefined; top_p?: number | undefined; max_output_tokens?: number | undefined; max_gen_toks?: number | undefined; stop?: string | Array | undefined; until?: Array | undefined; max_tool_calls?: number | undefined; reasoning?: any | undefined; text?: any | undefined; tools?: Array | undefined; tool_choice?: any | undefined; parallel_tool_calls?: boolean | undefined; truncation?: string | undefined; service_tier?: string | undefined; presence_penalty?: number | undefined; frequency_penalty?: number | undefined; top_k?: number | undefined; min_p?: number | undefined; repetition_penalty?: number | undefined; do_sample?: boolean | undefined; extra_body?: { [k: string]: any } | undefined; chat_template_kwargs?: { [k: string]: any } | undefined; prefill_think?: boolean | string | undefined; use_cache?: boolean | undefined; timeout_seconds?: number | undefined; max_retries?: number | undefined; max_empty_retries?: number | undefined; [additionalProperties: string]: unknown; }; /** @internal */ export const RerunFailedEvalSamplesGeneration$outboundSchema: z.ZodType< RerunFailedEvalSamplesGeneration$Outbound, z.ZodTypeDef, RerunFailedEvalSamplesGeneration > = z.object({ instructions: z.string().optional(), temperature: z.number().optional(), topP: z.number().optional(), maxOutputTokens: z.number().int().optional(), maxGenToks: z.number().int().optional(), stop: z.union([z.string(), z.array(z.string())]).optional(), until: z.array(z.string()).optional(), maxToolCalls: z.number().int().optional(), reasoning: z.any().optional(), text: z.any().optional(), tools: z.array(z.nullable(z.any())).optional(), toolChoice: z.any().optional(), parallelToolCalls: z.boolean().optional(), truncation: RerunFailedEvalSamplesTruncation$outboundSchema.optional(), serviceTier: RerunFailedEvalSamplesServiceTier$outboundSchema.optional(), presencePenalty: z.number().optional(), frequencyPenalty: z.number().optional(), topK: z.number().int().optional(), minP: z.number().optional(), repetitionPenalty: z.number().optional(), doSample: z.boolean().optional(), extraBody: z.record(z.any()).optional(), chatTemplateKwargs: z.record(z.any()).optional(), prefillThink: z.union([z.boolean(), z.string()]).optional(), useCache: z.boolean().optional(), timeoutSeconds: z.number().int().optional(), maxRetries: z.number().int().optional(), maxEmptyRetries: z.number().int().optional(), additionalProperties: z.record(z.any()).optional(), }).transform((v) => { return { ...v.additionalProperties, ...remap$(v, { topP: "top_p", maxOutputTokens: "max_output_tokens", maxGenToks: "max_gen_toks", maxToolCalls: "max_tool_calls", toolChoice: "tool_choice", parallelToolCalls: "parallel_tool_calls", serviceTier: "service_tier", presencePenalty: "presence_penalty", frequencyPenalty: "frequency_penalty", topK: "top_k", minP: "min_p", repetitionPenalty: "repetition_penalty", doSample: "do_sample", extraBody: "extra_body", chatTemplateKwargs: "chat_template_kwargs", prefillThink: "prefill_think", useCache: "use_cache", timeoutSeconds: "timeout_seconds", maxRetries: "max_retries", maxEmptyRetries: "max_empty_retries", additionalProperties: null, }), }; }); export function rerunFailedEvalSamplesGenerationToJSON( rerunFailedEvalSamplesGeneration: RerunFailedEvalSamplesGeneration, ): string { return JSON.stringify( RerunFailedEvalSamplesGeneration$outboundSchema.parse( rerunFailedEvalSamplesGeneration, ), ); } export function rerunFailedEvalSamplesGenerationFromJSON( jsonString: string, ): SafeParseResult { return safeParse( jsonString, (x) => RerunFailedEvalSamplesGeneration$inboundSchema.parse(JSON.parse(x)), `Failed to parse 'RerunFailedEvalSamplesGeneration' from JSON`, ); } /** @internal */ export const RerunFailedEvalSamplesRequestCounts$inboundSchema: z.ZodType< RerunFailedEvalSamplesRequestCounts, z.ZodTypeDef, unknown > = z.object({ total: z.number().int(), completed: z.number().int(), failed: z.number().int(), }); /** @internal */ export type RerunFailedEvalSamplesRequestCounts$Outbound = { total: number; completed: number; failed: number; }; /** @internal */ export const RerunFailedEvalSamplesRequestCounts$outboundSchema: z.ZodType< RerunFailedEvalSamplesRequestCounts$Outbound, z.ZodTypeDef, RerunFailedEvalSamplesRequestCounts > = z.object({ total: z.number().int(), completed: z.number().int(), failed: z.number().int(), }); export function rerunFailedEvalSamplesRequestCountsToJSON( rerunFailedEvalSamplesRequestCounts: RerunFailedEvalSamplesRequestCounts, ): string { return JSON.stringify( RerunFailedEvalSamplesRequestCounts$outboundSchema.parse( rerunFailedEvalSamplesRequestCounts, ), ); } export function rerunFailedEvalSamplesRequestCountsFromJSON( jsonString: string, ): SafeParseResult { return safeParse( jsonString, (x) => RerunFailedEvalSamplesRequestCounts$inboundSchema.parse(JSON.parse(x)), `Failed to parse 'RerunFailedEvalSamplesRequestCounts' from JSON`, ); } /** @internal */ export const RerunFailedEvalSamplesResponseBody$inboundSchema: z.ZodType< RerunFailedEvalSamplesResponseBody, z.ZodTypeDef, unknown > = z.object({ id: z.string(), object: z.literal("eval.run"), suite_id: z.string(), suite_version: z.number().int(), suite_version_id: z.string(), org_id: z.string(), team_id: z.string(), status: components.EvalRunStatus$inboundSchema, models: z.array(z.string()), task_ids: z.nullable(z.array(z.string())), judge_model: z.nullable(z.string()), embedding_model: z.nullable(z.string()), generation: z.lazy(() => RerunFailedEvalSamplesGeneration$inboundSchema), request_counts: z.lazy(() => RerunFailedEvalSamplesRequestCounts$inboundSchema ), metrics: z.nullable(z.record(z.any())), error: z.nullable(z.record(z.any())), artifact_file_ids: z.array(z.string()), metadata: z.record(z.string()), created_at: z.number().int(), started_at: z.nullable(z.number().int()), completed_at: z.nullable(z.number().int()), cancelled_at: z.nullable(z.number().int()), failed_at: z.nullable(z.number().int()), }).transform((v) => { return remap$(v, { "suite_id": "suiteId", "suite_version": "suiteVersion", "suite_version_id": "suiteVersionId", "org_id": "orgId", "team_id": "teamId", "task_ids": "taskIds", "judge_model": "judgeModel", "embedding_model": "embeddingModel", "request_counts": "requestCounts", "artifact_file_ids": "artifactFileIds", "created_at": "createdAt", "started_at": "startedAt", "completed_at": "completedAt", "cancelled_at": "cancelledAt", "failed_at": "failedAt", }); }); /** @internal */ export type RerunFailedEvalSamplesResponseBody$Outbound = { id: string; object: "eval.run"; suite_id: string; suite_version: number; suite_version_id: string; org_id: string; team_id: string; status: string; models: Array; task_ids: Array | null; judge_model: string | null; embedding_model: string | null; generation: RerunFailedEvalSamplesGeneration$Outbound; request_counts: RerunFailedEvalSamplesRequestCounts$Outbound; metrics: { [k: string]: any } | null; error: { [k: string]: any } | null; artifact_file_ids: Array; metadata: { [k: string]: string }; created_at: number; started_at: number | null; completed_at: number | null; cancelled_at: number | null; failed_at: number | null; }; /** @internal */ export const RerunFailedEvalSamplesResponseBody$outboundSchema: z.ZodType< RerunFailedEvalSamplesResponseBody$Outbound, z.ZodTypeDef, RerunFailedEvalSamplesResponseBody > = z.object({ id: z.string(), object: z.literal("eval.run"), suiteId: z.string(), suiteVersion: z.number().int(), suiteVersionId: z.string(), orgId: z.string(), teamId: z.string(), status: components.EvalRunStatus$outboundSchema, models: z.array(z.string()), taskIds: z.nullable(z.array(z.string())), judgeModel: z.nullable(z.string()), embeddingModel: z.nullable(z.string()), generation: z.lazy(() => RerunFailedEvalSamplesGeneration$outboundSchema), requestCounts: z.lazy(() => RerunFailedEvalSamplesRequestCounts$outboundSchema ), metrics: z.nullable(z.record(z.any())), error: z.nullable(z.record(z.any())), artifactFileIds: z.array(z.string()), metadata: z.record(z.string()), createdAt: z.number().int(), startedAt: z.nullable(z.number().int()), completedAt: z.nullable(z.number().int()), cancelledAt: z.nullable(z.number().int()), failedAt: z.nullable(z.number().int()), }).transform((v) => { return remap$(v, { suiteId: "suite_id", suiteVersion: "suite_version", suiteVersionId: "suite_version_id", orgId: "org_id", teamId: "team_id", taskIds: "task_ids", judgeModel: "judge_model", embeddingModel: "embedding_model", requestCounts: "request_counts", artifactFileIds: "artifact_file_ids", createdAt: "created_at", startedAt: "started_at", completedAt: "completed_at", cancelledAt: "cancelled_at", failedAt: "failed_at", }); }); export function rerunFailedEvalSamplesResponseBodyToJSON( rerunFailedEvalSamplesResponseBody: RerunFailedEvalSamplesResponseBody, ): string { return JSON.stringify( RerunFailedEvalSamplesResponseBody$outboundSchema.parse( rerunFailedEvalSamplesResponseBody, ), ); } export function rerunFailedEvalSamplesResponseBodyFromJSON( jsonString: string, ): SafeParseResult { return safeParse( jsonString, (x) => RerunFailedEvalSamplesResponseBody$inboundSchema.parse(JSON.parse(x)), `Failed to parse 'RerunFailedEvalSamplesResponseBody' from JSON`, ); }