/* * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. */ import * as z from "zod"; 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 { IndexMultimodalRequestImage, IndexMultimodalRequestImage$inboundSchema, IndexMultimodalRequestImage$Outbound, IndexMultimodalRequestImage$outboundSchema, } from "./indexmultimodalrequestimage.js"; export type IndexMultimodalRequest = { /** * The name of the index to add the document to */ indexName: string; /** * The ID of the document. If not provided, a unique document ID will be automatically generated by the server. */ docId?: string | undefined; /** * Image data that can be provided as either a URL or base64 encoded data, but not both */ image?: IndexMultimodalRequestImage | undefined; /** * The text content of the document to be indexed */ content?: string | undefined; /** * Title of the document to be indexed */ title?: string | undefined; /** * URL associated with the document to be indexed */ url?: string | undefined; /** * Metadata associated with the document. Accepts key value pairs where the value can be a string, number, boolean, or list of strings. */ metadata?: { [k: string]: any } | undefined; }; /** @internal */ export const IndexMultimodalRequest$inboundSchema: z.ZodType< IndexMultimodalRequest, z.ZodTypeDef, unknown > = z.object({ index_name: z.string(), doc_id: z.string().optional(), image: IndexMultimodalRequestImage$inboundSchema.optional(), content: z.string().optional(), title: z.string().optional(), url: z.string().optional(), metadata: z.record(z.any()).optional(), }).transform((v) => { return remap$(v, { "index_name": "indexName", "doc_id": "docId", }); }); /** @internal */ export type IndexMultimodalRequest$Outbound = { index_name: string; doc_id?: string | undefined; image?: IndexMultimodalRequestImage$Outbound | undefined; content?: string | undefined; title?: string | undefined; url?: string | undefined; metadata?: { [k: string]: any } | undefined; }; /** @internal */ export const IndexMultimodalRequest$outboundSchema: z.ZodType< IndexMultimodalRequest$Outbound, z.ZodTypeDef, IndexMultimodalRequest > = z.object({ indexName: z.string(), docId: z.string().optional(), image: IndexMultimodalRequestImage$outboundSchema.optional(), content: z.string().optional(), title: z.string().optional(), url: z.string().optional(), metadata: z.record(z.any()).optional(), }).transform((v) => { return remap$(v, { indexName: "index_name", docId: "doc_id", }); }); /** * @internal * @deprecated This namespace will be removed in future versions. Use schemas and types that are exported directly from this module. */ export namespace IndexMultimodalRequest$ { /** @deprecated use `IndexMultimodalRequest$inboundSchema` instead. */ export const inboundSchema = IndexMultimodalRequest$inboundSchema; /** @deprecated use `IndexMultimodalRequest$outboundSchema` instead. */ export const outboundSchema = IndexMultimodalRequest$outboundSchema; /** @deprecated use `IndexMultimodalRequest$Outbound` instead. */ export type Outbound = IndexMultimodalRequest$Outbound; } export function indexMultimodalRequestToJSON( indexMultimodalRequest: IndexMultimodalRequest, ): string { return JSON.stringify( IndexMultimodalRequest$outboundSchema.parse(indexMultimodalRequest), ); } export function indexMultimodalRequestFromJSON( jsonString: string, ): SafeParseResult { return safeParse( jsonString, (x) => IndexMultimodalRequest$inboundSchema.parse(JSON.parse(x)), `Failed to parse 'IndexMultimodalRequest' from JSON`, ); }