/* * 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 CancelEvalRunRequest = { runId: string; /** * Optional external end-user identifier forwarded by the API gateway. */ xOnBehalfOf?: string | undefined; }; export type CancelEvalRunStop = string | Array; export const CancelEvalRunTruncation = { Auto: "auto", Disabled: "disabled", } as const; export type CancelEvalRunTruncation = ClosedEnum< typeof CancelEvalRunTruncation >; export const CancelEvalRunServiceTier = { Auto: "auto", Default: "default", Flex: "flex", Priority: "priority", } as const; export type CancelEvalRunServiceTier = ClosedEnum< typeof CancelEvalRunServiceTier >; export type CancelEvalRunPrefillThink = boolean | string; export type CancelEvalRunGeneration = { 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?: CancelEvalRunTruncation | undefined; serviceTier?: CancelEvalRunServiceTier | 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 CancelEvalRunRequestCounts = { total: number; completed: number; failed: number; }; /** * OK */ export type CancelEvalRunResponseBody = { 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: CancelEvalRunGeneration; requestCounts: CancelEvalRunRequestCounts; 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 CancelEvalRunRequest$inboundSchema: z.ZodType< CancelEvalRunRequest, 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 CancelEvalRunRequest$Outbound = { run_id: string; "X-On-Behalf-Of"?: string | undefined; }; /** @internal */ export const CancelEvalRunRequest$outboundSchema: z.ZodType< CancelEvalRunRequest$Outbound, z.ZodTypeDef, CancelEvalRunRequest > = z.object({ runId: z.string(), xOnBehalfOf: z.string().optional(), }).transform((v) => { return remap$(v, { runId: "run_id", xOnBehalfOf: "X-On-Behalf-Of", }); }); export function cancelEvalRunRequestToJSON( cancelEvalRunRequest: CancelEvalRunRequest, ): string { return JSON.stringify( CancelEvalRunRequest$outboundSchema.parse(cancelEvalRunRequest), ); } export function cancelEvalRunRequestFromJSON( jsonString: string, ): SafeParseResult { return safeParse( jsonString, (x) => CancelEvalRunRequest$inboundSchema.parse(JSON.parse(x)), `Failed to parse 'CancelEvalRunRequest' from JSON`, ); } /** @internal */ export const CancelEvalRunStop$inboundSchema: z.ZodType< CancelEvalRunStop, z.ZodTypeDef, unknown > = z.union([z.string(), z.array(z.string())]); /** @internal */ export type CancelEvalRunStop$Outbound = string | Array; /** @internal */ export const CancelEvalRunStop$outboundSchema: z.ZodType< CancelEvalRunStop$Outbound, z.ZodTypeDef, CancelEvalRunStop > = z.union([z.string(), z.array(z.string())]); export function cancelEvalRunStopToJSON( cancelEvalRunStop: CancelEvalRunStop, ): string { return JSON.stringify( CancelEvalRunStop$outboundSchema.parse(cancelEvalRunStop), ); } export function cancelEvalRunStopFromJSON( jsonString: string, ): SafeParseResult { return safeParse( jsonString, (x) => CancelEvalRunStop$inboundSchema.parse(JSON.parse(x)), `Failed to parse 'CancelEvalRunStop' from JSON`, ); } /** @internal */ export const CancelEvalRunTruncation$inboundSchema: z.ZodNativeEnum< typeof CancelEvalRunTruncation > = z.nativeEnum(CancelEvalRunTruncation); /** @internal */ export const CancelEvalRunTruncation$outboundSchema: z.ZodNativeEnum< typeof CancelEvalRunTruncation > = CancelEvalRunTruncation$inboundSchema; /** @internal */ export const CancelEvalRunServiceTier$inboundSchema: z.ZodNativeEnum< typeof CancelEvalRunServiceTier > = z.nativeEnum(CancelEvalRunServiceTier); /** @internal */ export const CancelEvalRunServiceTier$outboundSchema: z.ZodNativeEnum< typeof CancelEvalRunServiceTier > = CancelEvalRunServiceTier$inboundSchema; /** @internal */ export const CancelEvalRunPrefillThink$inboundSchema: z.ZodType< CancelEvalRunPrefillThink, z.ZodTypeDef, unknown > = z.union([z.boolean(), z.string()]); /** @internal */ export type CancelEvalRunPrefillThink$Outbound = boolean | string; /** @internal */ export const CancelEvalRunPrefillThink$outboundSchema: z.ZodType< CancelEvalRunPrefillThink$Outbound, z.ZodTypeDef, CancelEvalRunPrefillThink > = z.union([z.boolean(), z.string()]); export function cancelEvalRunPrefillThinkToJSON( cancelEvalRunPrefillThink: CancelEvalRunPrefillThink, ): string { return JSON.stringify( CancelEvalRunPrefillThink$outboundSchema.parse(cancelEvalRunPrefillThink), ); } export function cancelEvalRunPrefillThinkFromJSON( jsonString: string, ): SafeParseResult { return safeParse( jsonString, (x) => CancelEvalRunPrefillThink$inboundSchema.parse(JSON.parse(x)), `Failed to parse 'CancelEvalRunPrefillThink' from JSON`, ); } /** @internal */ export const CancelEvalRunGeneration$inboundSchema: z.ZodType< CancelEvalRunGeneration, 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: CancelEvalRunTruncation$inboundSchema.optional(), service_tier: CancelEvalRunServiceTier$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 CancelEvalRunGeneration$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 CancelEvalRunGeneration$outboundSchema: z.ZodType< CancelEvalRunGeneration$Outbound, z.ZodTypeDef, CancelEvalRunGeneration > = 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: CancelEvalRunTruncation$outboundSchema.optional(), serviceTier: CancelEvalRunServiceTier$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 cancelEvalRunGenerationToJSON( cancelEvalRunGeneration: CancelEvalRunGeneration, ): string { return JSON.stringify( CancelEvalRunGeneration$outboundSchema.parse(cancelEvalRunGeneration), ); } export function cancelEvalRunGenerationFromJSON( jsonString: string, ): SafeParseResult { return safeParse( jsonString, (x) => CancelEvalRunGeneration$inboundSchema.parse(JSON.parse(x)), `Failed to parse 'CancelEvalRunGeneration' from JSON`, ); } /** @internal */ export const CancelEvalRunRequestCounts$inboundSchema: z.ZodType< CancelEvalRunRequestCounts, z.ZodTypeDef, unknown > = z.object({ total: z.number().int(), completed: z.number().int(), failed: z.number().int(), }); /** @internal */ export type CancelEvalRunRequestCounts$Outbound = { total: number; completed: number; failed: number; }; /** @internal */ export const CancelEvalRunRequestCounts$outboundSchema: z.ZodType< CancelEvalRunRequestCounts$Outbound, z.ZodTypeDef, CancelEvalRunRequestCounts > = z.object({ total: z.number().int(), completed: z.number().int(), failed: z.number().int(), }); export function cancelEvalRunRequestCountsToJSON( cancelEvalRunRequestCounts: CancelEvalRunRequestCounts, ): string { return JSON.stringify( CancelEvalRunRequestCounts$outboundSchema.parse(cancelEvalRunRequestCounts), ); } export function cancelEvalRunRequestCountsFromJSON( jsonString: string, ): SafeParseResult { return safeParse( jsonString, (x) => CancelEvalRunRequestCounts$inboundSchema.parse(JSON.parse(x)), `Failed to parse 'CancelEvalRunRequestCounts' from JSON`, ); } /** @internal */ export const CancelEvalRunResponseBody$inboundSchema: z.ZodType< CancelEvalRunResponseBody, 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(() => CancelEvalRunGeneration$inboundSchema), request_counts: z.lazy(() => CancelEvalRunRequestCounts$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 CancelEvalRunResponseBody$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: CancelEvalRunGeneration$Outbound; request_counts: CancelEvalRunRequestCounts$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 CancelEvalRunResponseBody$outboundSchema: z.ZodType< CancelEvalRunResponseBody$Outbound, z.ZodTypeDef, CancelEvalRunResponseBody > = 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(() => CancelEvalRunGeneration$outboundSchema), requestCounts: z.lazy(() => CancelEvalRunRequestCounts$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 cancelEvalRunResponseBodyToJSON( cancelEvalRunResponseBody: CancelEvalRunResponseBody, ): string { return JSON.stringify( CancelEvalRunResponseBody$outboundSchema.parse(cancelEvalRunResponseBody), ); } export function cancelEvalRunResponseBodyFromJSON( jsonString: string, ): SafeParseResult { return safeParse( jsonString, (x) => CancelEvalRunResponseBody$inboundSchema.parse(JSON.parse(x)), `Failed to parse 'CancelEvalRunResponseBody' from JSON`, ); }