/* * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. * @generated-id: 675fa25f947c */ import * as z from "zod/v3"; import { safeParse } from "../../lib/schemas.js"; import { Result as SafeParseResult } from "../../types/fp.js"; import { SDKValidationError } from "../errors/sdkvalidationerror.js"; import { ChatFile, ChatFile$inboundSchema, ChatFile$Outbound, ChatFile$outboundSchema, } from "./chatfile.js"; import { CustomEntity, CustomEntity$inboundSchema, CustomEntity$Outbound, CustomEntity$outboundSchema, } from "./customentity.js"; import { Document, Document$inboundSchema, Document$Outbound, Document$outboundSchema, } from "./document.js"; import { Person, Person$inboundSchema, Person$Outbound, Person$outboundSchema, } from "./person.js"; import { ReferenceRange, ReferenceRange$inboundSchema, ReferenceRange$Outbound, ReferenceRange$outboundSchema, } from "./referencerange.js"; /** * Information about the source for a ChatMessage. */ export type ChatMessageCitation = { /** * An opaque token that represents this particular result in this particular ChatMessage. To be used for /feedback reporting. */ trackingToken?: string | undefined; sourceDocument?: Document | undefined; /** * Structure for file uploaded by a user for Chat. */ sourceFile?: ChatFile | undefined; sourcePerson?: Person | undefined; sourceCustomEntity?: CustomEntity | undefined; /** * Each reference range and its corresponding snippets */ referenceRanges?: Array | undefined; }; /** @internal */ export const ChatMessageCitation$inboundSchema: z.ZodType< ChatMessageCitation, z.ZodTypeDef, unknown > = z.object({ trackingToken: z.string().optional(), sourceDocument: Document$inboundSchema.optional(), sourceFile: ChatFile$inboundSchema.optional(), sourcePerson: Person$inboundSchema.optional(), sourceCustomEntity: CustomEntity$inboundSchema.optional(), referenceRanges: z.array(ReferenceRange$inboundSchema).optional(), }); /** @internal */ export type ChatMessageCitation$Outbound = { trackingToken?: string | undefined; sourceDocument?: Document$Outbound | undefined; sourceFile?: ChatFile$Outbound | undefined; sourcePerson?: Person$Outbound | undefined; sourceCustomEntity?: CustomEntity$Outbound | undefined; referenceRanges?: Array | undefined; }; /** @internal */ export const ChatMessageCitation$outboundSchema: z.ZodType< ChatMessageCitation$Outbound, z.ZodTypeDef, ChatMessageCitation > = z.object({ trackingToken: z.string().optional(), sourceDocument: Document$outboundSchema.optional(), sourceFile: ChatFile$outboundSchema.optional(), sourcePerson: Person$outboundSchema.optional(), sourceCustomEntity: CustomEntity$outboundSchema.optional(), referenceRanges: z.array(ReferenceRange$outboundSchema).optional(), }); export function chatMessageCitationToJSON( chatMessageCitation: ChatMessageCitation, ): string { return JSON.stringify( ChatMessageCitation$outboundSchema.parse(chatMessageCitation), ); } export function chatMessageCitationFromJSON( jsonString: string, ): SafeParseResult { return safeParse( jsonString, (x) => ChatMessageCitation$inboundSchema.parse(JSON.parse(x)), `Failed to parse 'ChatMessageCitation' from JSON`, ); }