@juspay/neurolink
Version:
Universal AI Development Platform with working MCP integration, multi-provider support, and professional CLI. Built-in tools operational, 58+ external MCP servers discoverable. Connect to filesystem, GitHub, database operations, and more. Build, test, and
177 lines (176 loc) • 5.18 kB
TypeScript
/**
* SageMaker Model Detection and Streaming Capability Discovery
*
* This module provides intelligent detection of SageMaker endpoint capabilities
* including model type identification and streaming protocol support.
*/
import type { SageMakerConfig, SageMakerModelConfig } from "./types.js";
/**
* Streaming capability information for an endpoint
*/
export interface StreamingCapability {
/** Whether streaming is supported */
supported: boolean;
/** Detected streaming protocol */
protocol: "sse" | "jsonl" | "chunked" | "none";
/** Detected model framework */
modelType: "huggingface" | "llama" | "pytorch" | "tensorflow" | "custom";
/** Test endpoint for streaming validation */
testEndpoint?: string;
/** Required parameters for streaming */
parameters?: Record<string, unknown>;
/** Confidence level of detection (0-1) */
confidence: number;
/** Additional metadata about the model */
metadata?: {
modelName?: string;
framework?: string;
version?: string;
tags?: string[];
};
}
/**
* Model type detection result
*/
export interface ModelDetectionResult {
/** Primary model type */
type: StreamingCapability["modelType"];
/** Detection confidence (0-1) */
confidence: number;
/** Evidence used for detection */
evidence: string[];
/** Suggested configuration */
suggestedConfig?: Partial<SageMakerModelConfig>;
}
/**
* Endpoint health and metadata information
*/
export interface EndpointHealth {
/** Health status */
status: "healthy" | "unhealthy" | "unknown";
/** Response time in milliseconds */
responseTime: number;
/** Endpoint metadata if available */
metadata?: Record<string, unknown>;
/** Model information if discoverable */
modelInfo?: {
name?: string;
version?: string;
framework?: string;
architecture?: string;
};
}
/**
* SageMaker Model Detection and Capability Discovery Service
*/
export declare class SageMakerDetector {
private client;
private config;
constructor(config: SageMakerConfig);
/**
* Detect streaming capabilities for a given endpoint
*/
detectStreamingCapability(endpointName: string): Promise<StreamingCapability>;
/**
* Detect the model type/framework for an endpoint
*/
detectModelType(endpointName: string): Promise<ModelDetectionResult>;
/**
* Check endpoint health and gather metadata
*/
checkEndpointHealth(endpointName: string): Promise<EndpointHealth>;
/**
* Test if endpoint supports streaming for given model type
*/
private testStreamingSupport;
/**
* Detect streaming protocol used by endpoint
*/
private detectStreamingProtocol;
/**
* Test for HuggingFace Transformers signature
*/
private testHuggingFaceSignature;
/**
* Test for LLaMA model signature
*/
private testLlamaSignature;
/**
* Test for PyTorch model signature
*/
private testPyTorchSignature;
/**
* Test for TensorFlow Serving signature
*/
private testTensorFlowSignature;
/**
* Get streaming test cases for a model type
*/
private getStreamingTestCases;
/**
* Check if response indicates streaming support
*/
private indicatesStreamingSupport;
/**
* Extract model information from response
*/
private extractModelInfo;
/**
* Get suggested configuration for detected model type
*/
private getSuggestedConfig;
/**
* Run detection tests in parallel with intelligent rate limiting and circuit breaker
* Now uses configuration object for better parameter management
*/
private runDetectionTestsInParallel;
/**
* Create a semaphore for detection test concurrency control
*/
private createDetectionSemaphore;
/**
* Wrap a detection test with error handling, rate limiting, and retry logic
* Now uses configuration object instead of multiple parameters
*/
private wrapDetectionTest;
/**
* Execute a test with staggered start to spread load
*/
private executeWithStaggeredStart;
/**
* Handle detection test errors with rate limiting and retry logic
*/
private handleDetectionTestError;
/**
* Check if an error indicates rate limiting
*/
private isRateLimitError;
/**
* Retry a test with exponential backoff
*/
private retryWithBackoff;
/**
* Execute wrapped tests with concurrency control
*/
private executeTestsWithConcurrencyControl;
/**
* Log detection test failure
*/
private logDetectionTestFailure;
/**
* Log detection test retry failure
*/
private logDetectionTestRetryFailure;
/**
* Log final detection results
*/
private logDetectionResults;
/**
* Create a no-streaming capability result
*/
private createNoStreamingCapability;
}
/**
* Create a detector instance with configuration
*/
export declare function createSageMakerDetector(config: SageMakerConfig): SageMakerDetector;