/* * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. */ import * as z from "zod"; 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 "./sdkvalidationerror.js"; export type NewLogProbsContentTopLogProbs = { token?: string | undefined; logprob?: number | undefined; tokenId?: number | undefined; /** * The byte representation of the token. */ bytes?: Array | undefined; }; /** @internal */ export const NewLogProbsContentTopLogProbs$inboundSchema: z.ZodType< NewLogProbsContentTopLogProbs, z.ZodTypeDef, unknown > = z.object({ token: z.string().optional(), logprob: z.number().optional(), token_id: z.number().int().optional(), bytes: z.array(z.number().int()).optional(), }).transform((v) => { return remap$(v, { "token_id": "tokenId", }); }); /** @internal */ export type NewLogProbsContentTopLogProbs$Outbound = { token?: string | undefined; logprob?: number | undefined; token_id?: number | undefined; bytes?: Array | undefined; }; /** @internal */ export const NewLogProbsContentTopLogProbs$outboundSchema: z.ZodType< NewLogProbsContentTopLogProbs$Outbound, z.ZodTypeDef, NewLogProbsContentTopLogProbs > = z.object({ token: z.string().optional(), logprob: z.number().optional(), tokenId: z.number().int().optional(), bytes: z.array(z.number().int()).optional(), }).transform((v) => { return remap$(v, { tokenId: "token_id", }); }); /** * @internal * @deprecated This namespace will be removed in future versions. Use schemas and types that are exported directly from this module. */ export namespace NewLogProbsContentTopLogProbs$ { /** @deprecated use `NewLogProbsContentTopLogProbs$inboundSchema` instead. */ export const inboundSchema = NewLogProbsContentTopLogProbs$inboundSchema; /** @deprecated use `NewLogProbsContentTopLogProbs$outboundSchema` instead. */ export const outboundSchema = NewLogProbsContentTopLogProbs$outboundSchema; /** @deprecated use `NewLogProbsContentTopLogProbs$Outbound` instead. */ export type Outbound = NewLogProbsContentTopLogProbs$Outbound; } export function newLogProbsContentTopLogProbsToJSON( newLogProbsContentTopLogProbs: NewLogProbsContentTopLogProbs, ): string { return JSON.stringify( NewLogProbsContentTopLogProbs$outboundSchema.parse( newLogProbsContentTopLogProbs, ), ); } export function newLogProbsContentTopLogProbsFromJSON( jsonString: string, ): SafeParseResult { return safeParse( jsonString, (x) => NewLogProbsContentTopLogProbs$inboundSchema.parse(JSON.parse(x)), `Failed to parse 'NewLogProbsContentTopLogProbs' from JSON`, ); }