/* * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. * @generated-id: df55a6c0d58a */ import * as z from "zod/v4"; 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"; /** * Per-block confidence scores, computed per-word from model logprobs. * * @remarks * * All fields ``None`` when the block couldn't be scored. * Individual fields ``None`` when that signal is absent — e.g. an image-only block has * no caption, so content scores are ``None``. */ export type OCRBlockConfidenceScores = { /** * Average confidence over the block's content (caption) tokens. None when the block has no textual content (e.g. image-only entry). */ averageContentConfidenceScore?: number | null | undefined; /** * Minimum per-word content confidence in the block. None when the block has no textual content. */ minimumContentConfidenceScore?: number | null | undefined; /** * Confidence in the block type (e.g. 'text', 'title', 'table'). None when the entry had no block type or the block type span could not be located. */ blockTypeConfidenceScore?: number | null | undefined; }; /** @internal */ export const OCRBlockConfidenceScores$inboundSchema: z.ZodType< OCRBlockConfidenceScores, unknown > = z.object({ average_content_confidence_score: z.nullable(z.number()).optional(), minimum_content_confidence_score: z.nullable(z.number()).optional(), block_type_confidence_score: z.nullable(z.number()).optional(), }).transform((v) => { return remap$(v, { "average_content_confidence_score": "averageContentConfidenceScore", "minimum_content_confidence_score": "minimumContentConfidenceScore", "block_type_confidence_score": "blockTypeConfidenceScore", }); }); export function ocrBlockConfidenceScoresFromJSON( jsonString: string, ): SafeParseResult { return safeParse( jsonString, (x) => OCRBlockConfidenceScores$inboundSchema.parse(JSON.parse(x)), `Failed to parse 'OCRBlockConfidenceScores' from JSON`, ); }