@juspay/neurolink
Version:
The pipe layer of an AI nervous system: one interface connecting provider neurons to your application, across three inference types — generate, stream and decide. `decide` returns typed, calibrated judgements from a non-generative model (~400ms, ~$0.00002
88 lines (87 loc) • 3.23 kB
TypeScript
/**
* Configuration management for Amazon SageMaker Provider
*
* This module handles loading, validation, and management of SageMaker
* configuration from environment variables, files, and defaults.
*/
import type { SageMakerConfig, SageMakerModelConfig } from "../../types/index.js";
/**
* Load and validate SageMaker configuration from environment variables
*
* Region priority:
* 1. region parameter (highest priority)
* 2. SAGEMAKER_REGION environment variable
* 3. AWS_REGION environment variable
* 4. Default value "us-east-1" (lowest priority)
*
* @param region - Optional region parameter override
* @returns Validated SageMaker configuration
* @throws {Error} When required configuration is missing or invalid
*/
export declare function getSageMakerConfig(region?: string,
/**
* Per-request credentials, applied BEFORE validation.
*
* They have to participate in validation rather than be overlaid onto an
* already-validated result: this function throws when accessKeyId or
* secretAccessKey is empty, so a caller passing credentials explicitly
* still had to have AWS_ACCESS_KEY_ID and AWS_SECRET_ACCESS_KEY set in the
* environment or construction failed before their values were ever looked
* at. That made `credentials.sagemaker` unusable on its own, which is the
* entire point of per-request credentials.
*/
overrides?: Partial<Pick<SageMakerConfig, "region" | "accessKeyId" | "secretAccessKey" | "sessionToken" | "endpoint">>): SageMakerConfig;
/**
* Load and validate SageMaker model configuration
*
* @param endpointName - Name of the SageMaker endpoint
* @returns Validated model configuration
*/
export declare function getSageMakerModelConfig(endpointName?: string): SageMakerModelConfig;
/**
* Get the default SageMaker endpoint name from environment variables
*
* @returns Default endpoint name
*/
export declare function getDefaultSageMakerEndpoint(): string;
/**
* Get SageMaker model name from environment variables
*
* @returns Model name
*/
export declare function getSageMakerModel(): string;
/**
* Validate AWS credentials are properly configured
*
* @param config - SageMaker configuration to validate
* @returns true if credentials are valid
* @throws {Error} When credentials are missing or invalid
*/
export declare function validateAWSCredentials(config: SageMakerConfig): boolean;
/**
* Create a comprehensive configuration summary for debugging
*
* @returns Configuration summary (sensitive data masked)
*/
export declare function getConfigurationSummary(): Record<string, unknown>;
/**
* Clear configuration cache (useful for testing or credential rotation)
*/
export declare function clearConfigurationCache(): void;
/**
* Load configuration from a JSON file (alternative to environment variables)
*
* @param filePath - Path to configuration JSON file
* @returns Loaded configuration
*/
export declare function loadConfigurationFromFile(filePath: string): Promise<SageMakerConfig>;
/**
* Check if SageMaker provider is properly configured
*
* @returns Configuration check result
*/
export declare function checkSageMakerConfiguration(): {
configured: boolean;
issues: string[];
summary: Record<string, unknown>;
};