/* * 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 CompactionContextManagement = { type: "compaction"; /** * The token threshold above which conversation context should be compacted. Must be at least 1000. */ compactThreshold: number; }; /** @internal */ export const CompactionContextManagement$inboundSchema: z.ZodType< CompactionContextManagement, z.ZodTypeDef, unknown > = z.object({ type: z.literal("compaction"), compact_threshold: z.number().int(), }).transform((v) => { return remap$(v, { "compact_threshold": "compactThreshold", }); }); /** @internal */ export type CompactionContextManagement$Outbound = { type: "compaction"; compact_threshold: number; }; /** @internal */ export const CompactionContextManagement$outboundSchema: z.ZodType< CompactionContextManagement$Outbound, z.ZodTypeDef, CompactionContextManagement > = z.object({ type: z.literal("compaction"), compactThreshold: z.number().int(), }).transform((v) => { return remap$(v, { compactThreshold: "compact_threshold", }); }); export function compactionContextManagementToJSON( compactionContextManagement: CompactionContextManagement, ): string { return JSON.stringify( CompactionContextManagement$outboundSchema.parse( compactionContextManagement, ), ); } export function compactionContextManagementFromJSON( jsonString: string, ): SafeParseResult { return safeParse( jsonString, (x) => CompactionContextManagement$inboundSchema.parse(JSON.parse(x)), `Failed to parse 'CompactionContextManagement' from JSON`, ); }