/*
 * 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 { Result as SafeParseResult } from "../../types/fp.js";
import { SDKValidationError } from "../errors/sdkvalidationerror.js";

export type ClassifierTrainingParameters = {
  trainingSteps?: number | null | undefined;
  learningRate: number | undefined;
  weightDecay?: number | null | undefined;
  warmupFraction?: number | null | undefined;
  epochs?: number | null | undefined;
  seqLen?: number | null | undefined;
};

/** @internal */
export const ClassifierTrainingParameters$inboundSchema: z.ZodType<
  ClassifierTrainingParameters,
  z.ZodTypeDef,
  unknown
> = z.object({
  training_steps: z.nullable(z.number().int()).optional(),
  learning_rate: z.number().default(0.0001),
  weight_decay: z.nullable(z.number()).optional(),
  warmup_fraction: z.nullable(z.number()).optional(),
  epochs: z.nullable(z.number()).optional(),
  seq_len: z.nullable(z.number().int()).optional(),
}).transform((v) => {
  return remap$(v, {
    "training_steps": "trainingSteps",
    "learning_rate": "learningRate",
    "weight_decay": "weightDecay",
    "warmup_fraction": "warmupFraction",
    "seq_len": "seqLen",
  });
});

export function classifierTrainingParametersFromJSON(
  jsonString: string,
): SafeParseResult<ClassifierTrainingParameters, SDKValidationError> {
  return safeParse(
    jsonString,
    (x) => ClassifierTrainingParameters$inboundSchema.parse(JSON.parse(x)),
    `Failed to parse 'ClassifierTrainingParameters' from JSON`,
  );
}
