/* * 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 { ClosedEnum } from "../../types/enums.js"; import { Result as SafeParseResult } from "../../types/fp.js"; import { SDKValidationError } from "../errors/sdkvalidationerror.js"; export const Level = { Info: "info", Warn: "warn", Error: "error", } as const; export type Level = ClosedEnum; export const FineTuningEventType = { Message: "message", Metrics: "metrics", } as const; export type FineTuningEventType = ClosedEnum; export type FineTuningEvent = { id: string; object: "fine_tuning.job.event"; createdAt: number; level: Level; message: string; type?: FineTuningEventType | null | undefined; data?: { [k: string]: any } | null | undefined; }; /** @internal */ export const Level$inboundSchema: z.ZodNativeEnum = z.nativeEnum( Level, ); /** @internal */ export const Level$outboundSchema: z.ZodNativeEnum = Level$inboundSchema; /** @internal */ export const FineTuningEventType$inboundSchema: z.ZodNativeEnum< typeof FineTuningEventType > = z.nativeEnum(FineTuningEventType); /** @internal */ export const FineTuningEventType$outboundSchema: z.ZodNativeEnum< typeof FineTuningEventType > = FineTuningEventType$inboundSchema; /** @internal */ export const FineTuningEvent$inboundSchema: z.ZodType< FineTuningEvent, z.ZodTypeDef, unknown > = z.object({ id: z.string(), object: z.literal("fine_tuning.job.event"), created_at: z.number().int(), level: Level$inboundSchema, message: z.string(), type: z.nullable(FineTuningEventType$inboundSchema).optional(), data: z.nullable(z.record(z.any())).optional(), }).transform((v) => { return remap$(v, { "created_at": "createdAt", }); }); /** @internal */ export type FineTuningEvent$Outbound = { id: string; object: "fine_tuning.job.event"; created_at: number; level: string; message: string; type?: string | null | undefined; data?: { [k: string]: any } | null | undefined; }; /** @internal */ export const FineTuningEvent$outboundSchema: z.ZodType< FineTuningEvent$Outbound, z.ZodTypeDef, FineTuningEvent > = z.object({ id: z.string(), object: z.literal("fine_tuning.job.event"), createdAt: z.number().int(), level: Level$outboundSchema, message: z.string(), type: z.nullable(FineTuningEventType$outboundSchema).optional(), data: z.nullable(z.record(z.any())).optional(), }).transform((v) => { return remap$(v, { createdAt: "created_at", }); }); export function fineTuningEventToJSON( fineTuningEvent: FineTuningEvent, ): string { return JSON.stringify(FineTuningEvent$outboundSchema.parse(fineTuningEvent)); } export function fineTuningEventFromJSON( jsonString: string, ): SafeParseResult { return safeParse( jsonString, (x) => FineTuningEvent$inboundSchema.parse(JSON.parse(x)), `Failed to parse 'FineTuningEvent' from JSON`, ); }