@juspay/neurolink 7.47.3 → 7.48.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +8 -0
- package/README.md +68 -874
- package/dist/cli/loop/session.d.ts +13 -0
- package/dist/cli/loop/session.js +78 -17
- package/dist/lib/providers/sagemaker/adaptive-semaphore.d.ts +1 -13
- package/dist/lib/providers/sagemaker/client.d.ts +1 -1
- package/dist/lib/providers/sagemaker/config.d.ts +1 -1
- package/dist/lib/providers/sagemaker/detection.d.ts +1 -1
- package/dist/lib/providers/sagemaker/errors.d.ts +1 -1
- package/dist/lib/providers/sagemaker/index.d.ts +1 -1
- package/dist/lib/providers/sagemaker/language-model.d.ts +1 -1
- package/dist/lib/providers/sagemaker/parsers.d.ts +1 -1
- package/dist/lib/providers/sagemaker/streaming.d.ts +1 -1
- package/dist/lib/providers/sagemaker/structured-parser.d.ts +1 -1
- package/dist/lib/types/providers.d.ts +469 -0
- package/dist/providers/sagemaker/adaptive-semaphore.d.ts +1 -13
- package/dist/providers/sagemaker/client.d.ts +1 -1
- package/dist/providers/sagemaker/config.d.ts +1 -1
- package/dist/providers/sagemaker/detection.d.ts +1 -1
- package/dist/providers/sagemaker/errors.d.ts +1 -1
- package/dist/providers/sagemaker/index.d.ts +1 -1
- package/dist/providers/sagemaker/language-model.d.ts +3 -3
- package/dist/providers/sagemaker/parsers.d.ts +1 -1
- package/dist/providers/sagemaker/streaming.d.ts +1 -1
- package/dist/providers/sagemaker/structured-parser.d.ts +1 -1
- package/dist/types/providers.d.ts +469 -0
- package/package.json +1 -1
- package/dist/lib/providers/sagemaker/types.d.ts +0 -456
- package/dist/lib/providers/sagemaker/types.js +0 -7
- package/dist/providers/sagemaker/types.d.ts +0 -456
- package/dist/providers/sagemaker/types.js +0 -7
|
@@ -589,3 +589,472 @@ export declare const ModelAliases: {
|
|
|
589
589
|
* Default provider configurations
|
|
590
590
|
*/
|
|
591
591
|
export declare const DEFAULT_PROVIDER_CONFIGS: AIModelProviderConfig[];
|
|
592
|
+
/**
|
|
593
|
+
* Adaptive semaphore configuration for concurrency management
|
|
594
|
+
*/
|
|
595
|
+
export type AdaptiveSemaphoreConfig = {
|
|
596
|
+
initialConcurrency: number;
|
|
597
|
+
maxConcurrency: number;
|
|
598
|
+
minConcurrency: number;
|
|
599
|
+
};
|
|
600
|
+
/**
|
|
601
|
+
* Metrics for adaptive semaphore performance tracking
|
|
602
|
+
*/
|
|
603
|
+
export type AdaptiveSemaphoreMetrics = {
|
|
604
|
+
activeRequests: number;
|
|
605
|
+
currentConcurrency: number;
|
|
606
|
+
completedCount: number;
|
|
607
|
+
errorCount: number;
|
|
608
|
+
averageResponseTime: number;
|
|
609
|
+
waitingCount: number;
|
|
610
|
+
};
|
|
611
|
+
/**
|
|
612
|
+
* AWS configuration options for SageMaker client
|
|
613
|
+
*/
|
|
614
|
+
export type SageMakerConfig = {
|
|
615
|
+
/** AWS region for SageMaker service */
|
|
616
|
+
region: string;
|
|
617
|
+
/** AWS access key ID */
|
|
618
|
+
accessKeyId: string;
|
|
619
|
+
/** AWS secret access key */
|
|
620
|
+
secretAccessKey: string;
|
|
621
|
+
/** AWS session token (optional, for temporary credentials) */
|
|
622
|
+
sessionToken?: string;
|
|
623
|
+
/** Request timeout in milliseconds */
|
|
624
|
+
timeout?: number;
|
|
625
|
+
/** Maximum number of retry attempts */
|
|
626
|
+
maxRetries?: number;
|
|
627
|
+
/** Custom SageMaker endpoint URL (optional) */
|
|
628
|
+
endpoint?: string;
|
|
629
|
+
};
|
|
630
|
+
/**
|
|
631
|
+
* Model-specific configuration for SageMaker endpoints
|
|
632
|
+
*/
|
|
633
|
+
export type SageMakerModelConfig = {
|
|
634
|
+
/** SageMaker endpoint name */
|
|
635
|
+
endpointName: string;
|
|
636
|
+
/** Model type for request/response formatting */
|
|
637
|
+
modelType?: "llama" | "mistral" | "claude" | "huggingface" | "jumpstart" | "custom";
|
|
638
|
+
/** Content type for requests */
|
|
639
|
+
contentType?: string;
|
|
640
|
+
/** Accept header for responses */
|
|
641
|
+
accept?: string;
|
|
642
|
+
/** Custom attributes for the endpoint */
|
|
643
|
+
customAttributes?: string;
|
|
644
|
+
/** Input format specification */
|
|
645
|
+
inputFormat?: "huggingface" | "jumpstart" | "custom";
|
|
646
|
+
/** Output format specification */
|
|
647
|
+
outputFormat?: "huggingface" | "jumpstart" | "custom";
|
|
648
|
+
/** Maximum tokens for generation */
|
|
649
|
+
maxTokens?: number;
|
|
650
|
+
/** Temperature parameter */
|
|
651
|
+
temperature?: number;
|
|
652
|
+
/** Top-p parameter */
|
|
653
|
+
topP?: number;
|
|
654
|
+
/** Stop sequences */
|
|
655
|
+
stopSequences?: string[];
|
|
656
|
+
/** Initial concurrency for batch processing */
|
|
657
|
+
initialConcurrency?: number;
|
|
658
|
+
/** Maximum concurrency for batch processing */
|
|
659
|
+
maxConcurrency?: number;
|
|
660
|
+
/** Minimum concurrency for batch processing */
|
|
661
|
+
minConcurrency?: number;
|
|
662
|
+
/** Maximum concurrent detection tests */
|
|
663
|
+
maxConcurrentDetectionTests?: number;
|
|
664
|
+
};
|
|
665
|
+
/**
|
|
666
|
+
* SageMaker endpoint information and metadata
|
|
667
|
+
*/
|
|
668
|
+
export type SageMakerEndpointInfo = {
|
|
669
|
+
/** Endpoint name */
|
|
670
|
+
endpointName: string;
|
|
671
|
+
/** Endpoint ARN */
|
|
672
|
+
endpointArn: string;
|
|
673
|
+
/** Associated model name */
|
|
674
|
+
modelName: string;
|
|
675
|
+
/** EC2 instance type */
|
|
676
|
+
instanceType: string;
|
|
677
|
+
/** Endpoint creation timestamp */
|
|
678
|
+
creationTime: string;
|
|
679
|
+
/** Last modification timestamp */
|
|
680
|
+
lastModifiedTime: string;
|
|
681
|
+
/** Current endpoint status */
|
|
682
|
+
endpointStatus: "InService" | "Creating" | "Updating" | "SystemUpdating" | "RollingBack" | "Deleting" | "Failed";
|
|
683
|
+
/** Current instance count */
|
|
684
|
+
currentInstanceCount?: number;
|
|
685
|
+
/** Variant weights for A/B testing */
|
|
686
|
+
productionVariants?: Array<{
|
|
687
|
+
variantName: string;
|
|
688
|
+
modelName: string;
|
|
689
|
+
initialInstanceCount: number;
|
|
690
|
+
instanceType: string;
|
|
691
|
+
currentWeight?: number;
|
|
692
|
+
}>;
|
|
693
|
+
};
|
|
694
|
+
/**
|
|
695
|
+
* Token usage and billing information
|
|
696
|
+
*/
|
|
697
|
+
export type SageMakerUsage = {
|
|
698
|
+
/** Number of prompt tokens */
|
|
699
|
+
promptTokens: number;
|
|
700
|
+
/** Number of completion tokens */
|
|
701
|
+
completionTokens: number;
|
|
702
|
+
/** Total tokens used */
|
|
703
|
+
total: number;
|
|
704
|
+
/** Request processing time in milliseconds */
|
|
705
|
+
requestTime?: number;
|
|
706
|
+
/** Model inference time in milliseconds */
|
|
707
|
+
inferenceTime?: number;
|
|
708
|
+
/** Estimated cost in USD */
|
|
709
|
+
estimatedCost?: number;
|
|
710
|
+
};
|
|
711
|
+
/**
|
|
712
|
+
* Parameters for SageMaker endpoint invocation
|
|
713
|
+
*/
|
|
714
|
+
export type InvokeEndpointParams = {
|
|
715
|
+
/** Endpoint name to invoke */
|
|
716
|
+
EndpointName: string;
|
|
717
|
+
/** Request body as string or Uint8Array */
|
|
718
|
+
Body: string | Uint8Array;
|
|
719
|
+
/** Content type of the request */
|
|
720
|
+
ContentType?: string;
|
|
721
|
+
/** Accept header for response format */
|
|
722
|
+
Accept?: string;
|
|
723
|
+
/** Custom attributes for the request */
|
|
724
|
+
CustomAttributes?: string;
|
|
725
|
+
/** Target model for multi-model endpoints */
|
|
726
|
+
TargetModel?: string;
|
|
727
|
+
/** Target variant for A/B testing */
|
|
728
|
+
TargetVariant?: string;
|
|
729
|
+
/** Inference ID for request tracking */
|
|
730
|
+
InferenceId?: string;
|
|
731
|
+
};
|
|
732
|
+
/**
|
|
733
|
+
* Response from SageMaker endpoint invocation
|
|
734
|
+
*/
|
|
735
|
+
export type InvokeEndpointResponse = {
|
|
736
|
+
/** Response body */
|
|
737
|
+
Body?: Uint8Array;
|
|
738
|
+
/** Content type of the response */
|
|
739
|
+
ContentType?: string;
|
|
740
|
+
/** Invoked production variant */
|
|
741
|
+
InvokedProductionVariant?: string;
|
|
742
|
+
/** Custom attributes in the response */
|
|
743
|
+
CustomAttributes?: string;
|
|
744
|
+
};
|
|
745
|
+
/**
|
|
746
|
+
* Streaming response chunk from SageMaker
|
|
747
|
+
*/
|
|
748
|
+
export type SageMakerStreamChunk = {
|
|
749
|
+
/** Text content in the chunk */
|
|
750
|
+
content?: string;
|
|
751
|
+
/** Indicates if this is the final chunk */
|
|
752
|
+
done?: boolean;
|
|
753
|
+
/** Usage information (only in final chunk) */
|
|
754
|
+
usage?: SageMakerUsage;
|
|
755
|
+
/** Error information if chunk contains error */
|
|
756
|
+
error?: string;
|
|
757
|
+
/** Finish reason for generation */
|
|
758
|
+
finishReason?: "stop" | "length" | "tool-calls" | "content-filter" | "unknown";
|
|
759
|
+
/** Tool call in progress (Phase 2.3) */
|
|
760
|
+
toolCall?: SageMakerStreamingToolCall;
|
|
761
|
+
/** Tool result chunk (Phase 2.3) */
|
|
762
|
+
toolResult?: SageMakerStreamingToolResult;
|
|
763
|
+
/** Structured output streaming (Phase 2.3) */
|
|
764
|
+
structuredOutput?: SageMakerStructuredOutput;
|
|
765
|
+
};
|
|
766
|
+
/**
|
|
767
|
+
* Tool call information for function calling
|
|
768
|
+
*/
|
|
769
|
+
export type SageMakerToolCall = {
|
|
770
|
+
/** Tool call identifier */
|
|
771
|
+
id: string;
|
|
772
|
+
/** Tool/function name */
|
|
773
|
+
name: string;
|
|
774
|
+
/** Tool arguments as JSON object */
|
|
775
|
+
arguments: Record<string, unknown>;
|
|
776
|
+
/** Tool call type */
|
|
777
|
+
type: "function";
|
|
778
|
+
};
|
|
779
|
+
/**
|
|
780
|
+
* Tool result information
|
|
781
|
+
*/
|
|
782
|
+
export type SageMakerToolResult = {
|
|
783
|
+
/** Tool call identifier */
|
|
784
|
+
toolCallId: string;
|
|
785
|
+
/** Tool name */
|
|
786
|
+
toolName: string;
|
|
787
|
+
/** Tool result data */
|
|
788
|
+
result: unknown;
|
|
789
|
+
/** Execution status */
|
|
790
|
+
status: "success" | "error";
|
|
791
|
+
/** Error message if status is error */
|
|
792
|
+
error?: string;
|
|
793
|
+
};
|
|
794
|
+
/**
|
|
795
|
+
* Streaming tool call information (Phase 2.3)
|
|
796
|
+
*/
|
|
797
|
+
export type SageMakerStreamingToolCall = {
|
|
798
|
+
/** Tool call identifier */
|
|
799
|
+
id: string;
|
|
800
|
+
/** Tool/function name */
|
|
801
|
+
name?: string;
|
|
802
|
+
/** Partial or complete arguments as JSON string */
|
|
803
|
+
arguments?: string;
|
|
804
|
+
/** Tool call type */
|
|
805
|
+
type: "function";
|
|
806
|
+
/** Indicates if this tool call is complete */
|
|
807
|
+
complete?: boolean;
|
|
808
|
+
/** Delta text for incremental argument building */
|
|
809
|
+
argumentsDelta?: string;
|
|
810
|
+
};
|
|
811
|
+
/**
|
|
812
|
+
* Streaming tool result information (Phase 2.3)
|
|
813
|
+
*/
|
|
814
|
+
export type SageMakerStreamingToolResult = {
|
|
815
|
+
/** Tool call identifier */
|
|
816
|
+
toolCallId: string;
|
|
817
|
+
/** Tool name */
|
|
818
|
+
toolName: string;
|
|
819
|
+
/** Partial or complete result data */
|
|
820
|
+
result?: unknown;
|
|
821
|
+
/** Result delta for incremental responses */
|
|
822
|
+
resultDelta?: string;
|
|
823
|
+
/** Execution status */
|
|
824
|
+
status: "pending" | "running" | "success" | "error";
|
|
825
|
+
/** Error message if status is error */
|
|
826
|
+
error?: string;
|
|
827
|
+
/** Indicates if this result is complete */
|
|
828
|
+
complete?: boolean;
|
|
829
|
+
};
|
|
830
|
+
/**
|
|
831
|
+
* Structured output streaming information (Phase 2.3)
|
|
832
|
+
*/
|
|
833
|
+
export type SageMakerStructuredOutput = {
|
|
834
|
+
/** Partial JSON object being built */
|
|
835
|
+
partialObject?: Record<string, unknown>;
|
|
836
|
+
/** JSON delta text */
|
|
837
|
+
jsonDelta?: string;
|
|
838
|
+
/** Current parsing path (e.g., "user.name") */
|
|
839
|
+
currentPath?: string;
|
|
840
|
+
/** Schema validation errors */
|
|
841
|
+
validationErrors?: string[];
|
|
842
|
+
/** Indicates if JSON is complete and valid */
|
|
843
|
+
complete?: boolean;
|
|
844
|
+
/** JSON schema being validated against */
|
|
845
|
+
schema?: Record<string, unknown>;
|
|
846
|
+
};
|
|
847
|
+
/**
|
|
848
|
+
* Enhanced generation request options
|
|
849
|
+
*/
|
|
850
|
+
export type SageMakerGenerationOptions = {
|
|
851
|
+
/** Input prompt text */
|
|
852
|
+
prompt: string;
|
|
853
|
+
/** System prompt for context */
|
|
854
|
+
systemPrompt?: string;
|
|
855
|
+
/** Maximum tokens to generate */
|
|
856
|
+
maxTokens?: number;
|
|
857
|
+
/** Temperature for randomness (0-1) */
|
|
858
|
+
temperature?: number;
|
|
859
|
+
/** Top-p nucleus sampling (0-1) */
|
|
860
|
+
topP?: number;
|
|
861
|
+
/** Top-k sampling */
|
|
862
|
+
topK?: number;
|
|
863
|
+
/** Stop sequences to end generation */
|
|
864
|
+
stopSequences?: string[];
|
|
865
|
+
/** Enable streaming response */
|
|
866
|
+
stream?: boolean;
|
|
867
|
+
/** Tools available for function calling */
|
|
868
|
+
tools?: Array<{
|
|
869
|
+
name: string;
|
|
870
|
+
description: string;
|
|
871
|
+
parameters: Record<string, unknown>;
|
|
872
|
+
}>;
|
|
873
|
+
/** Tool choice mode */
|
|
874
|
+
toolChoice?: "auto" | "none" | {
|
|
875
|
+
type: "tool";
|
|
876
|
+
name: string;
|
|
877
|
+
};
|
|
878
|
+
};
|
|
879
|
+
/**
|
|
880
|
+
* Generation response from SageMaker
|
|
881
|
+
*/
|
|
882
|
+
export type SageMakerGenerationResponse = {
|
|
883
|
+
/** Generated text content */
|
|
884
|
+
text: string;
|
|
885
|
+
/** Token usage information */
|
|
886
|
+
usage: SageMakerUsage;
|
|
887
|
+
/** Finish reason for generation */
|
|
888
|
+
finishReason: "stop" | "length" | "tool-calls" | "content-filter" | "unknown";
|
|
889
|
+
/** Tool calls made during generation */
|
|
890
|
+
toolCalls?: SageMakerToolCall[];
|
|
891
|
+
/** Tool results if tools were executed */
|
|
892
|
+
toolResults?: SageMakerToolResult[];
|
|
893
|
+
/** Additional metadata */
|
|
894
|
+
metadata?: Record<string, unknown>;
|
|
895
|
+
/** Model version or identifier */
|
|
896
|
+
modelVersion?: string;
|
|
897
|
+
};
|
|
898
|
+
/**
|
|
899
|
+
* Error codes specific to SageMaker operations
|
|
900
|
+
*/
|
|
901
|
+
export type SageMakerErrorCode = "VALIDATION_ERROR" | "MODEL_ERROR" | "INTERNAL_ERROR" | "SERVICE_UNAVAILABLE" | "CREDENTIALS_ERROR" | "NETWORK_ERROR" | "ENDPOINT_NOT_FOUND" | "THROTTLING_ERROR" | "UNKNOWN_ERROR";
|
|
902
|
+
/**
|
|
903
|
+
* SageMaker-specific error information
|
|
904
|
+
*/
|
|
905
|
+
export type SageMakerErrorInfo = {
|
|
906
|
+
/** Error code */
|
|
907
|
+
code: SageMakerErrorCode;
|
|
908
|
+
/** Human-readable error message */
|
|
909
|
+
message: string;
|
|
910
|
+
/** HTTP status code if applicable */
|
|
911
|
+
statusCode?: number;
|
|
912
|
+
/** Original error from AWS SDK */
|
|
913
|
+
cause?: Error;
|
|
914
|
+
/** Endpoint name where error occurred */
|
|
915
|
+
endpoint?: string;
|
|
916
|
+
/** Request ID for debugging */
|
|
917
|
+
requestId?: string;
|
|
918
|
+
/** Retry suggestion */
|
|
919
|
+
retryable?: boolean;
|
|
920
|
+
};
|
|
921
|
+
/**
|
|
922
|
+
* Batch inference job configuration
|
|
923
|
+
*/
|
|
924
|
+
export type BatchInferenceConfig = {
|
|
925
|
+
/** Input S3 location */
|
|
926
|
+
inputS3Uri: string;
|
|
927
|
+
/** Output S3 location */
|
|
928
|
+
outputS3Uri: string;
|
|
929
|
+
/** SageMaker model name */
|
|
930
|
+
modelName: string;
|
|
931
|
+
/** Instance type for batch job */
|
|
932
|
+
instanceType: string;
|
|
933
|
+
/** Instance count for batch job */
|
|
934
|
+
instanceCount: number;
|
|
935
|
+
/** Maximum payload size in MB */
|
|
936
|
+
maxPayloadInMB?: number;
|
|
937
|
+
/** Batch strategy */
|
|
938
|
+
batchStrategy?: "MultiRecord" | "SingleRecord";
|
|
939
|
+
};
|
|
940
|
+
/**
|
|
941
|
+
* Model deployment configuration
|
|
942
|
+
*/
|
|
943
|
+
export type ModelDeploymentConfig = {
|
|
944
|
+
/** Model name */
|
|
945
|
+
modelName: string;
|
|
946
|
+
/** Endpoint name */
|
|
947
|
+
endpointName: string;
|
|
948
|
+
/** EC2 instance type */
|
|
949
|
+
instanceType: string;
|
|
950
|
+
/** Initial instance count */
|
|
951
|
+
initialInstanceCount: number;
|
|
952
|
+
/** Model data S3 location */
|
|
953
|
+
modelDataUrl: string;
|
|
954
|
+
/** Container image URI */
|
|
955
|
+
image: string;
|
|
956
|
+
/** IAM execution role ARN */
|
|
957
|
+
executionRoleArn: string;
|
|
958
|
+
/** Resource tags */
|
|
959
|
+
tags?: Record<string, string>;
|
|
960
|
+
/** Auto scaling configuration */
|
|
961
|
+
autoScaling?: {
|
|
962
|
+
minCapacity: number;
|
|
963
|
+
maxCapacity: number;
|
|
964
|
+
targetValue: number;
|
|
965
|
+
scaleUpCooldown: number;
|
|
966
|
+
scaleDownCooldown: number;
|
|
967
|
+
};
|
|
968
|
+
};
|
|
969
|
+
/**
|
|
970
|
+
* Endpoint metrics and monitoring data
|
|
971
|
+
*/
|
|
972
|
+
export type EndpointMetrics = {
|
|
973
|
+
/** Endpoint name */
|
|
974
|
+
endpointName: string;
|
|
975
|
+
/** Total invocations */
|
|
976
|
+
invocations: number;
|
|
977
|
+
/** Average latency in milliseconds */
|
|
978
|
+
averageLatency: number;
|
|
979
|
+
/** Error rate percentage */
|
|
980
|
+
errorRate: number;
|
|
981
|
+
/** CPU utilization percentage */
|
|
982
|
+
cpuUtilization?: number;
|
|
983
|
+
/** Memory utilization percentage */
|
|
984
|
+
memoryUtilization?: number;
|
|
985
|
+
/** Instance count */
|
|
986
|
+
instanceCount: number;
|
|
987
|
+
/** Timestamp of metrics */
|
|
988
|
+
timestamp: string;
|
|
989
|
+
};
|
|
990
|
+
/**
|
|
991
|
+
* Cost estimation data
|
|
992
|
+
*/
|
|
993
|
+
export type CostEstimate = {
|
|
994
|
+
/** Estimated cost in USD */
|
|
995
|
+
estimatedCost: number;
|
|
996
|
+
/** Currency code */
|
|
997
|
+
currency: string;
|
|
998
|
+
/** Cost breakdown */
|
|
999
|
+
breakdown: {
|
|
1000
|
+
/** Instance hours cost */
|
|
1001
|
+
instanceCost: number;
|
|
1002
|
+
/** Request-based cost */
|
|
1003
|
+
requestCost: number;
|
|
1004
|
+
/** Total processing hours */
|
|
1005
|
+
totalHours: number;
|
|
1006
|
+
};
|
|
1007
|
+
/** Time period for estimate */
|
|
1008
|
+
period?: {
|
|
1009
|
+
start: string;
|
|
1010
|
+
end: string;
|
|
1011
|
+
};
|
|
1012
|
+
};
|
|
1013
|
+
/**
|
|
1014
|
+
* SageMaker generation result type for better type safety
|
|
1015
|
+
*/
|
|
1016
|
+
export type SageMakerGenerateResult = {
|
|
1017
|
+
text?: string;
|
|
1018
|
+
reasoning?: string | Array<{
|
|
1019
|
+
type: "text";
|
|
1020
|
+
text: string;
|
|
1021
|
+
signature?: string;
|
|
1022
|
+
} | {
|
|
1023
|
+
type: "redacted";
|
|
1024
|
+
data: string;
|
|
1025
|
+
}>;
|
|
1026
|
+
files?: Array<{
|
|
1027
|
+
data: string | Uint8Array;
|
|
1028
|
+
mimeType: string;
|
|
1029
|
+
}>;
|
|
1030
|
+
logprobs?: Array<{
|
|
1031
|
+
token: string;
|
|
1032
|
+
logprob: number;
|
|
1033
|
+
topLogprobs: Array<{
|
|
1034
|
+
token: string;
|
|
1035
|
+
logprob: number;
|
|
1036
|
+
}>;
|
|
1037
|
+
}>;
|
|
1038
|
+
usage: {
|
|
1039
|
+
promptTokens: number;
|
|
1040
|
+
completionTokens: number;
|
|
1041
|
+
totalTokens?: number;
|
|
1042
|
+
};
|
|
1043
|
+
finishReason: "stop" | "length" | "content-filter" | "tool-calls" | "error" | "unknown";
|
|
1044
|
+
warnings?: Array<{
|
|
1045
|
+
type: "other";
|
|
1046
|
+
message: string;
|
|
1047
|
+
}>;
|
|
1048
|
+
rawCall: {
|
|
1049
|
+
rawPrompt: unknown;
|
|
1050
|
+
rawSettings: Record<string, unknown>;
|
|
1051
|
+
};
|
|
1052
|
+
rawResponse?: {
|
|
1053
|
+
headers?: Record<string, string>;
|
|
1054
|
+
};
|
|
1055
|
+
request?: {
|
|
1056
|
+
body?: string;
|
|
1057
|
+
};
|
|
1058
|
+
toolCalls?: SageMakerToolCall[];
|
|
1059
|
+
object?: unknown;
|
|
1060
|
+
};
|
|
@@ -4,19 +4,7 @@
|
|
|
4
4
|
* Provides a sophisticated semaphore implementation with dynamic concurrency adjustment
|
|
5
5
|
* for optimal resource utilization and performance tuning based on response times and error rates.
|
|
6
6
|
*/
|
|
7
|
-
|
|
8
|
-
initialConcurrency: number;
|
|
9
|
-
maxConcurrency: number;
|
|
10
|
-
minConcurrency: number;
|
|
11
|
-
}
|
|
12
|
-
export interface AdaptiveSemaphoreMetrics {
|
|
13
|
-
activeRequests: number;
|
|
14
|
-
currentConcurrency: number;
|
|
15
|
-
completedCount: number;
|
|
16
|
-
errorCount: number;
|
|
17
|
-
averageResponseTime: number;
|
|
18
|
-
waitingCount: number;
|
|
19
|
-
}
|
|
7
|
+
import type { AdaptiveSemaphoreConfig, AdaptiveSemaphoreMetrics } from "../../types/providers.js";
|
|
20
8
|
/**
|
|
21
9
|
* Adaptive semaphore that automatically adjusts concurrency based on performance metrics
|
|
22
10
|
*/
|
|
@@ -4,7 +4,7 @@
|
|
|
4
4
|
* This module provides a wrapper around the AWS SDK SageMaker Runtime client
|
|
5
5
|
* with enhanced error handling, retry logic, and NeuroLink-specific features.
|
|
6
6
|
*/
|
|
7
|
-
import type { SageMakerConfig, InvokeEndpointParams, InvokeEndpointResponse } from "
|
|
7
|
+
import type { SageMakerConfig, InvokeEndpointParams, InvokeEndpointResponse } from "../../types/providers.js";
|
|
8
8
|
import type { ConnectionResult } from "../../types/typeAliases.js";
|
|
9
9
|
/**
|
|
10
10
|
* Enhanced SageMaker Runtime client with retry logic and error handling
|
|
@@ -4,7 +4,7 @@
|
|
|
4
4
|
* This module handles loading, validation, and management of SageMaker
|
|
5
5
|
* configuration from environment variables, files, and defaults.
|
|
6
6
|
*/
|
|
7
|
-
import type { SageMakerConfig, SageMakerModelConfig } from "
|
|
7
|
+
import type { SageMakerConfig, SageMakerModelConfig } from "../../types/providers.js";
|
|
8
8
|
/**
|
|
9
9
|
* Load and validate SageMaker configuration from environment variables
|
|
10
10
|
*
|
|
@@ -4,7 +4,7 @@
|
|
|
4
4
|
* This module provides intelligent detection of SageMaker endpoint capabilities
|
|
5
5
|
* including model type identification and streaming protocol support.
|
|
6
6
|
*/
|
|
7
|
-
import type { SageMakerConfig, SageMakerModelConfig } from "
|
|
7
|
+
import type { SageMakerConfig, SageMakerModelConfig } from "../../types/providers.js";
|
|
8
8
|
/**
|
|
9
9
|
* Streaming capability information for an endpoint
|
|
10
10
|
*/
|
|
@@ -4,7 +4,7 @@
|
|
|
4
4
|
* This module provides comprehensive error handling, categorization,
|
|
5
5
|
* and user-friendly error messages for SageMaker operations.
|
|
6
6
|
*/
|
|
7
|
-
import type { SageMakerErrorCode, SageMakerErrorInfo } from "
|
|
7
|
+
import type { SageMakerErrorCode, SageMakerErrorInfo } from "../../types/providers.js";
|
|
8
8
|
/**
|
|
9
9
|
* Custom error class for SageMaker-specific errors
|
|
10
10
|
*/
|
|
@@ -9,7 +9,7 @@ export { AmazonSageMakerProvider } from "../amazonSagemaker.js";
|
|
|
9
9
|
export { SageMakerRuntimeClient, createSageMakerRuntimeClient, testSageMakerConnectivity, } from "./client.js";
|
|
10
10
|
export { getSageMakerConfig, getSageMakerModelConfig, getDefaultSageMakerEndpoint, getSageMakerModel, validateAWSCredentials, getConfigurationSummary, clearConfigurationCache, loadConfigurationFromFile, checkSageMakerConfiguration, } from "./config.js";
|
|
11
11
|
export { SageMakerError, handleSageMakerError, createValidationError, createCredentialsError, createNetworkError, isRetryableError, getRetryDelay, } from "./errors.js";
|
|
12
|
-
export type { SageMakerConfig, SageMakerModelConfig, SageMakerEndpointInfo, SageMakerUsage, InvokeEndpointParams, InvokeEndpointResponse, SageMakerStreamChunk, SageMakerToolCall, SageMakerToolResult, SageMakerGenerationOptions, SageMakerGenerationResponse, SageMakerErrorCode, SageMakerErrorInfo, BatchInferenceConfig, ModelDeploymentConfig, EndpointMetrics, CostEstimate, } from "
|
|
12
|
+
export type { SageMakerConfig, SageMakerModelConfig, SageMakerEndpointInfo, SageMakerUsage, InvokeEndpointParams, InvokeEndpointResponse, SageMakerStreamChunk, SageMakerToolCall, SageMakerToolResult, SageMakerGenerationOptions, SageMakerGenerationResponse, SageMakerErrorCode, SageMakerErrorInfo, BatchInferenceConfig, ModelDeploymentConfig, EndpointMetrics, CostEstimate, } from "../../types/providers.js";
|
|
13
13
|
/**
|
|
14
14
|
* Factory function to create a SageMaker Provider
|
|
15
15
|
*
|
|
@@ -5,7 +5,7 @@
|
|
|
5
5
|
* integration with the Vercel AI SDK.
|
|
6
6
|
*/
|
|
7
7
|
import type { LanguageModelV1, LanguageModelV1CallOptions, LanguageModelV1StreamPart } from "ai";
|
|
8
|
-
import type { SageMakerConfig, SageMakerModelConfig } from "
|
|
8
|
+
import type { SageMakerConfig, SageMakerModelConfig } from "../../types/providers.js";
|
|
9
9
|
import type { ConnectivityResult } from "../../types/typeAliases.js";
|
|
10
10
|
/**
|
|
11
11
|
* SageMaker Language Model implementing LanguageModelV1 interface
|
|
@@ -131,7 +131,7 @@ export declare class SageMakerLanguageModel implements LanguageModelV1 {
|
|
|
131
131
|
provider: string;
|
|
132
132
|
specificationVersion: string;
|
|
133
133
|
endpointName: string;
|
|
134
|
-
modelType: "custom" | "huggingface" | "mistral" | "
|
|
134
|
+
modelType: "custom" | "huggingface" | "mistral" | "llama" | "claude" | "jumpstart" | undefined;
|
|
135
135
|
region: string;
|
|
136
136
|
};
|
|
137
137
|
/**
|
|
@@ -178,7 +178,7 @@ export declare class SageMakerLanguageModel implements LanguageModelV1 {
|
|
|
178
178
|
provider: string;
|
|
179
179
|
specificationVersion: string;
|
|
180
180
|
endpointName: string;
|
|
181
|
-
modelType: "custom" | "huggingface" | "mistral" | "
|
|
181
|
+
modelType: "custom" | "huggingface" | "mistral" | "llama" | "claude" | "jumpstart" | undefined;
|
|
182
182
|
region: string;
|
|
183
183
|
};
|
|
184
184
|
}
|
|
@@ -4,7 +4,7 @@
|
|
|
4
4
|
* This module provides protocol-specific parsers for different streaming
|
|
5
5
|
* formats used by SageMaker endpoints (HuggingFace, LLaMA, custom models).
|
|
6
6
|
*/
|
|
7
|
-
import type { SageMakerStreamChunk, SageMakerUsage, SageMakerStructuredOutput } from "
|
|
7
|
+
import type { SageMakerStreamChunk, SageMakerUsage, SageMakerStructuredOutput } from "../../types/providers.js";
|
|
8
8
|
import { type StructuredOutputParser } from "./structured-parser.js";
|
|
9
9
|
/**
|
|
10
10
|
* Shared bracket counting state and utilities
|
|
@@ -5,7 +5,7 @@
|
|
|
5
5
|
* and model-specific parsing for various SageMaker deployment patterns.
|
|
6
6
|
*/
|
|
7
7
|
import { ReadableStream } from "stream/web";
|
|
8
|
-
import type { SageMakerStreamChunk, SageMakerUsage, SageMakerConfig } from "
|
|
8
|
+
import type { SageMakerStreamChunk, SageMakerUsage, SageMakerConfig } from "../../types/providers.js";
|
|
9
9
|
/**
|
|
10
10
|
* Create a SageMaker streaming response with automatic protocol detection
|
|
11
11
|
*
|
|
@@ -4,7 +4,7 @@
|
|
|
4
4
|
* This module provides partial JSON parsing for streaming structured output
|
|
5
5
|
* responses from SageMaker endpoints with real-time validation.
|
|
6
6
|
*/
|
|
7
|
-
import type { SageMakerStructuredOutput } from "
|
|
7
|
+
import type { SageMakerStructuredOutput } from "../../types/providers.js";
|
|
8
8
|
/**
|
|
9
9
|
* Partial JSON parser for streaming structured output
|
|
10
10
|
*/
|