/* * 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"; /** * Annotation for referencing a file path in the model's output. Used when the model mentions specific files. */ export type FilePath = { /** * The annotation type identifier for file path references. */ type: "file_path"; /** * The ID of the file being referenced. */ fileId: string; /** * The character index in the output text where this file path reference applies. */ index: number; }; /** @internal */ export const FilePath$inboundSchema: z.ZodType< FilePath, z.ZodTypeDef, unknown > = z.object({ type: z.literal("file_path"), file_id: z.string(), index: z.number().int(), }).transform((v) => { return remap$(v, { "file_id": "fileId", }); }); /** @internal */ export type FilePath$Outbound = { type: "file_path"; file_id: string; index: number; }; /** @internal */ export const FilePath$outboundSchema: z.ZodType< FilePath$Outbound, z.ZodTypeDef, FilePath > = z.object({ type: z.literal("file_path"), fileId: z.string(), index: z.number().int(), }).transform((v) => { return remap$(v, { fileId: "file_id", }); }); export function filePathToJSON(filePath: FilePath): string { return JSON.stringify(FilePath$outboundSchema.parse(filePath)); } export function filePathFromJSON( jsonString: string, ): SafeParseResult { return safeParse( jsonString, (x) => FilePath$inboundSchema.parse(JSON.parse(x)), `Failed to parse 'FilePath' from JSON`, ); }