/* * 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 { ClosedEnum } from "../../types/enums.js"; import { Result as SafeParseResult } from "../../types/fp.js"; import { SDKValidationError } from "../errors/sdkvalidationerror.js"; import { FileCounts, FileCounts$inboundSchema, FileCounts$Outbound, FileCounts$outboundSchema, } from "./filecounts.js"; /** * The status of the vector store files batch. 'in_progress' means files are being processed, 'completed' means all files have been processed, 'cancelled' means the batch was cancelled, 'failed' means the batch failed. */ export const VectorStoreFileBatchStatus = { InProgress: "in_progress", Completed: "completed", Cancelled: "cancelled", Failed: "failed", } as const; /** * The status of the vector store files batch. 'in_progress' means files are being processed, 'completed' means all files have been processed, 'cancelled' means the batch was cancelled, 'failed' means the batch failed. */ export type VectorStoreFileBatchStatus = ClosedEnum< typeof VectorStoreFileBatchStatus >; /** * A batch of files attached to a vector store. */ export type VectorStoreFileBatch = { /** * The identifier, which can be referenced in API endpoints. */ id: string; /** * The object type, which is always 'vector_store.file_batch'. */ object: "vector_store.file_batch"; /** * The Unix timestamp (in seconds) for when the vector store files batch was created. */ createdAt: number; /** * The ID of the vector store that the File is attached to. */ vectorStoreId: string; /** * The status of the vector store files batch. 'in_progress' means files are being processed, 'completed' means all files have been processed, 'cancelled' means the batch was cancelled, 'failed' means the batch failed. */ status: VectorStoreFileBatchStatus; /** * File processing status counts. */ fileCounts: FileCounts; }; /** @internal */ export const VectorStoreFileBatchStatus$inboundSchema: z.ZodNativeEnum< typeof VectorStoreFileBatchStatus > = z.nativeEnum(VectorStoreFileBatchStatus); /** @internal */ export const VectorStoreFileBatchStatus$outboundSchema: z.ZodNativeEnum< typeof VectorStoreFileBatchStatus > = VectorStoreFileBatchStatus$inboundSchema; /** @internal */ export const VectorStoreFileBatch$inboundSchema: z.ZodType< VectorStoreFileBatch, z.ZodTypeDef, unknown > = z.object({ id: z.string(), object: z.literal("vector_store.file_batch"), created_at: z.number().int(), vector_store_id: z.string(), status: VectorStoreFileBatchStatus$inboundSchema, file_counts: FileCounts$inboundSchema, }).transform((v) => { return remap$(v, { "created_at": "createdAt", "vector_store_id": "vectorStoreId", "file_counts": "fileCounts", }); }); /** @internal */ export type VectorStoreFileBatch$Outbound = { id: string; object: "vector_store.file_batch"; created_at: number; vector_store_id: string; status: string; file_counts: FileCounts$Outbound; }; /** @internal */ export const VectorStoreFileBatch$outboundSchema: z.ZodType< VectorStoreFileBatch$Outbound, z.ZodTypeDef, VectorStoreFileBatch > = z.object({ id: z.string(), object: z.literal("vector_store.file_batch"), createdAt: z.number().int(), vectorStoreId: z.string(), status: VectorStoreFileBatchStatus$outboundSchema, fileCounts: FileCounts$outboundSchema, }).transform((v) => { return remap$(v, { createdAt: "created_at", vectorStoreId: "vector_store_id", fileCounts: "file_counts", }); }); export function vectorStoreFileBatchToJSON( vectorStoreFileBatch: VectorStoreFileBatch, ): string { return JSON.stringify( VectorStoreFileBatch$outboundSchema.parse(vectorStoreFileBatch), ); } export function vectorStoreFileBatchFromJSON( jsonString: string, ): SafeParseResult { return safeParse( jsonString, (x) => VectorStoreFileBatch$inboundSchema.parse(JSON.parse(x)), `Failed to parse 'VectorStoreFileBatch' from JSON`, ); }