UNPKG

@relayplane/sdk

Version:

RelayPlane SDK with zero-config AI access, intelligent model selection, built-in examples, and contextual error handling. The easiest way to add AI to your app with automatic optimization and fallback.

76 lines 2.18 kB
/** * RelayPlane SDK - Batch Processing * * This module provides batch processing capabilities, allowing multiple * independent relay requests to be processed in parallel or sequentially. */ import type { BatchRequest, BatchResponse, RelayRequest } from '../types'; /** * Execute multiple relay requests in batch * * @param batchRequest - The batch configuration and requests * @returns Promise<BatchResponse> - Results from all requests */ export declare function batch(batchRequest: BatchRequest): Promise<BatchResponse>; /** * Create a batch request builder */ export declare function createBatch(): BatchBuilder; /** * Fluent API for building batch requests */ export declare class BatchBuilder { private requests; private options; /** * Add a request to the batch */ add(request: RelayRequest): BatchBuilder; /** * Add multiple requests to the batch */ addAll(requests: RelayRequest[]): BatchBuilder; /** * Set parallel processing (default: true) */ parallel(enabled?: boolean): BatchBuilder; /** * Set sequential processing */ sequential(): BatchBuilder; /** * Set fail fast mode (default: false) */ failFast(enabled?: boolean): BatchBuilder; /** * Set maximum concurrency for parallel processing */ maxConcurrency(limit: number): BatchBuilder; /** * Add metadata to the batch */ withMetadata(metadata: Record<string, any>): BatchBuilder; /** * Execute the batch */ run(): Promise<BatchResponse>; /** * Get the current number of requests in the batch */ size(): number; /** * Clear all requests from the batch */ clear(): BatchBuilder; } export declare const batchUtils: { /** * Create a batch of identical requests with different inputs */ createFromInputs: (model: string, basePayload: Record<string, any>, inputs: string[]) => BatchBuilder; /** * Create a batch that compares multiple models on the same input */ compareModels: (models: string[], payload: Record<string, any>) => BatchBuilder; }; //# sourceMappingURL=batch.d.ts.map