/* * 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 UpdateEvalScheduleRequest = { scheduleId: string; /** * Optional external end-user identifier forwarded by the API gateway. */ xOnBehalfOf?: string | undefined; updateEvalScheduleRequest: components.UpdateEvalScheduleRequest; }; export type UpdateEvalScheduleStop = string | Array; export const UpdateEvalScheduleTruncation = { Auto: "auto", Disabled: "disabled", } as const; export type UpdateEvalScheduleTruncation = ClosedEnum< typeof UpdateEvalScheduleTruncation >; export const UpdateEvalScheduleServiceTier = { Auto: "auto", Default: "default", Flex: "flex", Priority: "priority", } as const; export type UpdateEvalScheduleServiceTier = ClosedEnum< typeof UpdateEvalScheduleServiceTier >; export type UpdateEvalSchedulePrefillThink = boolean | string; export type UpdateEvalScheduleGeneration = { 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?: UpdateEvalScheduleTruncation | undefined; serviceTier?: UpdateEvalScheduleServiceTier | 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 UpdateEvalScheduleRun = { models: Array; taskIds?: Array | undefined; judgeModel?: string | undefined; embeddingModel?: string | undefined; generation?: UpdateEvalScheduleGeneration | undefined; generationConcurrency?: number | undefined; concurrency?: number | undefined; graderConcurrency?: number | undefined; maxSamplesPerTask?: number | undefined; maxWorkflowSampleActivities?: number | undefined; }; /** * OK */ export type UpdateEvalScheduleResponseBody = { id: string; object: "eval.schedule"; name: string; description: string | null; suiteId: string; suiteVersion: number | null; cron: string | null; intervalSeconds: number | null; timezone: string; overlapPolicy: components.EvalScheduleOverlapPolicy; enabled: boolean; webhookUrl: string | null; /** * True when a signing secret is stored. The secret itself is never returned. */ webhookConfigured: boolean; run: UpdateEvalScheduleRun; metadata: { [k: string]: string }; lastRunId: string | null; lastRunAt: number | null; lastRunStatus: string | null; /** * Next scheduled fire time from Temporal, when resolvable. */ nextRunAt: number | null; createdAt: number; updatedAt: number; }; /** @internal */ export const UpdateEvalScheduleRequest$inboundSchema: z.ZodType< UpdateEvalScheduleRequest, z.ZodTypeDef, unknown > = z.object({ schedule_id: z.string(), "X-On-Behalf-Of": z.string().optional(), UpdateEvalScheduleRequest: components.UpdateEvalScheduleRequest$inboundSchema, }).transform((v) => { return remap$(v, { "schedule_id": "scheduleId", "X-On-Behalf-Of": "xOnBehalfOf", "UpdateEvalScheduleRequest": "updateEvalScheduleRequest", }); }); /** @internal */ export type UpdateEvalScheduleRequest$Outbound = { schedule_id: string; "X-On-Behalf-Of"?: string | undefined; UpdateEvalScheduleRequest: components.UpdateEvalScheduleRequest$Outbound; }; /** @internal */ export const UpdateEvalScheduleRequest$outboundSchema: z.ZodType< UpdateEvalScheduleRequest$Outbound, z.ZodTypeDef, UpdateEvalScheduleRequest > = z.object({ scheduleId: z.string(), xOnBehalfOf: z.string().optional(), updateEvalScheduleRequest: components.UpdateEvalScheduleRequest$outboundSchema, }).transform((v) => { return remap$(v, { scheduleId: "schedule_id", xOnBehalfOf: "X-On-Behalf-Of", updateEvalScheduleRequest: "UpdateEvalScheduleRequest", }); }); export function updateEvalScheduleRequestToJSON( updateEvalScheduleRequest: UpdateEvalScheduleRequest, ): string { return JSON.stringify( UpdateEvalScheduleRequest$outboundSchema.parse(updateEvalScheduleRequest), ); } export function updateEvalScheduleRequestFromJSON( jsonString: string, ): SafeParseResult { return safeParse( jsonString, (x) => UpdateEvalScheduleRequest$inboundSchema.parse(JSON.parse(x)), `Failed to parse 'UpdateEvalScheduleRequest' from JSON`, ); } /** @internal */ export const UpdateEvalScheduleStop$inboundSchema: z.ZodType< UpdateEvalScheduleStop, z.ZodTypeDef, unknown > = z.union([z.string(), z.array(z.string())]); /** @internal */ export type UpdateEvalScheduleStop$Outbound = string | Array; /** @internal */ export const UpdateEvalScheduleStop$outboundSchema: z.ZodType< UpdateEvalScheduleStop$Outbound, z.ZodTypeDef, UpdateEvalScheduleStop > = z.union([z.string(), z.array(z.string())]); export function updateEvalScheduleStopToJSON( updateEvalScheduleStop: UpdateEvalScheduleStop, ): string { return JSON.stringify( UpdateEvalScheduleStop$outboundSchema.parse(updateEvalScheduleStop), ); } export function updateEvalScheduleStopFromJSON( jsonString: string, ): SafeParseResult { return safeParse( jsonString, (x) => UpdateEvalScheduleStop$inboundSchema.parse(JSON.parse(x)), `Failed to parse 'UpdateEvalScheduleStop' from JSON`, ); } /** @internal */ export const UpdateEvalScheduleTruncation$inboundSchema: z.ZodNativeEnum< typeof UpdateEvalScheduleTruncation > = z.nativeEnum(UpdateEvalScheduleTruncation); /** @internal */ export const UpdateEvalScheduleTruncation$outboundSchema: z.ZodNativeEnum< typeof UpdateEvalScheduleTruncation > = UpdateEvalScheduleTruncation$inboundSchema; /** @internal */ export const UpdateEvalScheduleServiceTier$inboundSchema: z.ZodNativeEnum< typeof UpdateEvalScheduleServiceTier > = z.nativeEnum(UpdateEvalScheduleServiceTier); /** @internal */ export const UpdateEvalScheduleServiceTier$outboundSchema: z.ZodNativeEnum< typeof UpdateEvalScheduleServiceTier > = UpdateEvalScheduleServiceTier$inboundSchema; /** @internal */ export const UpdateEvalSchedulePrefillThink$inboundSchema: z.ZodType< UpdateEvalSchedulePrefillThink, z.ZodTypeDef, unknown > = z.union([z.boolean(), z.string()]); /** @internal */ export type UpdateEvalSchedulePrefillThink$Outbound = boolean | string; /** @internal */ export const UpdateEvalSchedulePrefillThink$outboundSchema: z.ZodType< UpdateEvalSchedulePrefillThink$Outbound, z.ZodTypeDef, UpdateEvalSchedulePrefillThink > = z.union([z.boolean(), z.string()]); export function updateEvalSchedulePrefillThinkToJSON( updateEvalSchedulePrefillThink: UpdateEvalSchedulePrefillThink, ): string { return JSON.stringify( UpdateEvalSchedulePrefillThink$outboundSchema.parse( updateEvalSchedulePrefillThink, ), ); } export function updateEvalSchedulePrefillThinkFromJSON( jsonString: string, ): SafeParseResult { return safeParse( jsonString, (x) => UpdateEvalSchedulePrefillThink$inboundSchema.parse(JSON.parse(x)), `Failed to parse 'UpdateEvalSchedulePrefillThink' from JSON`, ); } /** @internal */ export const UpdateEvalScheduleGeneration$inboundSchema: z.ZodType< UpdateEvalScheduleGeneration, 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: UpdateEvalScheduleTruncation$inboundSchema.optional(), service_tier: UpdateEvalScheduleServiceTier$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 UpdateEvalScheduleGeneration$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 UpdateEvalScheduleGeneration$outboundSchema: z.ZodType< UpdateEvalScheduleGeneration$Outbound, z.ZodTypeDef, UpdateEvalScheduleGeneration > = 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: UpdateEvalScheduleTruncation$outboundSchema.optional(), serviceTier: UpdateEvalScheduleServiceTier$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 updateEvalScheduleGenerationToJSON( updateEvalScheduleGeneration: UpdateEvalScheduleGeneration, ): string { return JSON.stringify( UpdateEvalScheduleGeneration$outboundSchema.parse( updateEvalScheduleGeneration, ), ); } export function updateEvalScheduleGenerationFromJSON( jsonString: string, ): SafeParseResult { return safeParse( jsonString, (x) => UpdateEvalScheduleGeneration$inboundSchema.parse(JSON.parse(x)), `Failed to parse 'UpdateEvalScheduleGeneration' from JSON`, ); } /** @internal */ export const UpdateEvalScheduleRun$inboundSchema: z.ZodType< UpdateEvalScheduleRun, z.ZodTypeDef, unknown > = z.object({ models: z.array(z.string()), task_ids: z.array(z.string()).optional(), judge_model: z.string().optional(), embedding_model: z.string().optional(), generation: z.lazy(() => UpdateEvalScheduleGeneration$inboundSchema) .optional(), generation_concurrency: z.number().int().optional(), concurrency: z.number().int().optional(), grader_concurrency: z.number().int().optional(), max_samples_per_task: z.number().int().optional(), max_workflow_sample_activities: z.number().int().optional(), }).transform((v) => { return remap$(v, { "task_ids": "taskIds", "judge_model": "judgeModel", "embedding_model": "embeddingModel", "generation_concurrency": "generationConcurrency", "grader_concurrency": "graderConcurrency", "max_samples_per_task": "maxSamplesPerTask", "max_workflow_sample_activities": "maxWorkflowSampleActivities", }); }); /** @internal */ export type UpdateEvalScheduleRun$Outbound = { models: Array; task_ids?: Array | undefined; judge_model?: string | undefined; embedding_model?: string | undefined; generation?: UpdateEvalScheduleGeneration$Outbound | undefined; generation_concurrency?: number | undefined; concurrency?: number | undefined; grader_concurrency?: number | undefined; max_samples_per_task?: number | undefined; max_workflow_sample_activities?: number | undefined; }; /** @internal */ export const UpdateEvalScheduleRun$outboundSchema: z.ZodType< UpdateEvalScheduleRun$Outbound, z.ZodTypeDef, UpdateEvalScheduleRun > = z.object({ models: z.array(z.string()), taskIds: z.array(z.string()).optional(), judgeModel: z.string().optional(), embeddingModel: z.string().optional(), generation: z.lazy(() => UpdateEvalScheduleGeneration$outboundSchema) .optional(), generationConcurrency: z.number().int().optional(), concurrency: z.number().int().optional(), graderConcurrency: z.number().int().optional(), maxSamplesPerTask: z.number().int().optional(), maxWorkflowSampleActivities: z.number().int().optional(), }).transform((v) => { return remap$(v, { taskIds: "task_ids", judgeModel: "judge_model", embeddingModel: "embedding_model", generationConcurrency: "generation_concurrency", graderConcurrency: "grader_concurrency", maxSamplesPerTask: "max_samples_per_task", maxWorkflowSampleActivities: "max_workflow_sample_activities", }); }); export function updateEvalScheduleRunToJSON( updateEvalScheduleRun: UpdateEvalScheduleRun, ): string { return JSON.stringify( UpdateEvalScheduleRun$outboundSchema.parse(updateEvalScheduleRun), ); } export function updateEvalScheduleRunFromJSON( jsonString: string, ): SafeParseResult { return safeParse( jsonString, (x) => UpdateEvalScheduleRun$inboundSchema.parse(JSON.parse(x)), `Failed to parse 'UpdateEvalScheduleRun' from JSON`, ); } /** @internal */ export const UpdateEvalScheduleResponseBody$inboundSchema: z.ZodType< UpdateEvalScheduleResponseBody, z.ZodTypeDef, unknown > = z.object({ id: z.string(), object: z.literal("eval.schedule"), name: z.string(), description: z.nullable(z.string()), suite_id: z.string(), suite_version: z.nullable(z.number().int()), cron: z.nullable(z.string()), interval_seconds: z.nullable(z.number().int()), timezone: z.string(), overlap_policy: components.EvalScheduleOverlapPolicy$inboundSchema, enabled: z.boolean(), webhook_url: z.nullable(z.string()), webhook_configured: z.boolean(), run: z.lazy(() => UpdateEvalScheduleRun$inboundSchema), metadata: z.record(z.string()), last_run_id: z.nullable(z.string()), last_run_at: z.nullable(z.number().int()), last_run_status: z.nullable(z.string()), next_run_at: z.nullable(z.number().int()), created_at: z.number().int(), updated_at: z.number().int(), }).transform((v) => { return remap$(v, { "suite_id": "suiteId", "suite_version": "suiteVersion", "interval_seconds": "intervalSeconds", "overlap_policy": "overlapPolicy", "webhook_url": "webhookUrl", "webhook_configured": "webhookConfigured", "last_run_id": "lastRunId", "last_run_at": "lastRunAt", "last_run_status": "lastRunStatus", "next_run_at": "nextRunAt", "created_at": "createdAt", "updated_at": "updatedAt", }); }); /** @internal */ export type UpdateEvalScheduleResponseBody$Outbound = { id: string; object: "eval.schedule"; name: string; description: string | null; suite_id: string; suite_version: number | null; cron: string | null; interval_seconds: number | null; timezone: string; overlap_policy: string; enabled: boolean; webhook_url: string | null; webhook_configured: boolean; run: UpdateEvalScheduleRun$Outbound; metadata: { [k: string]: string }; last_run_id: string | null; last_run_at: number | null; last_run_status: string | null; next_run_at: number | null; created_at: number; updated_at: number; }; /** @internal */ export const UpdateEvalScheduleResponseBody$outboundSchema: z.ZodType< UpdateEvalScheduleResponseBody$Outbound, z.ZodTypeDef, UpdateEvalScheduleResponseBody > = z.object({ id: z.string(), object: z.literal("eval.schedule"), name: z.string(), description: z.nullable(z.string()), suiteId: z.string(), suiteVersion: z.nullable(z.number().int()), cron: z.nullable(z.string()), intervalSeconds: z.nullable(z.number().int()), timezone: z.string(), overlapPolicy: components.EvalScheduleOverlapPolicy$outboundSchema, enabled: z.boolean(), webhookUrl: z.nullable(z.string()), webhookConfigured: z.boolean(), run: z.lazy(() => UpdateEvalScheduleRun$outboundSchema), metadata: z.record(z.string()), lastRunId: z.nullable(z.string()), lastRunAt: z.nullable(z.number().int()), lastRunStatus: z.nullable(z.string()), nextRunAt: z.nullable(z.number().int()), createdAt: z.number().int(), updatedAt: z.number().int(), }).transform((v) => { return remap$(v, { suiteId: "suite_id", suiteVersion: "suite_version", intervalSeconds: "interval_seconds", overlapPolicy: "overlap_policy", webhookUrl: "webhook_url", webhookConfigured: "webhook_configured", lastRunId: "last_run_id", lastRunAt: "last_run_at", lastRunStatus: "last_run_status", nextRunAt: "next_run_at", createdAt: "created_at", updatedAt: "updated_at", }); }); export function updateEvalScheduleResponseBodyToJSON( updateEvalScheduleResponseBody: UpdateEvalScheduleResponseBody, ): string { return JSON.stringify( UpdateEvalScheduleResponseBody$outboundSchema.parse( updateEvalScheduleResponseBody, ), ); } export function updateEvalScheduleResponseBodyFromJSON( jsonString: string, ): SafeParseResult { return safeParse( jsonString, (x) => UpdateEvalScheduleResponseBody$inboundSchema.parse(JSON.parse(x)), `Failed to parse 'UpdateEvalScheduleResponseBody' from JSON`, ); }