/* * 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 FileSearchResult = { /** * The unique ID of the document. */ fileId: string; /** * The name of the document. */ filename: string; /** * The relevance score of the chunk - a value between 0 and 1. */ score: number; /** * The text content of the chunk. */ text: string; /** * The attributes of the chunk. */ attributes: { [k: string]: any }; }; /** @internal */ export const FileSearchResult$inboundSchema: z.ZodType< FileSearchResult, z.ZodTypeDef, unknown > = z.object({ file_id: z.string(), filename: z.string(), score: z.number(), text: z.string(), attributes: z.record(z.any()), }).transform((v) => { return remap$(v, { "file_id": "fileId", }); }); /** @internal */ export type FileSearchResult$Outbound = { file_id: string; filename: string; score: number; text: string; attributes: { [k: string]: any }; }; /** @internal */ export const FileSearchResult$outboundSchema: z.ZodType< FileSearchResult$Outbound, z.ZodTypeDef, FileSearchResult > = z.object({ fileId: z.string(), filename: z.string(), score: z.number(), text: z.string(), attributes: z.record(z.any()), }).transform((v) => { return remap$(v, { fileId: "file_id", }); }); export function fileSearchResultToJSON( fileSearchResult: FileSearchResult, ): string { return JSON.stringify( FileSearchResult$outboundSchema.parse(fileSearchResult), ); } export function fileSearchResultFromJSON( jsonString: string, ): SafeParseResult { return safeParse( jsonString, (x) => FileSearchResult$inboundSchema.parse(JSON.parse(x)), `Failed to parse 'FileSearchResult' from JSON`, ); }