/* * 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"; import { ReasoningText, ReasoningText$inboundSchema, ReasoningText$Outbound, ReasoningText$outboundSchema, } from "./reasoningtext.js"; import { Status, Status$inboundSchema, Status$outboundSchema, } from "./status.js"; import { SummaryText, SummaryText$inboundSchema, SummaryText$Outbound, SummaryText$outboundSchema, } from "./summarytext.js"; /** * Reasoning item: Model reasoning metadata, including summary text and optional detailed reasoning content. */ export type ReasoningWithId = { type: "reasoning"; /** * The unique ID of the message. */ id: string; summary: Array; content?: Array | undefined; encryptedContent?: string | null | undefined; status?: Status | null | undefined; /** * The ID of the response that created this item, if any. */ responseId?: string | null | undefined; /** * Metadata from the response that created this item, if any. */ metadata?: { [k: string]: string } | null | undefined; }; /** @internal */ export const ReasoningWithId$inboundSchema: z.ZodType< ReasoningWithId, z.ZodTypeDef, unknown > = z.object({ type: z.literal("reasoning"), id: z.string(), summary: z.array(SummaryText$inboundSchema), content: z.array(ReasoningText$inboundSchema).optional(), encrypted_content: z.nullable(z.string()).optional(), status: z.nullable(Status$inboundSchema).optional(), response_id: z.nullable(z.string()).optional(), metadata: z.nullable(z.record(z.string())).optional(), }).transform((v) => { return remap$(v, { "encrypted_content": "encryptedContent", "response_id": "responseId", }); }); /** @internal */ export type ReasoningWithId$Outbound = { type: "reasoning"; id: string; summary: Array; content?: Array | undefined; encrypted_content?: string | null | undefined; status?: string | null | undefined; response_id?: string | null | undefined; metadata?: { [k: string]: string } | null | undefined; }; /** @internal */ export const ReasoningWithId$outboundSchema: z.ZodType< ReasoningWithId$Outbound, z.ZodTypeDef, ReasoningWithId > = z.object({ type: z.literal("reasoning"), id: z.string(), summary: z.array(SummaryText$outboundSchema), content: z.array(ReasoningText$outboundSchema).optional(), encryptedContent: z.nullable(z.string()).optional(), status: z.nullable(Status$outboundSchema).optional(), responseId: z.nullable(z.string()).optional(), metadata: z.nullable(z.record(z.string())).optional(), }).transform((v) => { return remap$(v, { encryptedContent: "encrypted_content", responseId: "response_id", }); }); export function reasoningWithIdToJSON( reasoningWithId: ReasoningWithId, ): string { return JSON.stringify(ReasoningWithId$outboundSchema.parse(reasoningWithId)); } export function reasoningWithIdFromJSON( jsonString: string, ): SafeParseResult { return safeParse( jsonString, (x) => ReasoningWithId$inboundSchema.parse(JSON.parse(x)), `Failed to parse 'ReasoningWithId' from JSON`, ); }