UNPKG

@timangames/vector-grounding-service

Version:

A REST wrapper for SAP AI Core Vector API with document grounding capabilities

91 lines (76 loc) 2.23 kB
// Vector Grounding Service Library Type Definitions // Main entry point for library usage import { DocumentProcessor } from './services/documentProcessor'; import { SapAiService } from './services/sapAiService'; // Export the main classes export { DocumentProcessor, SapAiService }; // Configuration interfaces export interface ChunkingOptions { maxTokenSize?: number; similarityThreshold?: number; onnxEmbeddingModel?: string; returnEmbedding?: boolean; returnTokenLength?: boolean; logging?: boolean; } export interface BatchOptions { initialBatchSize?: number; maxPayloadSizeMB?: number; maxRetries?: number; } export interface ProcessAndUploadOptions { chunkingOptions?: ChunkingOptions; batchOptions?: BatchOptions; } // File interface (compatible with multer) export interface MulterFile { originalname: string; buffer: Buffer; size: number; mimetype?: string; fieldname?: string; encoding?: string; } // Processing result interfaces export interface FileMetadata { fileName: string; fileSize: number; fileType: string; uploadDate: string; pages?: number; info?: any; messages?: any[]; } export interface ProcessingResult { documents: any[]; originalMetadata: FileMetadata; chunkCount: number; documentCount: number; } export interface BatchUploadResult { totalDocuments: number; totalBatches: number; results: any[]; } export interface ProcessAndUploadResult extends ProcessingResult { uploadResult: BatchUploadResult; } // Vector Grounding Service interface export interface VectorGroundingService { documentProcessor: DocumentProcessor; sapAiService: SapAiService; processAndUpload( file: MulterFile, collectionId: string, options?: ProcessAndUploadOptions ): Promise<ProcessAndUploadResult>; } // Main convenience function export function createVectorGroundingService(config?: any): VectorGroundingService; // Default export declare const _default: { DocumentProcessor: typeof DocumentProcessor; SapAiService: typeof SapAiService; createVectorGroundingService: typeof createVectorGroundingService; }; export default _default;