/* * 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 UpdatePartitionParamsMetadataSchema = | string | number | boolean | Array | { [k: string]: any }; export type UpdatePartitionParams = { /** * Enable context-aware descriptions for the partition. */ contextAware?: boolean | null | undefined; /** * Description of the partition. */ description?: string | null | undefined; /** * Metadata schema for the partition. This is an optional subset of the metadata of documents in the partition, defined as JSON Schema, that can be used in filter generatation. Providing detailed descriptions of the fields in the schema can be helpful for LLMs generating filters dynamically. */ metadataSchema?: | { [k: string]: string | number | boolean | Array | { [k: string]: any; }; } | null | undefined; }; /** @internal */ export const UpdatePartitionParamsMetadataSchema$inboundSchema: z.ZodType< UpdatePartitionParamsMetadataSchema, z.ZodTypeDef, unknown > = z.union([ z.string(), z.number().int(), z.boolean(), z.array(z.string()), z.record(z.any()), ]); /** @internal */ export type UpdatePartitionParamsMetadataSchema$Outbound = | string | number | boolean | Array | { [k: string]: any }; /** @internal */ export const UpdatePartitionParamsMetadataSchema$outboundSchema: z.ZodType< UpdatePartitionParamsMetadataSchema$Outbound, z.ZodTypeDef, UpdatePartitionParamsMetadataSchema > = z.union([ z.string(), z.number().int(), z.boolean(), z.array(z.string()), z.record(z.any()), ]); export function updatePartitionParamsMetadataSchemaToJSON( updatePartitionParamsMetadataSchema: UpdatePartitionParamsMetadataSchema, ): string { return JSON.stringify( UpdatePartitionParamsMetadataSchema$outboundSchema.parse( updatePartitionParamsMetadataSchema, ), ); } export function updatePartitionParamsMetadataSchemaFromJSON( jsonString: string, ): SafeParseResult { return safeParse( jsonString, (x) => UpdatePartitionParamsMetadataSchema$inboundSchema.parse(JSON.parse(x)), `Failed to parse 'UpdatePartitionParamsMetadataSchema' from JSON`, ); } /** @internal */ export const UpdatePartitionParams$inboundSchema: z.ZodType< UpdatePartitionParams, z.ZodTypeDef, unknown > = z.object({ context_aware: z.nullable(z.boolean()).optional(), description: z.nullable(z.string()).optional(), metadata_schema: z.nullable( z.record( z.union([ z.string(), z.number().int(), z.boolean(), z.array(z.string()), z.record(z.any()), ]), ), ).optional(), }).transform((v) => { return remap$(v, { "context_aware": "contextAware", "metadata_schema": "metadataSchema", }); }); /** @internal */ export type UpdatePartitionParams$Outbound = { context_aware?: boolean | null | undefined; description?: string | null | undefined; metadata_schema?: | { [k: string]: string | number | boolean | Array | { [k: string]: any; }; } | null | undefined; }; /** @internal */ export const UpdatePartitionParams$outboundSchema: z.ZodType< UpdatePartitionParams$Outbound, z.ZodTypeDef, UpdatePartitionParams > = z.object({ contextAware: z.nullable(z.boolean()).optional(), description: z.nullable(z.string()).optional(), metadataSchema: z.nullable( z.record( z.union([ z.string(), z.number().int(), z.boolean(), z.array(z.string()), z.record(z.any()), ]), ), ).optional(), }).transform((v) => { return remap$(v, { contextAware: "context_aware", metadataSchema: "metadata_schema", }); }); export function updatePartitionParamsToJSON( updatePartitionParams: UpdatePartitionParams, ): string { return JSON.stringify( UpdatePartitionParams$outboundSchema.parse(updatePartitionParams), ); } export function updatePartitionParamsFromJSON( jsonString: string, ): SafeParseResult { return safeParse( jsonString, (x) => UpdatePartitionParams$inboundSchema.parse(JSON.parse(x)), `Failed to parse 'UpdatePartitionParams' from JSON`, ); }