/* * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. */ import * as z from "zod/v4-mini"; import { safeParse } from "../lib/schemas.js"; import { Result as SafeParseResult } from "../types/fp.js"; import * as types from "../types/primitives.js"; import { smartUnion } from "../types/smart-union.js"; import { SDKValidationError } from "./errors/sdk-validation-error.js"; import { ModelOperationCapability, ModelOperationCapability$inboundSchema, } from "./model-operation-capability.js"; import { ModelProvider, ModelProvider$inboundSchema, } from "./model-provider.js"; export type ModelType = string | Array; export type ModelCreatedAt = string | number; export type Model = { modelId: string; upstreamModelId?: string | undefined; name?: string | null | undefined; provider: ModelProvider; family?: string | undefined; type?: string | Array | null | undefined; description?: string | null | undefined; input?: any | undefined; output?: any | undefined; contextWindow?: any | undefined; pricing?: any | undefined; maxOutputTokens?: number | undefined; capabilities?: any | undefined; modelType?: any | undefined; sourceMetadata?: any | undefined; params?: any | undefined; operations?: Array | undefined; ownedBy?: string | undefined; createdAt?: string | number | undefined; available?: boolean | undefined; availableFrom?: Array | undefined; hfInferenceProvider?: string | undefined; hfProviderId?: string | undefined; }; /** @internal */ export const ModelType$inboundSchema: z.ZodMiniType = smartUnion([types.string(), z.array(types.string())]); export function modelTypeFromJSON( jsonString: string, ): SafeParseResult { return safeParse( jsonString, (x) => ModelType$inboundSchema.parse(JSON.parse(x)), `Failed to parse 'ModelType' from JSON`, ); } /** @internal */ export const ModelCreatedAt$inboundSchema: z.ZodMiniType< ModelCreatedAt, unknown > = smartUnion([types.string(), types.number()]); export function modelCreatedAtFromJSON( jsonString: string, ): SafeParseResult { return safeParse( jsonString, (x) => ModelCreatedAt$inboundSchema.parse(JSON.parse(x)), `Failed to parse 'ModelCreatedAt' from JSON`, ); } /** @internal */ export const Model$inboundSchema: z.ZodMiniType = z.object({ modelId: types.string(), upstreamModelId: types.optional(types.string()), name: z.optional(z.nullable(types.string())), provider: ModelProvider$inboundSchema, family: types.optional(types.string()), type: z.optional( z.nullable(smartUnion([types.string(), z.array(types.string())])), ), description: z.optional(z.nullable(types.string())), input: types.optional(z.any()), output: types.optional(z.any()), contextWindow: types.optional(z.any()), pricing: types.optional(z.any()), maxOutputTokens: types.optional(types.number()), capabilities: types.optional(z.any()), modelType: types.optional(z.any()), sourceMetadata: types.optional(z.any()), params: types.optional(z.any()), operations: types.optional(z.array(ModelOperationCapability$inboundSchema)), ownedBy: types.optional(types.string()), createdAt: types.optional(smartUnion([types.string(), types.number()])), available: types.optional(types.boolean()), availableFrom: types.optional(z.array(types.string())), hfInferenceProvider: types.optional(types.string()), hfProviderId: types.optional(types.string()), }); export function modelFromJSON( jsonString: string, ): SafeParseResult { return safeParse( jsonString, (x) => Model$inboundSchema.parse(JSON.parse(x)), `Failed to parse 'Model' from JSON`, ); }