@juspay/neurolink 7.29.1 → 7.29.3
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 +12 -0
- package/dist/cli/commands/config.d.ts +86 -86
- package/dist/cli/commands/mcp.js +64 -9
- package/dist/cli/commands/models.js +25 -21
- package/dist/cli/commands/ollama.js +2 -2
- package/dist/cli/factories/commandFactory.d.ts +9 -0
- package/dist/cli/factories/commandFactory.js +177 -83
- package/dist/cli/factories/ollamaCommandFactory.js +3 -1
- package/dist/cli/factories/sagemakerCommandFactory.js +3 -2
- package/dist/cli/index.d.ts +1 -1
- package/dist/cli/index.js +19 -11
- package/dist/cli/utils/envManager.js +5 -5
- package/dist/cli/utils/ollamaUtils.d.ts +12 -0
- package/dist/cli/utils/ollamaUtils.js +58 -42
- package/dist/config/configManager.js +5 -2
- package/dist/core/analytics.d.ts +2 -24
- package/dist/core/analytics.js +12 -17
- package/dist/core/baseProvider.d.ts +30 -1
- package/dist/core/baseProvider.js +180 -198
- package/dist/core/dynamicModels.d.ts +4 -4
- package/dist/core/dynamicModels.js +7 -7
- package/dist/core/evaluation.d.ts +9 -9
- package/dist/core/evaluation.js +117 -65
- package/dist/core/evaluationProviders.d.ts +18 -2
- package/dist/core/evaluationProviders.js +15 -13
- package/dist/core/factory.js +77 -4
- package/dist/core/modelConfiguration.d.ts +63 -0
- package/dist/core/modelConfiguration.js +354 -290
- package/dist/core/streamAnalytics.d.ts +10 -5
- package/dist/core/streamAnalytics.js +10 -10
- package/dist/core/types.d.ts +19 -109
- package/dist/core/types.js +13 -0
- package/dist/factories/providerFactory.js +4 -1
- package/dist/factories/providerRegistry.js +2 -2
- package/dist/index.d.ts +2 -1
- package/dist/lib/config/configManager.js +5 -2
- package/dist/lib/core/analytics.d.ts +2 -24
- package/dist/lib/core/analytics.js +12 -17
- package/dist/lib/core/baseProvider.d.ts +30 -1
- package/dist/lib/core/baseProvider.js +180 -198
- package/dist/lib/core/dynamicModels.js +7 -7
- package/dist/lib/core/evaluation.d.ts +9 -9
- package/dist/lib/core/evaluation.js +117 -65
- package/dist/lib/core/evaluationProviders.d.ts +18 -2
- package/dist/lib/core/evaluationProviders.js +15 -13
- package/dist/lib/core/factory.js +77 -4
- package/dist/lib/core/modelConfiguration.d.ts +63 -0
- package/dist/lib/core/modelConfiguration.js +354 -290
- package/dist/lib/core/streamAnalytics.d.ts +10 -5
- package/dist/lib/core/streamAnalytics.js +10 -10
- package/dist/lib/core/types.d.ts +19 -109
- package/dist/lib/core/types.js +13 -0
- package/dist/lib/factories/providerFactory.js +4 -1
- package/dist/lib/factories/providerRegistry.js +2 -2
- package/dist/lib/index.d.ts +2 -1
- package/dist/lib/mcp/externalServerManager.js +14 -6
- package/dist/lib/mcp/factory.js +1 -1
- package/dist/lib/mcp/flexibleToolValidator.d.ts +50 -0
- package/dist/lib/mcp/flexibleToolValidator.js +161 -0
- package/dist/lib/mcp/index.d.ts +1 -1
- package/dist/lib/mcp/index.js +1 -1
- package/dist/lib/mcp/mcpCircuitBreaker.js +5 -1
- package/dist/lib/mcp/mcpClientFactory.js +3 -0
- package/dist/lib/mcp/registry.d.ts +3 -3
- package/dist/lib/mcp/registry.js +3 -3
- package/dist/lib/mcp/servers/aiProviders/aiAnalysisTools.js +5 -5
- package/dist/lib/mcp/servers/aiProviders/aiWorkflowTools.js +6 -6
- package/dist/lib/mcp/servers/utilities/utilityServer.js +1 -1
- package/dist/lib/mcp/toolDiscoveryService.js +8 -2
- package/dist/lib/mcp/toolRegistry.d.ts +2 -2
- package/dist/lib/mcp/toolRegistry.js +29 -54
- package/dist/lib/middleware/builtin/analytics.js +4 -4
- package/dist/lib/middleware/builtin/guardrails.js +2 -2
- package/dist/lib/middleware/registry.js +11 -2
- package/dist/lib/models/modelRegistry.d.ts +1 -1
- package/dist/lib/models/modelRegistry.js +3 -3
- package/dist/lib/models/modelResolver.d.ts +1 -1
- package/dist/lib/models/modelResolver.js +2 -2
- package/dist/lib/neurolink.d.ts +118 -0
- package/dist/lib/neurolink.js +814 -952
- package/dist/lib/providers/amazonBedrock.d.ts +47 -6
- package/dist/lib/providers/amazonBedrock.js +282 -23
- package/dist/lib/providers/amazonSagemaker.d.ts +1 -1
- package/dist/lib/providers/amazonSagemaker.js +12 -3
- package/dist/lib/providers/anthropic.d.ts +1 -1
- package/dist/lib/providers/anthropic.js +7 -6
- package/dist/lib/providers/anthropicBaseProvider.d.ts +1 -1
- package/dist/lib/providers/anthropicBaseProvider.js +4 -3
- package/dist/lib/providers/aws/credentialProvider.d.ts +58 -0
- package/dist/lib/providers/aws/credentialProvider.js +267 -0
- package/dist/lib/providers/aws/credentialTester.d.ts +49 -0
- package/dist/lib/providers/aws/credentialTester.js +394 -0
- package/dist/lib/providers/azureOpenai.d.ts +1 -1
- package/dist/lib/providers/azureOpenai.js +1 -1
- package/dist/lib/providers/googleAiStudio.d.ts +1 -1
- package/dist/lib/providers/googleAiStudio.js +2 -2
- package/dist/lib/providers/googleVertex.d.ts +40 -0
- package/dist/lib/providers/googleVertex.js +330 -274
- package/dist/lib/providers/huggingFace.js +1 -1
- package/dist/lib/providers/mistral.d.ts +1 -1
- package/dist/lib/providers/mistral.js +2 -2
- package/dist/lib/providers/ollama.d.ts +4 -0
- package/dist/lib/providers/ollama.js +38 -18
- package/dist/lib/providers/openAI.d.ts +1 -1
- package/dist/lib/providers/openAI.js +2 -2
- package/dist/lib/providers/sagemaker/adaptive-semaphore.js +7 -4
- package/dist/lib/providers/sagemaker/client.js +13 -3
- package/dist/lib/providers/sagemaker/config.js +5 -1
- package/dist/lib/providers/sagemaker/detection.js +19 -9
- package/dist/lib/providers/sagemaker/errors.d.ts +8 -1
- package/dist/lib/providers/sagemaker/errors.js +103 -20
- package/dist/lib/providers/sagemaker/language-model.d.ts +3 -3
- package/dist/lib/providers/sagemaker/language-model.js +4 -4
- package/dist/lib/providers/sagemaker/parsers.js +14 -6
- package/dist/lib/providers/sagemaker/streaming.js +14 -3
- package/dist/lib/providers/sagemaker/types.d.ts +1 -1
- package/dist/lib/proxy/awsProxyIntegration.d.ts +23 -0
- package/dist/lib/proxy/awsProxyIntegration.js +285 -0
- package/dist/lib/proxy/proxyFetch.d.ts +9 -5
- package/dist/lib/proxy/proxyFetch.js +232 -98
- package/dist/lib/proxy/utils/noProxyUtils.d.ts +39 -0
- package/dist/lib/proxy/utils/noProxyUtils.js +149 -0
- package/dist/lib/sdk/toolRegistration.d.ts +1 -1
- package/dist/lib/types/cli.d.ts +80 -8
- package/dist/lib/types/contextTypes.js +2 -2
- package/dist/lib/types/generateTypes.d.ts +4 -6
- package/dist/lib/types/providers.d.ts +124 -19
- package/dist/lib/types/providers.js +6 -6
- package/dist/lib/types/streamTypes.d.ts +4 -6
- package/dist/lib/types/typeAliases.d.ts +1 -1
- package/dist/lib/utils/analyticsUtils.d.ts +33 -0
- package/dist/lib/utils/analyticsUtils.js +76 -0
- package/dist/lib/utils/errorHandling.js +4 -1
- package/dist/lib/utils/evaluationUtils.d.ts +27 -0
- package/dist/lib/utils/evaluationUtils.js +131 -0
- package/dist/lib/utils/optionsUtils.js +10 -1
- package/dist/lib/utils/performance.d.ts +1 -1
- package/dist/lib/utils/performance.js +15 -3
- package/dist/lib/utils/providerConfig.d.ts +1 -0
- package/dist/lib/utils/providerConfig.js +2 -1
- package/dist/lib/utils/providerHealth.d.ts +48 -0
- package/dist/lib/utils/providerHealth.js +221 -158
- package/dist/lib/utils/providerUtils.js +2 -2
- package/dist/lib/utils/timeout.js +8 -3
- package/dist/mcp/externalServerManager.js +14 -6
- package/dist/mcp/factory.js +1 -1
- package/dist/mcp/flexibleToolValidator.d.ts +50 -0
- package/dist/mcp/flexibleToolValidator.js +161 -0
- package/dist/mcp/index.d.ts +1 -1
- package/dist/mcp/index.js +1 -1
- package/dist/mcp/mcpCircuitBreaker.js +5 -1
- package/dist/mcp/mcpClientFactory.js +3 -0
- package/dist/mcp/registry.d.ts +3 -3
- package/dist/mcp/registry.js +3 -3
- package/dist/mcp/servers/aiProviders/aiAnalysisTools.js +5 -5
- package/dist/mcp/servers/aiProviders/aiWorkflowTools.js +6 -6
- package/dist/mcp/servers/utilities/utilityServer.js +1 -1
- package/dist/mcp/toolDiscoveryService.js +8 -2
- package/dist/mcp/toolRegistry.d.ts +2 -2
- package/dist/mcp/toolRegistry.js +29 -54
- package/dist/middleware/builtin/analytics.js +4 -4
- package/dist/middleware/builtin/guardrails.js +2 -2
- package/dist/middleware/registry.js +11 -2
- package/dist/models/modelRegistry.d.ts +1 -1
- package/dist/models/modelRegistry.js +3 -3
- package/dist/models/modelResolver.d.ts +1 -1
- package/dist/models/modelResolver.js +2 -2
- package/dist/neurolink.d.ts +118 -0
- package/dist/neurolink.js +814 -952
- package/dist/providers/amazonBedrock.d.ts +47 -6
- package/dist/providers/amazonBedrock.js +282 -23
- package/dist/providers/amazonSagemaker.d.ts +1 -1
- package/dist/providers/amazonSagemaker.js +12 -3
- package/dist/providers/anthropic.d.ts +1 -1
- package/dist/providers/anthropic.js +7 -6
- package/dist/providers/anthropicBaseProvider.d.ts +1 -1
- package/dist/providers/anthropicBaseProvider.js +4 -3
- package/dist/providers/aws/credentialProvider.d.ts +58 -0
- package/dist/providers/aws/credentialProvider.js +267 -0
- package/dist/providers/aws/credentialTester.d.ts +49 -0
- package/dist/providers/aws/credentialTester.js +394 -0
- package/dist/providers/azureOpenai.d.ts +1 -1
- package/dist/providers/azureOpenai.js +1 -1
- package/dist/providers/googleAiStudio.d.ts +1 -1
- package/dist/providers/googleAiStudio.js +2 -2
- package/dist/providers/googleVertex.d.ts +40 -0
- package/dist/providers/googleVertex.js +330 -274
- package/dist/providers/huggingFace.js +1 -1
- package/dist/providers/mistral.d.ts +1 -1
- package/dist/providers/mistral.js +2 -2
- package/dist/providers/ollama.d.ts +4 -0
- package/dist/providers/ollama.js +38 -18
- package/dist/providers/openAI.d.ts +1 -1
- package/dist/providers/openAI.js +2 -2
- package/dist/providers/sagemaker/adaptive-semaphore.js +7 -4
- package/dist/providers/sagemaker/client.js +13 -3
- package/dist/providers/sagemaker/config.js +5 -1
- package/dist/providers/sagemaker/detection.js +19 -9
- package/dist/providers/sagemaker/errors.d.ts +8 -1
- package/dist/providers/sagemaker/errors.js +103 -20
- package/dist/providers/sagemaker/language-model.d.ts +3 -3
- package/dist/providers/sagemaker/language-model.js +4 -4
- package/dist/providers/sagemaker/parsers.js +14 -6
- package/dist/providers/sagemaker/streaming.js +14 -3
- package/dist/providers/sagemaker/types.d.ts +1 -1
- package/dist/proxy/awsProxyIntegration.d.ts +23 -0
- package/dist/proxy/awsProxyIntegration.js +285 -0
- package/dist/proxy/proxyFetch.d.ts +9 -5
- package/dist/proxy/proxyFetch.js +232 -98
- package/dist/proxy/utils/noProxyUtils.d.ts +39 -0
- package/dist/proxy/utils/noProxyUtils.js +149 -0
- package/dist/sdk/toolRegistration.d.ts +1 -1
- package/dist/types/cli.d.ts +80 -8
- package/dist/types/contextTypes.js +2 -2
- package/dist/types/generateTypes.d.ts +4 -6
- package/dist/types/providers.d.ts +124 -19
- package/dist/types/providers.js +6 -6
- package/dist/types/streamTypes.d.ts +4 -6
- package/dist/types/typeAliases.d.ts +1 -1
- package/dist/utils/analyticsUtils.d.ts +33 -0
- package/dist/utils/analyticsUtils.js +76 -0
- package/dist/utils/errorHandling.js +4 -1
- package/dist/utils/evaluationUtils.d.ts +27 -0
- package/dist/utils/evaluationUtils.js +131 -0
- package/dist/utils/optionsUtils.js +10 -1
- package/dist/utils/performance.d.ts +1 -1
- package/dist/utils/performance.js +15 -3
- package/dist/utils/providerConfig.d.ts +1 -0
- package/dist/utils/providerConfig.js +2 -1
- package/dist/utils/providerHealth.d.ts +48 -0
- package/dist/utils/providerHealth.js +221 -158
- package/dist/utils/providerUtils.js +2 -2
- package/dist/utils/timeout.js +8 -3
- package/package.json +5 -1
package/dist/lib/types/cli.d.ts
CHANGED
|
@@ -2,7 +2,8 @@
|
|
|
2
2
|
* CLI-specific type definitions for NeuroLink
|
|
3
3
|
*/
|
|
4
4
|
import type { UnknownRecord, JsonValue } from "./common.js";
|
|
5
|
-
import type { AnalyticsData,
|
|
5
|
+
import type { AnalyticsData, TokenUsage } from "./providers.js";
|
|
6
|
+
import type { EvaluationData } from "../index.js";
|
|
6
7
|
import type { ToolCall, ToolResult } from "./tools.js";
|
|
7
8
|
/**
|
|
8
9
|
* Base command arguments interface
|
|
@@ -16,6 +17,8 @@ export interface BaseCommandArgs {
|
|
|
16
17
|
verbose?: boolean;
|
|
17
18
|
/** Quiet mode */
|
|
18
19
|
quiet?: boolean;
|
|
20
|
+
/** Index signature to allow additional properties */
|
|
21
|
+
[key: string]: unknown;
|
|
19
22
|
}
|
|
20
23
|
/**
|
|
21
24
|
* Generate command arguments
|
|
@@ -65,6 +68,29 @@ export interface StreamCommandArgs extends BaseCommandArgs {
|
|
|
65
68
|
/** Disable tools */
|
|
66
69
|
disableTools?: boolean;
|
|
67
70
|
}
|
|
71
|
+
/**
|
|
72
|
+
* Batch command arguments
|
|
73
|
+
*/
|
|
74
|
+
export interface BatchCommandArgs extends BaseCommandArgs {
|
|
75
|
+
/** Input file path */
|
|
76
|
+
file?: string;
|
|
77
|
+
/** AI provider to use */
|
|
78
|
+
provider?: string;
|
|
79
|
+
/** Model name */
|
|
80
|
+
model?: string;
|
|
81
|
+
/** System prompt */
|
|
82
|
+
system?: string;
|
|
83
|
+
/** Temperature setting */
|
|
84
|
+
temperature?: number;
|
|
85
|
+
/** Maximum tokens */
|
|
86
|
+
maxTokens?: number;
|
|
87
|
+
/** Delay between requests (ms) */
|
|
88
|
+
delay?: number;
|
|
89
|
+
/** Output file */
|
|
90
|
+
output?: string;
|
|
91
|
+
/** Disable tools */
|
|
92
|
+
disableTools?: boolean;
|
|
93
|
+
}
|
|
68
94
|
/**
|
|
69
95
|
* MCP command arguments - Enhanced with transport and server management
|
|
70
96
|
*/
|
|
@@ -113,17 +139,65 @@ export interface MCPCommandArgs extends BaseCommandArgs {
|
|
|
113
139
|
/**
|
|
114
140
|
* Models command arguments - Enhanced for model management
|
|
115
141
|
*/
|
|
116
|
-
export interface ModelsCommandArgs extends BaseCommandArgs {
|
|
117
|
-
/** AI provider to query */
|
|
118
|
-
provider?: string;
|
|
119
|
-
/** Model
|
|
142
|
+
export interface ModelsCommandArgs extends Omit<BaseCommandArgs, "format"> {
|
|
143
|
+
/** AI provider to query (single or array) */
|
|
144
|
+
provider?: string | string[];
|
|
145
|
+
/** Model category filter */
|
|
146
|
+
category?: string;
|
|
147
|
+
/** Model capability filter (array) */
|
|
148
|
+
capability?: string[];
|
|
149
|
+
/** Include deprecated models */
|
|
150
|
+
deprecated?: boolean;
|
|
151
|
+
/** Search query (capability, use case, or model name) */
|
|
120
152
|
query?: string;
|
|
121
153
|
/** Model use case filter */
|
|
122
154
|
useCase?: string;
|
|
123
|
-
/**
|
|
155
|
+
/** Maximum cost per 1K tokens (USD) */
|
|
156
|
+
maxCost?: number;
|
|
157
|
+
/** Minimum context window size (tokens) */
|
|
158
|
+
minContext?: number;
|
|
159
|
+
/** Maximum context window size (tokens) */
|
|
160
|
+
maxContext?: number;
|
|
161
|
+
/** Required performance level */
|
|
162
|
+
performance?: "fast" | "medium" | "slow" | "high" | "low";
|
|
163
|
+
/** Optimize for code generation and programming */
|
|
164
|
+
coding?: boolean;
|
|
165
|
+
/** Optimize for creative writing and content */
|
|
166
|
+
creative?: boolean;
|
|
167
|
+
/** Optimize for data analysis and research */
|
|
168
|
+
analysis?: boolean;
|
|
169
|
+
/** Optimize for conversational interactions */
|
|
170
|
+
conversation?: boolean;
|
|
171
|
+
/** Optimize for logical reasoning tasks */
|
|
172
|
+
reasoning?: boolean;
|
|
173
|
+
/** Optimize for language translation */
|
|
174
|
+
translation?: boolean;
|
|
175
|
+
/** Optimize for text summarization */
|
|
176
|
+
summarization?: boolean;
|
|
177
|
+
/** Prioritize cost-effectiveness */
|
|
178
|
+
costEffective?: boolean;
|
|
179
|
+
/** Prioritize output quality over cost */
|
|
180
|
+
highQuality?: boolean;
|
|
181
|
+
/** Prioritize response speed */
|
|
182
|
+
fast?: boolean;
|
|
183
|
+
/** Require vision/image processing capability */
|
|
124
184
|
requireVision?: boolean;
|
|
125
185
|
/** Require function calling capability */
|
|
126
186
|
requireFunctionCalling?: boolean;
|
|
187
|
+
/** Exclude specific providers */
|
|
188
|
+
excludeProviders?: string[];
|
|
189
|
+
/** Prefer local/offline models */
|
|
190
|
+
preferLocal?: boolean;
|
|
191
|
+
/** Model name, alias, or partial match to resolve */
|
|
192
|
+
model?: string;
|
|
193
|
+
/** Enable fuzzy matching for partial names */
|
|
194
|
+
fuzzy?: boolean;
|
|
195
|
+
/** Model IDs or aliases to compare */
|
|
196
|
+
models?: string[];
|
|
197
|
+
/** Show detailed statistics breakdown */
|
|
198
|
+
detailed?: boolean;
|
|
199
|
+
/** Output format for models command */
|
|
200
|
+
format?: "table" | "json" | "compact";
|
|
127
201
|
/** List all available models */
|
|
128
202
|
list?: boolean;
|
|
129
203
|
/** Show model statistics */
|
|
@@ -132,8 +206,6 @@ export interface ModelsCommandArgs extends BaseCommandArgs {
|
|
|
132
206
|
pricing?: boolean;
|
|
133
207
|
/** Resolve best model for criteria */
|
|
134
208
|
resolve?: boolean;
|
|
135
|
-
/** Maximum cost filter */
|
|
136
|
-
maxCost?: number;
|
|
137
209
|
/** Maximum tokens filter */
|
|
138
210
|
maxTokens?: number;
|
|
139
211
|
}
|
|
@@ -284,7 +284,7 @@ export class ContextFactory {
|
|
|
284
284
|
/**
|
|
285
285
|
* Type guard to check if value is valid context
|
|
286
286
|
*/
|
|
287
|
-
function
|
|
287
|
+
function _isValidContext(value) {
|
|
288
288
|
return ContextFactory.validateContext(value) !== null;
|
|
289
289
|
}
|
|
290
290
|
export class ContextConverter {
|
|
@@ -293,7 +293,7 @@ export class ContextConverter {
|
|
|
293
293
|
* Based on business context patterns
|
|
294
294
|
*/
|
|
295
295
|
static convertBusinessContext(legacyContext, domainType, options = {}) {
|
|
296
|
-
const { preserveLegacyFields = false, validateDomainData = true, includeMetadata = true, } = options;
|
|
296
|
+
const { preserveLegacyFields = false, validateDomainData: _validateDomainData = true, includeMetadata = true, } = options;
|
|
297
297
|
return {
|
|
298
298
|
sessionId: legacyContext.sessionId,
|
|
299
299
|
userId: legacyContext.userId,
|
|
@@ -1,6 +1,8 @@
|
|
|
1
1
|
import type { Tool } from "ai";
|
|
2
2
|
import type { ValidationSchema, StandardRecord } from "./typeAliases.js";
|
|
3
|
-
import type { AIProviderName, AnalyticsData
|
|
3
|
+
import type { AIProviderName, AnalyticsData } from "../core/types.js";
|
|
4
|
+
import type { EvaluationData } from "../index.js";
|
|
5
|
+
import type { TokenUsage } from "./providers.js";
|
|
4
6
|
/**
|
|
5
7
|
* Generate function options interface - Primary method for content generation
|
|
6
8
|
* Future-ready for multi-modal capabilities while maintaining text focus
|
|
@@ -56,11 +58,7 @@ export interface GenerateResult {
|
|
|
56
58
|
};
|
|
57
59
|
provider?: string;
|
|
58
60
|
model?: string;
|
|
59
|
-
usage?:
|
|
60
|
-
inputTokens: number;
|
|
61
|
-
outputTokens: number;
|
|
62
|
-
totalTokens: number;
|
|
63
|
-
};
|
|
61
|
+
usage?: TokenUsage;
|
|
64
62
|
responseTime?: number;
|
|
65
63
|
toolCalls?: Array<{
|
|
66
64
|
toolCallId: string;
|
|
@@ -21,25 +21,64 @@ export interface ProviderError extends Error {
|
|
|
21
21
|
* Token usage information
|
|
22
22
|
*/
|
|
23
23
|
export interface TokenUsage {
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
24
|
+
input: number;
|
|
25
|
+
output: number;
|
|
26
|
+
total: number;
|
|
27
27
|
}
|
|
28
28
|
/**
|
|
29
29
|
* Analytics data structure
|
|
30
30
|
*/
|
|
31
31
|
export interface AnalyticsData {
|
|
32
32
|
provider: string;
|
|
33
|
-
model
|
|
33
|
+
model?: string;
|
|
34
|
+
tokenUsage: TokenUsage;
|
|
34
35
|
requestDuration: number;
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
outputTokens: number;
|
|
38
|
-
totalTokens: number;
|
|
39
|
-
};
|
|
40
|
-
timestamp: number;
|
|
36
|
+
timestamp: string;
|
|
37
|
+
cost?: number;
|
|
41
38
|
context?: JsonValue;
|
|
42
|
-
|
|
39
|
+
}
|
|
40
|
+
/**
|
|
41
|
+
* AWS Credential Configuration for Bedrock provider
|
|
42
|
+
*/
|
|
43
|
+
export interface AWSCredentialConfig {
|
|
44
|
+
region?: string;
|
|
45
|
+
profile?: string;
|
|
46
|
+
roleArn?: string;
|
|
47
|
+
roleSessionName?: string;
|
|
48
|
+
timeout?: number;
|
|
49
|
+
/** @deprecated Prefer maxAttempts to match AWS SDK v3 config */
|
|
50
|
+
maxRetries?: number;
|
|
51
|
+
/** Number of attempts as per AWS SDK v3 ("retry-mode") */
|
|
52
|
+
maxAttempts?: number;
|
|
53
|
+
enableDebugLogging?: boolean;
|
|
54
|
+
/** Optional service endpoint override (e.g., VPC/Gov endpoints) */
|
|
55
|
+
endpoint?: string;
|
|
56
|
+
}
|
|
57
|
+
/**
|
|
58
|
+
* AWS Credential Validation Result
|
|
59
|
+
*/
|
|
60
|
+
export interface CredentialValidationResult {
|
|
61
|
+
isValid: boolean;
|
|
62
|
+
credentialSource: string;
|
|
63
|
+
region: string;
|
|
64
|
+
hasExpiration: boolean;
|
|
65
|
+
expirationTime?: Date;
|
|
66
|
+
error?: string;
|
|
67
|
+
debugInfo: {
|
|
68
|
+
accessKeyId: string;
|
|
69
|
+
hasSessionToken: boolean;
|
|
70
|
+
providerConfig: Readonly<Required<AWSCredentialConfig>>;
|
|
71
|
+
};
|
|
72
|
+
}
|
|
73
|
+
/**
|
|
74
|
+
* Service Connectivity Test Result
|
|
75
|
+
*/
|
|
76
|
+
export interface ServiceConnectivityResult {
|
|
77
|
+
bedrockAccessible: boolean;
|
|
78
|
+
availableModels: number;
|
|
79
|
+
responseTimeMs: number;
|
|
80
|
+
error?: string;
|
|
81
|
+
sampleModels: string[];
|
|
43
82
|
}
|
|
44
83
|
/**
|
|
45
84
|
* Model Capabilities - Maximally Reusable
|
|
@@ -123,16 +162,82 @@ export interface ModelPricing {
|
|
|
123
162
|
free?: boolean;
|
|
124
163
|
}
|
|
125
164
|
/**
|
|
126
|
-
*
|
|
165
|
+
* Response quality evaluation scores - Comprehensive evaluation interface
|
|
127
166
|
*/
|
|
128
167
|
export interface EvaluationData {
|
|
129
|
-
relevance
|
|
130
|
-
accuracy
|
|
131
|
-
completeness
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
168
|
+
relevance: number;
|
|
169
|
+
accuracy: number;
|
|
170
|
+
completeness: number;
|
|
171
|
+
overall: number;
|
|
172
|
+
domainAlignment?: number;
|
|
173
|
+
terminologyAccuracy?: number;
|
|
174
|
+
toolEffectiveness?: number;
|
|
175
|
+
isOffTopic: boolean;
|
|
176
|
+
alertSeverity: "low" | "medium" | "high" | "none";
|
|
177
|
+
reasoning: string;
|
|
178
|
+
suggestedImprovements?: string;
|
|
179
|
+
evaluationModel: string;
|
|
180
|
+
evaluationTime: number;
|
|
181
|
+
evaluationDomain?: string;
|
|
182
|
+
evaluationProvider?: string;
|
|
183
|
+
evaluationAttempt?: number;
|
|
184
|
+
evaluationConfig?: {
|
|
185
|
+
mode: string;
|
|
186
|
+
fallbackUsed: boolean;
|
|
187
|
+
costEstimate: number;
|
|
188
|
+
};
|
|
189
|
+
domainConfig?: {
|
|
190
|
+
domainName: string;
|
|
191
|
+
domainDescription: string;
|
|
192
|
+
keyTerms: string[];
|
|
193
|
+
failurePatterns: string[];
|
|
194
|
+
successPatterns: string[];
|
|
195
|
+
evaluationCriteria?: Record<string, unknown>;
|
|
196
|
+
};
|
|
197
|
+
domainEvaluation?: {
|
|
198
|
+
domainRelevance: number;
|
|
199
|
+
terminologyAccuracy: number;
|
|
200
|
+
domainExpertise: number;
|
|
201
|
+
domainSpecificInsights: string[];
|
|
202
|
+
};
|
|
203
|
+
}
|
|
204
|
+
/**
|
|
205
|
+
* Enhanced evaluation context for comprehensive response assessment
|
|
206
|
+
*/
|
|
207
|
+
export interface EvaluationContext {
|
|
208
|
+
userQuery: string;
|
|
209
|
+
aiResponse: string;
|
|
210
|
+
context?: Record<string, unknown>;
|
|
211
|
+
primaryDomain?: string;
|
|
212
|
+
assistantRole?: string;
|
|
213
|
+
conversationHistory?: Array<{
|
|
214
|
+
role: "user" | "assistant";
|
|
215
|
+
content: string;
|
|
216
|
+
timestamp?: string;
|
|
217
|
+
}>;
|
|
218
|
+
toolUsage?: Array<{
|
|
219
|
+
toolName: string;
|
|
220
|
+
input: unknown;
|
|
221
|
+
output: unknown;
|
|
222
|
+
executionTime: number;
|
|
223
|
+
}>;
|
|
224
|
+
expectedOutcome?: string;
|
|
225
|
+
evaluationCriteria?: string[];
|
|
226
|
+
}
|
|
227
|
+
/**
|
|
228
|
+
* Evaluation result interface that extends EvaluationData with additional context
|
|
229
|
+
*/
|
|
230
|
+
export interface EvaluationResult extends EvaluationData {
|
|
231
|
+
contextUtilization?: {
|
|
232
|
+
conversationUsed: boolean;
|
|
233
|
+
toolsUsed: boolean;
|
|
234
|
+
domainKnowledgeUsed: boolean;
|
|
235
|
+
};
|
|
236
|
+
evaluationContext?: {
|
|
237
|
+
domain: string;
|
|
238
|
+
toolsEvaluated: string[];
|
|
239
|
+
conversationTurns: number;
|
|
240
|
+
};
|
|
136
241
|
}
|
|
137
242
|
/**
|
|
138
243
|
* Provider capabilities
|
|
@@ -13,10 +13,10 @@ export function isProviderError(error) {
|
|
|
13
13
|
export function isTokenUsage(value) {
|
|
14
14
|
return (typeof value === "object" &&
|
|
15
15
|
value !== null &&
|
|
16
|
-
"
|
|
17
|
-
"
|
|
18
|
-
"
|
|
19
|
-
typeof value.
|
|
20
|
-
typeof value.
|
|
21
|
-
typeof value.
|
|
16
|
+
"input" in value &&
|
|
17
|
+
"output" in value &&
|
|
18
|
+
"total" in value &&
|
|
19
|
+
typeof value.input === "number" &&
|
|
20
|
+
typeof value.output === "number" &&
|
|
21
|
+
typeof value.total === "number");
|
|
22
22
|
}
|
|
@@ -1,6 +1,8 @@
|
|
|
1
1
|
import type { Tool } from "ai";
|
|
2
2
|
import type { ValidationSchema, StandardRecord } from "./typeAliases.js";
|
|
3
|
-
import type { AIProviderName, AnalyticsData
|
|
3
|
+
import type { AIProviderName, AnalyticsData } from "../core/types.js";
|
|
4
|
+
import type { EvaluationData } from "../index.js";
|
|
5
|
+
import type { TokenUsage } from "./providers.js";
|
|
4
6
|
import type { UnknownRecord, JsonValue } from "./common.js";
|
|
5
7
|
import type { ChatMessage } from "./conversationTypes.js";
|
|
6
8
|
/**
|
|
@@ -120,11 +122,7 @@ export interface StreamResult {
|
|
|
120
122
|
}>;
|
|
121
123
|
provider?: string;
|
|
122
124
|
model?: string;
|
|
123
|
-
usage?:
|
|
124
|
-
inputTokens?: number;
|
|
125
|
-
outputTokens?: number;
|
|
126
|
-
totalTokens?: number;
|
|
127
|
-
};
|
|
125
|
+
usage?: TokenUsage;
|
|
128
126
|
finishReason?: string;
|
|
129
127
|
toolCalls?: ToolCall[];
|
|
130
128
|
toolResults?: ToolResult[];
|
|
@@ -382,7 +382,7 @@ export type NetworkTransportResult = {
|
|
|
382
382
|
* Re-export commonly used types from other modules
|
|
383
383
|
* Provides one-stop shop for type imports
|
|
384
384
|
*/
|
|
385
|
-
export type { JsonValue, JsonObject
|
|
385
|
+
export type { JsonValue, JsonObject } from "./common.js";
|
|
386
386
|
/**
|
|
387
387
|
* Type guard for checking if value is a StandardRecord
|
|
388
388
|
*
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Analytics utility functions for TokenUsage and AnalyticsData
|
|
3
|
+
* Provides helper functions to avoid manual field access patterns
|
|
4
|
+
*/
|
|
5
|
+
import type { TokenUsage, AnalyticsData } from "../types/providers.js";
|
|
6
|
+
/**
|
|
7
|
+
* Format token usage as a human-readable string
|
|
8
|
+
*/
|
|
9
|
+
export declare function formatTokenUsage(usage: TokenUsage): string;
|
|
10
|
+
/**
|
|
11
|
+
* Calculate cost based on token usage and cost per token
|
|
12
|
+
*/
|
|
13
|
+
export declare function calculateTokenCost(usage: TokenUsage, costPerToken: number): number;
|
|
14
|
+
/**
|
|
15
|
+
* Combine multiple token usage objects into a single total
|
|
16
|
+
*/
|
|
17
|
+
export declare function combineTokenUsage(usages: TokenUsage[]): TokenUsage;
|
|
18
|
+
/**
|
|
19
|
+
* Format analytics data for display
|
|
20
|
+
*/
|
|
21
|
+
export declare function formatAnalyticsForDisplay(analytics: AnalyticsData): string;
|
|
22
|
+
/**
|
|
23
|
+
* Check if analytics data contains valid token usage
|
|
24
|
+
*/
|
|
25
|
+
export declare function hasValidTokenUsage(analytics: AnalyticsData): boolean;
|
|
26
|
+
/**
|
|
27
|
+
* Extract summary metrics from analytics data
|
|
28
|
+
*/
|
|
29
|
+
export declare function getAnalyticsSummary(analytics: AnalyticsData): {
|
|
30
|
+
totalTokens: number;
|
|
31
|
+
costPerToken: number | null;
|
|
32
|
+
requestsPerSecond: number;
|
|
33
|
+
};
|
|
@@ -0,0 +1,76 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Analytics utility functions for TokenUsage and AnalyticsData
|
|
3
|
+
* Provides helper functions to avoid manual field access patterns
|
|
4
|
+
*/
|
|
5
|
+
/**
|
|
6
|
+
* Format token usage as a human-readable string
|
|
7
|
+
*/
|
|
8
|
+
export function formatTokenUsage(usage) {
|
|
9
|
+
return `${usage.input}/${usage.output}/${usage.total}`;
|
|
10
|
+
}
|
|
11
|
+
/**
|
|
12
|
+
* Calculate cost based on token usage and cost per token
|
|
13
|
+
*/
|
|
14
|
+
export function calculateTokenCost(usage, costPerToken) {
|
|
15
|
+
return usage.total * costPerToken;
|
|
16
|
+
}
|
|
17
|
+
/**
|
|
18
|
+
* Combine multiple token usage objects into a single total
|
|
19
|
+
*/
|
|
20
|
+
export function combineTokenUsage(usages) {
|
|
21
|
+
return usages.reduce((total, current) => ({
|
|
22
|
+
input: total.input + current.input,
|
|
23
|
+
output: total.output + current.output,
|
|
24
|
+
total: total.total + current.total,
|
|
25
|
+
}), { input: 0, output: 0, total: 0 });
|
|
26
|
+
}
|
|
27
|
+
/**
|
|
28
|
+
* Format analytics data for display
|
|
29
|
+
*/
|
|
30
|
+
export function formatAnalyticsForDisplay(analytics) {
|
|
31
|
+
const parts = [];
|
|
32
|
+
// Provider and model
|
|
33
|
+
parts.push(`Provider: ${analytics.provider}`);
|
|
34
|
+
if (analytics.model) {
|
|
35
|
+
parts.push(`Model: ${analytics.model}`);
|
|
36
|
+
}
|
|
37
|
+
// Token usage
|
|
38
|
+
parts.push(`Tokens: ${formatTokenUsage(analytics.tokenUsage)}`);
|
|
39
|
+
// Cost
|
|
40
|
+
if (analytics.cost !== undefined) {
|
|
41
|
+
parts.push(`Cost: $${analytics.cost.toFixed(5)}`);
|
|
42
|
+
}
|
|
43
|
+
// Duration
|
|
44
|
+
const timeInSeconds = (analytics.requestDuration / 1000).toFixed(1);
|
|
45
|
+
parts.push(`Time: ${timeInSeconds}s`);
|
|
46
|
+
return parts.join(" | ");
|
|
47
|
+
}
|
|
48
|
+
/**
|
|
49
|
+
* Check if analytics data contains valid token usage
|
|
50
|
+
*/
|
|
51
|
+
export function hasValidTokenUsage(analytics) {
|
|
52
|
+
return !!(analytics.tokenUsage &&
|
|
53
|
+
typeof analytics.tokenUsage.input === "number" &&
|
|
54
|
+
typeof analytics.tokenUsage.output === "number" &&
|
|
55
|
+
typeof analytics.tokenUsage.total === "number");
|
|
56
|
+
}
|
|
57
|
+
/**
|
|
58
|
+
* Extract summary metrics from analytics data
|
|
59
|
+
*/
|
|
60
|
+
export function getAnalyticsSummary(analytics) {
|
|
61
|
+
const totalTokens = analytics.tokenUsage.total;
|
|
62
|
+
let costPerToken = null;
|
|
63
|
+
if (analytics.cost !== null &&
|
|
64
|
+
analytics.cost !== undefined &&
|
|
65
|
+
Number.isFinite(analytics.cost) &&
|
|
66
|
+
totalTokens > 0) {
|
|
67
|
+
const computed = analytics.cost / (totalTokens / 1000);
|
|
68
|
+
costPerToken = Number.isFinite(computed) ? computed : null;
|
|
69
|
+
}
|
|
70
|
+
const requestsPerSecond = analytics.requestDuration > 0 ? 1000 / analytics.requestDuration : 0;
|
|
71
|
+
return {
|
|
72
|
+
totalTokens,
|
|
73
|
+
costPerToken,
|
|
74
|
+
requestsPerSecond,
|
|
75
|
+
};
|
|
76
|
+
}
|
|
@@ -218,7 +218,10 @@ export async function withRetry(operation, options) {
|
|
|
218
218
|
await new Promise((resolve) => setTimeout(resolve, delayMs));
|
|
219
219
|
}
|
|
220
220
|
}
|
|
221
|
-
|
|
221
|
+
if (lastError) {
|
|
222
|
+
throw lastError;
|
|
223
|
+
}
|
|
224
|
+
throw new Error("Retry operation failed with no error information");
|
|
222
225
|
}
|
|
223
226
|
/**
|
|
224
227
|
* Circuit breaker for preventing cascading failures
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Evaluation utilities for normalizing EvaluationData objects
|
|
3
|
+
* Provides helper functions to handle partial evaluation data and ensure
|
|
4
|
+
* complete EvaluationData objects with safe defaults
|
|
5
|
+
*/
|
|
6
|
+
import type { EvaluationData } from "../types/providers.js";
|
|
7
|
+
/**
|
|
8
|
+
* Normalize partial EvaluationData into a complete EvaluationData object
|
|
9
|
+
* with safe defaults for missing required fields
|
|
10
|
+
*/
|
|
11
|
+
export declare function normalizeEvaluationData(partial: Partial<EvaluationData>): EvaluationData;
|
|
12
|
+
/**
|
|
13
|
+
* Create a default EvaluationData object for cases where no evaluation was performed
|
|
14
|
+
*/
|
|
15
|
+
export declare function createDefaultEvaluationData(overrides?: Partial<EvaluationData>): EvaluationData;
|
|
16
|
+
/**
|
|
17
|
+
* Check if EvaluationData indicates a successful evaluation
|
|
18
|
+
*/
|
|
19
|
+
export declare function isValidEvaluation(evaluation: EvaluationData): boolean;
|
|
20
|
+
/**
|
|
21
|
+
* Create EvaluationData for a failed evaluation attempt
|
|
22
|
+
*/
|
|
23
|
+
export declare function createFailedEvaluationData(error: string, overrides?: Partial<EvaluationData>): EvaluationData;
|
|
24
|
+
/**
|
|
25
|
+
* Merge multiple partial evaluation data objects into a normalized result
|
|
26
|
+
*/
|
|
27
|
+
export declare function mergeEvaluationData(...partials: Partial<EvaluationData>[]): EvaluationData;
|
|
@@ -0,0 +1,131 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Evaluation utilities for normalizing EvaluationData objects
|
|
3
|
+
* Provides helper functions to handle partial evaluation data and ensure
|
|
4
|
+
* complete EvaluationData objects with safe defaults
|
|
5
|
+
*/
|
|
6
|
+
/**
|
|
7
|
+
* Default values for required EvaluationData fields
|
|
8
|
+
*/
|
|
9
|
+
const DEFAULT_EVALUATION_DATA = {
|
|
10
|
+
// Core scores (1-10 scale)
|
|
11
|
+
relevance: 0,
|
|
12
|
+
accuracy: 0,
|
|
13
|
+
completeness: 0,
|
|
14
|
+
overall: 0,
|
|
15
|
+
// Advanced insights
|
|
16
|
+
isOffTopic: false,
|
|
17
|
+
alertSeverity: "none",
|
|
18
|
+
reasoning: "",
|
|
19
|
+
// Metadata
|
|
20
|
+
evaluationModel: "unknown",
|
|
21
|
+
evaluationTime: 0,
|
|
22
|
+
// Enhanced metadata defaults
|
|
23
|
+
evaluationProvider: "unknown",
|
|
24
|
+
evaluationAttempt: 0,
|
|
25
|
+
evaluationConfig: {
|
|
26
|
+
mode: "default",
|
|
27
|
+
fallbackUsed: false,
|
|
28
|
+
costEstimate: 0,
|
|
29
|
+
},
|
|
30
|
+
};
|
|
31
|
+
/**
|
|
32
|
+
* Normalize partial EvaluationData into a complete EvaluationData object
|
|
33
|
+
* with safe defaults for missing required fields
|
|
34
|
+
*/
|
|
35
|
+
export function normalizeEvaluationData(partial) {
|
|
36
|
+
const normalized = {
|
|
37
|
+
...DEFAULT_EVALUATION_DATA,
|
|
38
|
+
...partial,
|
|
39
|
+
};
|
|
40
|
+
// Ensure scores are within valid range (0-10)
|
|
41
|
+
normalized.relevance = Math.max(0, Math.min(10, normalized.relevance));
|
|
42
|
+
normalized.accuracy = Math.max(0, Math.min(10, normalized.accuracy));
|
|
43
|
+
normalized.completeness = Math.max(0, Math.min(10, normalized.completeness));
|
|
44
|
+
normalized.overall = Math.max(0, Math.min(10, normalized.overall));
|
|
45
|
+
// Optional scores
|
|
46
|
+
if (normalized.domainAlignment !== undefined) {
|
|
47
|
+
normalized.domainAlignment = Math.max(0, Math.min(10, normalized.domainAlignment));
|
|
48
|
+
}
|
|
49
|
+
if (normalized.terminologyAccuracy !== undefined) {
|
|
50
|
+
normalized.terminologyAccuracy = Math.max(0, Math.min(10, normalized.terminologyAccuracy));
|
|
51
|
+
}
|
|
52
|
+
if (normalized.toolEffectiveness !== undefined) {
|
|
53
|
+
normalized.toolEffectiveness = Math.max(0, Math.min(10, normalized.toolEffectiveness));
|
|
54
|
+
}
|
|
55
|
+
// Validate alertSeverity enum
|
|
56
|
+
const validSeverities = ["low", "medium", "high", "none"];
|
|
57
|
+
if (!validSeverities.includes(normalized.alertSeverity)) {
|
|
58
|
+
normalized.alertSeverity = "none";
|
|
59
|
+
}
|
|
60
|
+
// Truncate reasoning and suggestedImprovements to enforce length constraints
|
|
61
|
+
normalized.reasoning = truncateString(normalized.reasoning, 150);
|
|
62
|
+
if (normalized.suggestedImprovements) {
|
|
63
|
+
normalized.suggestedImprovements = truncateString(normalized.suggestedImprovements, 100);
|
|
64
|
+
}
|
|
65
|
+
// Ensure evaluationTime is non-negative
|
|
66
|
+
normalized.evaluationTime = Math.max(0, normalized.evaluationTime);
|
|
67
|
+
// Ensure evaluationAttempt is positive
|
|
68
|
+
if (normalized.evaluationAttempt !== undefined) {
|
|
69
|
+
normalized.evaluationAttempt = Math.max(0, normalized.evaluationAttempt);
|
|
70
|
+
}
|
|
71
|
+
// Ensure evaluationConfig has required fields
|
|
72
|
+
if (normalized.evaluationConfig) {
|
|
73
|
+
normalized.evaluationConfig = {
|
|
74
|
+
mode: normalized.evaluationConfig.mode || "default",
|
|
75
|
+
fallbackUsed: Boolean(normalized.evaluationConfig.fallbackUsed),
|
|
76
|
+
costEstimate: Math.max(0, normalized.evaluationConfig.costEstimate || 0),
|
|
77
|
+
};
|
|
78
|
+
}
|
|
79
|
+
return normalized;
|
|
80
|
+
}
|
|
81
|
+
/**
|
|
82
|
+
* Create a default EvaluationData object for cases where no evaluation was performed
|
|
83
|
+
*/
|
|
84
|
+
export function createDefaultEvaluationData(overrides = {}) {
|
|
85
|
+
return normalizeEvaluationData({
|
|
86
|
+
...overrides,
|
|
87
|
+
reasoning: overrides.reasoning || "No evaluation performed",
|
|
88
|
+
evaluationModel: overrides.evaluationModel || "none",
|
|
89
|
+
});
|
|
90
|
+
}
|
|
91
|
+
/**
|
|
92
|
+
* Check if EvaluationData indicates a successful evaluation
|
|
93
|
+
*/
|
|
94
|
+
export function isValidEvaluation(evaluation) {
|
|
95
|
+
return (evaluation.evaluationModel !== "unknown" &&
|
|
96
|
+
evaluation.evaluationModel !== "none" &&
|
|
97
|
+
evaluation.reasoning.length > 0 &&
|
|
98
|
+
evaluation.overall > 0);
|
|
99
|
+
}
|
|
100
|
+
/**
|
|
101
|
+
* Create EvaluationData for a failed evaluation attempt
|
|
102
|
+
*/
|
|
103
|
+
export function createFailedEvaluationData(error, overrides = {}) {
|
|
104
|
+
return normalizeEvaluationData({
|
|
105
|
+
...overrides,
|
|
106
|
+
reasoning: `Evaluation failed: ${truncateString(error, 100)}`,
|
|
107
|
+
alertSeverity: "medium",
|
|
108
|
+
evaluationModel: overrides.evaluationModel || "error",
|
|
109
|
+
evaluationConfig: {
|
|
110
|
+
mode: "error",
|
|
111
|
+
fallbackUsed: true,
|
|
112
|
+
costEstimate: 0,
|
|
113
|
+
},
|
|
114
|
+
});
|
|
115
|
+
}
|
|
116
|
+
/**
|
|
117
|
+
* Helper function to truncate strings to a maximum length
|
|
118
|
+
*/
|
|
119
|
+
function truncateString(str, maxLength) {
|
|
120
|
+
if (str.length <= maxLength) {
|
|
121
|
+
return str;
|
|
122
|
+
}
|
|
123
|
+
return str.substring(0, maxLength - 3) + "...";
|
|
124
|
+
}
|
|
125
|
+
/**
|
|
126
|
+
* Merge multiple partial evaluation data objects into a normalized result
|
|
127
|
+
*/
|
|
128
|
+
export function mergeEvaluationData(...partials) {
|
|
129
|
+
const merged = partials.reduce((acc, partial) => ({ ...acc, ...partial }), {});
|
|
130
|
+
return normalizeEvaluationData(merged);
|
|
131
|
+
}
|