@juspay/neurolink 7.32.0 → 7.33.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/dist/agent/directTools.d.ts +6 -6
- package/dist/cli/commands/config.d.ts +68 -68
- package/dist/cli/utils/interactiveSetup.d.ts +1 -1
- package/dist/cli/utils/interactiveSetup.js +1 -1
- package/dist/core/analytics.d.ts +1 -2
- package/dist/core/baseProvider.d.ts +7 -1
- package/dist/core/baseProvider.js +59 -42
- package/dist/core/dynamicModels.d.ts +1 -132
- package/dist/core/dynamicModels.js +0 -7
- package/dist/core/evaluation.d.ts +1 -39
- package/dist/core/evaluationProviders.d.ts +1 -17
- package/dist/core/evaluationProviders.js +1 -1
- package/dist/core/factory.d.ts +1 -3
- package/dist/core/factory.js +0 -1
- package/dist/core/modelConfiguration.d.ts +8 -69
- package/dist/core/modelConfiguration.js +11 -11
- package/dist/core/serviceRegistry.d.ts +1 -8
- package/dist/core/streamAnalytics.d.ts +2 -45
- package/dist/factories/providerFactory.d.ts +1 -1
- package/dist/factories/providerRegistry.js +1 -1
- package/dist/index.d.ts +8 -9
- package/dist/index.js +1 -1
- package/dist/lib/core/analytics.d.ts +1 -2
- package/dist/lib/core/baseProvider.d.ts +7 -1
- package/dist/lib/core/baseProvider.js +59 -42
- package/dist/lib/core/dynamicModels.d.ts +1 -132
- package/dist/lib/core/dynamicModels.js +0 -7
- package/dist/lib/core/evaluation.d.ts +1 -39
- package/dist/lib/core/evaluationProviders.d.ts +1 -17
- package/dist/lib/core/evaluationProviders.js +1 -1
- package/dist/lib/core/factory.d.ts +1 -3
- package/dist/lib/core/factory.js +0 -1
- package/dist/lib/core/modelConfiguration.d.ts +8 -69
- package/dist/lib/core/modelConfiguration.js +11 -11
- package/dist/lib/core/serviceRegistry.d.ts +1 -8
- package/dist/lib/core/streamAnalytics.d.ts +2 -45
- package/dist/lib/factories/providerFactory.d.ts +1 -1
- package/dist/lib/factories/providerRegistry.js +1 -1
- package/dist/lib/index.d.ts +5 -6
- package/dist/lib/index.js +1 -1
- package/dist/lib/models/modelRegistry.d.ts +1 -1
- package/dist/lib/models/modelRegistry.js +1 -1
- package/dist/lib/models/modelResolver.d.ts +1 -1
- package/dist/lib/neurolink.d.ts +1 -1
- package/dist/lib/neurolink.js +1 -1
- package/dist/lib/providers/amazonBedrock.d.ts +1 -2
- package/dist/lib/providers/amazonSagemaker.d.ts +1 -1
- package/dist/lib/providers/anthropic.d.ts +1 -1
- package/dist/lib/providers/anthropic.js +1 -1
- package/dist/lib/providers/anthropicBaseProvider.d.ts +1 -1
- package/dist/lib/providers/anthropicBaseProvider.js +1 -1
- package/dist/lib/providers/azureOpenai.d.ts +1 -1
- package/dist/lib/providers/googleAiStudio.d.ts +1 -1
- package/dist/lib/providers/googleAiStudio.js +1 -1
- package/dist/lib/providers/googleVertex.d.ts +1 -1
- package/dist/lib/providers/googleVertex.js +1 -1
- package/dist/lib/providers/huggingFace.d.ts +1 -1
- package/dist/lib/providers/index.d.ts +1 -1
- package/dist/lib/providers/litellm.d.ts +1 -1
- package/dist/lib/providers/mistral.d.ts +1 -1
- package/dist/lib/providers/ollama.d.ts +1 -1
- package/dist/lib/providers/ollama.js +1 -1
- package/dist/lib/providers/openAI.d.ts +1 -1
- package/dist/lib/providers/openAI.js +1 -1
- package/dist/lib/providers/openaiCompatible.d.ts +1 -1
- package/dist/lib/providers/sagemaker/language-model.d.ts +2 -2
- package/dist/lib/types/analytics.d.ts +53 -0
- package/dist/lib/types/analytics.js +5 -0
- package/dist/lib/types/cli.d.ts +1 -1
- package/dist/lib/types/evaluation.d.ts +119 -0
- package/dist/lib/types/evaluation.js +5 -0
- package/dist/lib/types/evaluationProviders.d.ts +104 -0
- package/dist/lib/types/evaluationProviders.js +5 -0
- package/dist/lib/types/generateTypes.d.ts +89 -18
- package/dist/lib/types/index.d.ts +10 -2
- package/dist/lib/types/index.js +12 -0
- package/dist/lib/types/modelTypes.d.ts +242 -0
- package/dist/lib/types/modelTypes.js +30 -0
- package/dist/lib/types/providers.d.ts +193 -127
- package/dist/lib/types/providers.js +110 -18
- package/dist/lib/types/serviceTypes.d.ts +79 -0
- package/dist/lib/types/serviceTypes.js +5 -0
- package/dist/lib/types/streamTypes.d.ts +101 -21
- package/dist/lib/utils/analyticsUtils.d.ts +5 -1
- package/dist/lib/utils/analyticsUtils.js +13 -0
- package/dist/lib/utils/conversationMemoryUtils.d.ts +1 -1
- package/dist/lib/utils/evaluationUtils.d.ts +1 -1
- package/dist/lib/utils/factoryProcessing.d.ts +1 -1
- package/dist/lib/utils/messageBuilder.d.ts +1 -1
- package/dist/lib/utils/providerHealth.d.ts +1 -1
- package/dist/lib/utils/providerHealth.js +1 -1
- package/dist/lib/utils/providerUtils.d.ts +5 -0
- package/dist/lib/utils/providerUtils.js +6 -0
- package/dist/models/modelRegistry.d.ts +1 -1
- package/dist/models/modelRegistry.js +1 -1
- package/dist/models/modelResolver.d.ts +1 -1
- package/dist/neurolink.d.ts +1 -1
- package/dist/neurolink.js +1 -1
- package/dist/providers/amazonBedrock.d.ts +1 -2
- package/dist/providers/amazonSagemaker.d.ts +1 -1
- package/dist/providers/anthropic.d.ts +1 -1
- package/dist/providers/anthropic.js +1 -1
- package/dist/providers/anthropicBaseProvider.d.ts +1 -1
- package/dist/providers/anthropicBaseProvider.js +1 -1
- package/dist/providers/azureOpenai.d.ts +1 -1
- package/dist/providers/googleAiStudio.d.ts +1 -1
- package/dist/providers/googleAiStudio.js +1 -1
- package/dist/providers/googleVertex.d.ts +1 -1
- package/dist/providers/googleVertex.js +1 -1
- package/dist/providers/huggingFace.d.ts +1 -1
- package/dist/providers/index.d.ts +1 -1
- package/dist/providers/litellm.d.ts +1 -1
- package/dist/providers/mistral.d.ts +1 -1
- package/dist/providers/ollama.d.ts +1 -1
- package/dist/providers/ollama.js +1 -1
- package/dist/providers/openAI.d.ts +1 -1
- package/dist/providers/openAI.js +1 -1
- package/dist/providers/openaiCompatible.d.ts +1 -1
- package/dist/types/analytics.d.ts +53 -0
- package/dist/types/analytics.js +5 -0
- package/dist/types/cli.d.ts +1 -1
- package/dist/types/evaluation.d.ts +119 -0
- package/dist/types/evaluation.js +5 -0
- package/dist/types/evaluationProviders.d.ts +104 -0
- package/dist/types/evaluationProviders.js +5 -0
- package/dist/types/generateTypes.d.ts +89 -18
- package/dist/types/index.d.ts +10 -2
- package/dist/types/index.js +12 -0
- package/dist/types/modelTypes.d.ts +242 -0
- package/dist/types/modelTypes.js +30 -0
- package/dist/types/providers.d.ts +193 -127
- package/dist/types/providers.js +110 -18
- package/dist/types/serviceTypes.d.ts +79 -0
- package/dist/types/serviceTypes.js +5 -0
- package/dist/types/streamTypes.d.ts +101 -21
- package/dist/utils/analyticsUtils.d.ts +5 -1
- package/dist/utils/analyticsUtils.js +13 -0
- package/dist/utils/conversationMemoryUtils.d.ts +1 -1
- package/dist/utils/evaluationUtils.d.ts +1 -1
- package/dist/utils/factoryProcessing.d.ts +1 -1
- package/dist/utils/messageBuilder.d.ts +1 -1
- package/dist/utils/providerHealth.d.ts +1 -1
- package/dist/utils/providerHealth.js +1 -1
- package/dist/utils/providerUtils.d.ts +5 -0
- package/dist/utils/providerUtils.js +6 -0
- package/package.json +1 -1
- package/dist/core/types.d.ts +0 -223
- package/dist/core/types.js +0 -111
- package/dist/lib/core/types.d.ts +0 -223
- package/dist/lib/core/types.js +0 -111
package/CHANGELOG.md
CHANGED
|
@@ -1,3 +1,11 @@
|
|
|
1
|
+
## [7.33.1](https://github.com/juspay/neurolink/compare/v7.33.0...v7.33.1) (2025-09-03)
|
|
2
|
+
|
|
3
|
+
## [7.33.0](https://github.com/juspay/neurolink/compare/v7.32.0...v7.33.0) (2025-09-03)
|
|
4
|
+
|
|
5
|
+
### Features
|
|
6
|
+
|
|
7
|
+
- **(provider):** refactor generate method to use streamText for improved performance and consistency ([a118300](https://github.com/juspay/neurolink/commit/a11830088376b899725bcb1dc2467cb73f44f5b9))
|
|
8
|
+
|
|
1
9
|
## [7.32.0](https://github.com/juspay/neurolink/compare/v7.31.0...v7.32.0) (2025-09-03)
|
|
2
10
|
|
|
3
11
|
### Features
|
|
@@ -219,12 +219,12 @@ export declare const directAgentTools: {
|
|
|
219
219
|
content: z.ZodString;
|
|
220
220
|
mode: z.ZodDefault<z.ZodEnum<["create", "overwrite", "append"]>>;
|
|
221
221
|
}, "strip", z.ZodTypeAny, {
|
|
222
|
-
content: string;
|
|
223
222
|
path: string;
|
|
223
|
+
content: string;
|
|
224
224
|
mode: "create" | "overwrite" | "append";
|
|
225
225
|
}, {
|
|
226
|
-
content: string;
|
|
227
226
|
path: string;
|
|
227
|
+
content: string;
|
|
228
228
|
mode?: "create" | "overwrite" | "append" | undefined;
|
|
229
229
|
}>, {
|
|
230
230
|
success: boolean;
|
|
@@ -249,8 +249,8 @@ export declare const directAgentTools: {
|
|
|
249
249
|
written?: undefined;
|
|
250
250
|
}> & {
|
|
251
251
|
execute: (args: {
|
|
252
|
-
content: string;
|
|
253
252
|
path: string;
|
|
253
|
+
content: string;
|
|
254
254
|
mode: "create" | "overwrite" | "append";
|
|
255
255
|
}, options: import("ai").ToolExecutionOptions) => PromiseLike<{
|
|
256
256
|
success: boolean;
|
|
@@ -280,12 +280,12 @@ export declare const directAgentTools: {
|
|
|
280
280
|
pattern: z.ZodString;
|
|
281
281
|
recursive: z.ZodDefault<z.ZodOptional<z.ZodBoolean>>;
|
|
282
282
|
}, "strip", z.ZodTypeAny, {
|
|
283
|
-
directory: string;
|
|
284
283
|
pattern: string;
|
|
284
|
+
directory: string;
|
|
285
285
|
recursive: boolean;
|
|
286
286
|
}, {
|
|
287
|
-
directory: string;
|
|
288
287
|
pattern: string;
|
|
288
|
+
directory: string;
|
|
289
289
|
recursive?: boolean | undefined;
|
|
290
290
|
}>, {
|
|
291
291
|
success: boolean;
|
|
@@ -315,8 +315,8 @@ export declare const directAgentTools: {
|
|
|
315
315
|
count?: undefined;
|
|
316
316
|
}> & {
|
|
317
317
|
execute: (args: {
|
|
318
|
-
directory: string;
|
|
319
318
|
pattern: string;
|
|
319
|
+
directory: string;
|
|
320
320
|
recursive: boolean;
|
|
321
321
|
}, options: import("ai").ToolExecutionOptions) => PromiseLike<{
|
|
322
322
|
success: boolean;
|
|
@@ -136,6 +136,15 @@ declare const ConfigSchema: z.ZodObject<{
|
|
|
136
136
|
model?: string | undefined;
|
|
137
137
|
}>>;
|
|
138
138
|
}, "strip", z.ZodTypeAny, {
|
|
139
|
+
openai?: {
|
|
140
|
+
model: string;
|
|
141
|
+
apiKey?: string | undefined;
|
|
142
|
+
baseURL?: string | undefined;
|
|
143
|
+
} | undefined;
|
|
144
|
+
anthropic?: {
|
|
145
|
+
model: string;
|
|
146
|
+
apiKey?: string | undefined;
|
|
147
|
+
} | undefined;
|
|
139
148
|
vertex?: {
|
|
140
149
|
model: string;
|
|
141
150
|
location: string;
|
|
@@ -145,6 +154,10 @@ declare const ConfigSchema: z.ZodObject<{
|
|
|
145
154
|
clientEmail?: string | undefined;
|
|
146
155
|
privateKey?: string | undefined;
|
|
147
156
|
} | undefined;
|
|
157
|
+
"google-ai"?: {
|
|
158
|
+
model: string;
|
|
159
|
+
apiKey?: string | undefined;
|
|
160
|
+
} | undefined;
|
|
148
161
|
bedrock?: {
|
|
149
162
|
model: string;
|
|
150
163
|
region?: string | undefined;
|
|
@@ -152,16 +165,13 @@ declare const ConfigSchema: z.ZodObject<{
|
|
|
152
165
|
secretAccessKey?: string | undefined;
|
|
153
166
|
sessionToken?: string | undefined;
|
|
154
167
|
} | undefined;
|
|
155
|
-
|
|
156
|
-
model: string;
|
|
157
|
-
apiKey?: string | undefined;
|
|
158
|
-
} | undefined;
|
|
159
|
-
openai?: {
|
|
168
|
+
azure?: {
|
|
160
169
|
model: string;
|
|
161
170
|
apiKey?: string | undefined;
|
|
162
|
-
|
|
171
|
+
endpoint?: string | undefined;
|
|
172
|
+
deploymentId?: string | undefined;
|
|
163
173
|
} | undefined;
|
|
164
|
-
|
|
174
|
+
huggingface?: {
|
|
165
175
|
model: string;
|
|
166
176
|
apiKey?: string | undefined;
|
|
167
177
|
} | undefined;
|
|
@@ -170,21 +180,20 @@ declare const ConfigSchema: z.ZodObject<{
|
|
|
170
180
|
model: string;
|
|
171
181
|
baseUrl: string;
|
|
172
182
|
} | undefined;
|
|
173
|
-
|
|
183
|
+
mistral?: {
|
|
174
184
|
model: string;
|
|
175
185
|
apiKey?: string | undefined;
|
|
176
|
-
endpoint?: string | undefined;
|
|
177
|
-
deploymentId?: string | undefined;
|
|
178
186
|
} | undefined;
|
|
179
|
-
|
|
180
|
-
|
|
187
|
+
}, {
|
|
188
|
+
openai?: {
|
|
181
189
|
apiKey?: string | undefined;
|
|
190
|
+
baseURL?: string | undefined;
|
|
191
|
+
model?: string | undefined;
|
|
182
192
|
} | undefined;
|
|
183
|
-
|
|
184
|
-
model: string;
|
|
193
|
+
anthropic?: {
|
|
185
194
|
apiKey?: string | undefined;
|
|
195
|
+
model?: string | undefined;
|
|
186
196
|
} | undefined;
|
|
187
|
-
}, {
|
|
188
197
|
vertex?: {
|
|
189
198
|
model?: string | undefined;
|
|
190
199
|
projectId?: string | undefined;
|
|
@@ -194,6 +203,10 @@ declare const ConfigSchema: z.ZodObject<{
|
|
|
194
203
|
clientEmail?: string | undefined;
|
|
195
204
|
privateKey?: string | undefined;
|
|
196
205
|
} | undefined;
|
|
206
|
+
"google-ai"?: {
|
|
207
|
+
apiKey?: string | undefined;
|
|
208
|
+
model?: string | undefined;
|
|
209
|
+
} | undefined;
|
|
197
210
|
bedrock?: {
|
|
198
211
|
model?: string | undefined;
|
|
199
212
|
region?: string | undefined;
|
|
@@ -201,16 +214,13 @@ declare const ConfigSchema: z.ZodObject<{
|
|
|
201
214
|
secretAccessKey?: string | undefined;
|
|
202
215
|
sessionToken?: string | undefined;
|
|
203
216
|
} | undefined;
|
|
204
|
-
|
|
205
|
-
apiKey?: string | undefined;
|
|
206
|
-
model?: string | undefined;
|
|
207
|
-
} | undefined;
|
|
208
|
-
openai?: {
|
|
217
|
+
azure?: {
|
|
209
218
|
apiKey?: string | undefined;
|
|
210
|
-
baseURL?: string | undefined;
|
|
211
219
|
model?: string | undefined;
|
|
220
|
+
endpoint?: string | undefined;
|
|
221
|
+
deploymentId?: string | undefined;
|
|
212
222
|
} | undefined;
|
|
213
|
-
|
|
223
|
+
huggingface?: {
|
|
214
224
|
apiKey?: string | undefined;
|
|
215
225
|
model?: string | undefined;
|
|
216
226
|
} | undefined;
|
|
@@ -219,16 +229,6 @@ declare const ConfigSchema: z.ZodObject<{
|
|
|
219
229
|
model?: string | undefined;
|
|
220
230
|
baseUrl?: string | undefined;
|
|
221
231
|
} | undefined;
|
|
222
|
-
azure?: {
|
|
223
|
-
apiKey?: string | undefined;
|
|
224
|
-
model?: string | undefined;
|
|
225
|
-
endpoint?: string | undefined;
|
|
226
|
-
deploymentId?: string | undefined;
|
|
227
|
-
} | undefined;
|
|
228
|
-
huggingface?: {
|
|
229
|
-
apiKey?: string | undefined;
|
|
230
|
-
model?: string | undefined;
|
|
231
|
-
} | undefined;
|
|
232
232
|
mistral?: {
|
|
233
233
|
apiKey?: string | undefined;
|
|
234
234
|
model?: string | undefined;
|
|
@@ -456,6 +456,15 @@ declare const ConfigSchema: z.ZodObject<{
|
|
|
456
456
|
}>>;
|
|
457
457
|
}, "strip", z.ZodTypeAny, {
|
|
458
458
|
providers: {
|
|
459
|
+
openai?: {
|
|
460
|
+
model: string;
|
|
461
|
+
apiKey?: string | undefined;
|
|
462
|
+
baseURL?: string | undefined;
|
|
463
|
+
} | undefined;
|
|
464
|
+
anthropic?: {
|
|
465
|
+
model: string;
|
|
466
|
+
apiKey?: string | undefined;
|
|
467
|
+
} | undefined;
|
|
459
468
|
vertex?: {
|
|
460
469
|
model: string;
|
|
461
470
|
location: string;
|
|
@@ -465,6 +474,10 @@ declare const ConfigSchema: z.ZodObject<{
|
|
|
465
474
|
clientEmail?: string | undefined;
|
|
466
475
|
privateKey?: string | undefined;
|
|
467
476
|
} | undefined;
|
|
477
|
+
"google-ai"?: {
|
|
478
|
+
model: string;
|
|
479
|
+
apiKey?: string | undefined;
|
|
480
|
+
} | undefined;
|
|
468
481
|
bedrock?: {
|
|
469
482
|
model: string;
|
|
470
483
|
region?: string | undefined;
|
|
@@ -472,16 +485,13 @@ declare const ConfigSchema: z.ZodObject<{
|
|
|
472
485
|
secretAccessKey?: string | undefined;
|
|
473
486
|
sessionToken?: string | undefined;
|
|
474
487
|
} | undefined;
|
|
475
|
-
|
|
476
|
-
model: string;
|
|
477
|
-
apiKey?: string | undefined;
|
|
478
|
-
} | undefined;
|
|
479
|
-
openai?: {
|
|
488
|
+
azure?: {
|
|
480
489
|
model: string;
|
|
481
490
|
apiKey?: string | undefined;
|
|
482
|
-
|
|
491
|
+
endpoint?: string | undefined;
|
|
492
|
+
deploymentId?: string | undefined;
|
|
483
493
|
} | undefined;
|
|
484
|
-
|
|
494
|
+
huggingface?: {
|
|
485
495
|
model: string;
|
|
486
496
|
apiKey?: string | undefined;
|
|
487
497
|
} | undefined;
|
|
@@ -490,22 +500,12 @@ declare const ConfigSchema: z.ZodObject<{
|
|
|
490
500
|
model: string;
|
|
491
501
|
baseUrl: string;
|
|
492
502
|
} | undefined;
|
|
493
|
-
azure?: {
|
|
494
|
-
model: string;
|
|
495
|
-
apiKey?: string | undefined;
|
|
496
|
-
endpoint?: string | undefined;
|
|
497
|
-
deploymentId?: string | undefined;
|
|
498
|
-
} | undefined;
|
|
499
|
-
huggingface?: {
|
|
500
|
-
model: string;
|
|
501
|
-
apiKey?: string | undefined;
|
|
502
|
-
} | undefined;
|
|
503
503
|
mistral?: {
|
|
504
504
|
model: string;
|
|
505
505
|
apiKey?: string | undefined;
|
|
506
506
|
} | undefined;
|
|
507
507
|
};
|
|
508
|
-
defaultProvider: "
|
|
508
|
+
defaultProvider: "openai" | "anthropic" | "vertex" | "google-ai" | "bedrock" | "azure" | "huggingface" | "ollama" | "mistral" | "auto";
|
|
509
509
|
profiles: Record<string, any>;
|
|
510
510
|
preferences: {
|
|
511
511
|
maxTokens: number;
|
|
@@ -554,6 +554,15 @@ declare const ConfigSchema: z.ZodObject<{
|
|
|
554
554
|
};
|
|
555
555
|
}, {
|
|
556
556
|
providers?: {
|
|
557
|
+
openai?: {
|
|
558
|
+
apiKey?: string | undefined;
|
|
559
|
+
baseURL?: string | undefined;
|
|
560
|
+
model?: string | undefined;
|
|
561
|
+
} | undefined;
|
|
562
|
+
anthropic?: {
|
|
563
|
+
apiKey?: string | undefined;
|
|
564
|
+
model?: string | undefined;
|
|
565
|
+
} | undefined;
|
|
557
566
|
vertex?: {
|
|
558
567
|
model?: string | undefined;
|
|
559
568
|
projectId?: string | undefined;
|
|
@@ -563,6 +572,10 @@ declare const ConfigSchema: z.ZodObject<{
|
|
|
563
572
|
clientEmail?: string | undefined;
|
|
564
573
|
privateKey?: string | undefined;
|
|
565
574
|
} | undefined;
|
|
575
|
+
"google-ai"?: {
|
|
576
|
+
apiKey?: string | undefined;
|
|
577
|
+
model?: string | undefined;
|
|
578
|
+
} | undefined;
|
|
566
579
|
bedrock?: {
|
|
567
580
|
model?: string | undefined;
|
|
568
581
|
region?: string | undefined;
|
|
@@ -570,16 +583,13 @@ declare const ConfigSchema: z.ZodObject<{
|
|
|
570
583
|
secretAccessKey?: string | undefined;
|
|
571
584
|
sessionToken?: string | undefined;
|
|
572
585
|
} | undefined;
|
|
573
|
-
|
|
574
|
-
apiKey?: string | undefined;
|
|
575
|
-
model?: string | undefined;
|
|
576
|
-
} | undefined;
|
|
577
|
-
openai?: {
|
|
586
|
+
azure?: {
|
|
578
587
|
apiKey?: string | undefined;
|
|
579
|
-
baseURL?: string | undefined;
|
|
580
588
|
model?: string | undefined;
|
|
589
|
+
endpoint?: string | undefined;
|
|
590
|
+
deploymentId?: string | undefined;
|
|
581
591
|
} | undefined;
|
|
582
|
-
|
|
592
|
+
huggingface?: {
|
|
583
593
|
apiKey?: string | undefined;
|
|
584
594
|
model?: string | undefined;
|
|
585
595
|
} | undefined;
|
|
@@ -588,22 +598,12 @@ declare const ConfigSchema: z.ZodObject<{
|
|
|
588
598
|
model?: string | undefined;
|
|
589
599
|
baseUrl?: string | undefined;
|
|
590
600
|
} | undefined;
|
|
591
|
-
azure?: {
|
|
592
|
-
apiKey?: string | undefined;
|
|
593
|
-
model?: string | undefined;
|
|
594
|
-
endpoint?: string | undefined;
|
|
595
|
-
deploymentId?: string | undefined;
|
|
596
|
-
} | undefined;
|
|
597
|
-
huggingface?: {
|
|
598
|
-
apiKey?: string | undefined;
|
|
599
|
-
model?: string | undefined;
|
|
600
|
-
} | undefined;
|
|
601
601
|
mistral?: {
|
|
602
602
|
apiKey?: string | undefined;
|
|
603
603
|
model?: string | undefined;
|
|
604
604
|
} | undefined;
|
|
605
605
|
} | undefined;
|
|
606
|
-
defaultProvider?: "
|
|
606
|
+
defaultProvider?: "openai" | "anthropic" | "vertex" | "google-ai" | "bedrock" | "azure" | "huggingface" | "ollama" | "mistral" | "auto" | undefined;
|
|
607
607
|
profiles?: Record<string, any> | undefined;
|
|
608
608
|
preferences?: {
|
|
609
609
|
maxTokens?: number | undefined;
|
|
@@ -4,7 +4,7 @@
|
|
|
4
4
|
* Provides interactive configuration wizard with provider selection,
|
|
5
5
|
* credential collection, testing, and environment file management.
|
|
6
6
|
*/
|
|
7
|
-
import { AIProviderName } from "../../lib/
|
|
7
|
+
import { AIProviderName } from "../../lib/types/index.js";
|
|
8
8
|
export interface ProviderConfig {
|
|
9
9
|
id: AIProviderName;
|
|
10
10
|
name: string;
|
|
@@ -4,7 +4,7 @@
|
|
|
4
4
|
* Provides interactive configuration wizard with provider selection,
|
|
5
5
|
* credential collection, testing, and environment file management.
|
|
6
6
|
*/
|
|
7
|
-
import { AIProviderName } from "../../lib/
|
|
7
|
+
import { AIProviderName } from "../../lib/types/index.js";
|
|
8
8
|
import { NeuroLink } from "../../lib/neurolink.js";
|
|
9
9
|
import chalk from "chalk";
|
|
10
10
|
import ora from "ora";
|
package/dist/core/analytics.d.ts
CHANGED
|
@@ -4,8 +4,7 @@
|
|
|
4
4
|
* Provides lightweight analytics tracking for AI provider usage,
|
|
5
5
|
* including tokens, costs, performance metrics, and custom context.
|
|
6
6
|
*/
|
|
7
|
-
import type { AnalyticsData } from "../types/
|
|
8
|
-
export type { AnalyticsData, TokenUsage } from "../types/providers.js";
|
|
7
|
+
import type { AnalyticsData } from "../types/analytics.js";
|
|
9
8
|
/**
|
|
10
9
|
* Create analytics data structure from AI response
|
|
11
10
|
*/
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import type { ValidationSchema } from "../types/typeAliases.js";
|
|
2
2
|
import type { Tool, LanguageModelV1 } from "ai";
|
|
3
|
-
import type { AIProvider, TextGenerationOptions, TextGenerationResult, EnhancedGenerateResult, AnalyticsData, AIProviderName } from "../
|
|
3
|
+
import type { AIProvider, TextGenerationOptions, TextGenerationResult, EnhancedGenerateResult, AnalyticsData, AIProviderName } from "../types/index.js";
|
|
4
4
|
import type { EvaluationData } from "../index.js";
|
|
5
5
|
import type { MiddlewareFactoryOptions } from "../types/middlewareTypes.js";
|
|
6
6
|
import type { StreamOptions, StreamResult } from "../types/streamTypes.js";
|
|
@@ -37,6 +37,8 @@ export declare abstract class BaseProvider implements AIProvider {
|
|
|
37
37
|
/**
|
|
38
38
|
* Text generation method - implements AIProvider interface
|
|
39
39
|
* Tools are always available unless explicitly disabled
|
|
40
|
+
* IMPLEMENTATION NOTE: Uses streamText() under the hood and accumulates results
|
|
41
|
+
* for consistency and better performance
|
|
40
42
|
*/
|
|
41
43
|
generate(optionsOrPrompt: TextGenerationOptions | string, _analysisSchema?: ValidationSchema): Promise<EnhancedGenerateResult | null>;
|
|
42
44
|
/**
|
|
@@ -110,6 +112,10 @@ export declare abstract class BaseProvider implements AIProvider {
|
|
|
110
112
|
* MCP tools are added when available (without blocking)
|
|
111
113
|
*/
|
|
112
114
|
protected getAllTools(): Promise<Record<string, Tool>>;
|
|
115
|
+
/**
|
|
116
|
+
* Calculate actual cost based on token usage and provider configuration
|
|
117
|
+
*/
|
|
118
|
+
private calculateActualCost;
|
|
113
119
|
/**
|
|
114
120
|
* Convert MCP JSON Schema to Zod schema for AI SDK tools
|
|
115
121
|
* Handles common MCP schema patterns safely
|
|
@@ -10,6 +10,7 @@ import { getKeysAsString, getKeyCount } from "../utils/transformationUtils.js";
|
|
|
10
10
|
import { validateStreamOptions as validateStreamOpts, validateTextGenerationOptions, ValidationError, createValidationSummary, } from "../utils/parameterValidation.js";
|
|
11
11
|
import { recordProviderPerformanceFromMetrics, getPerformanceOptimizedProvider, } from "./evaluationProviders.js";
|
|
12
12
|
import { modelConfig } from "./modelConfiguration.js";
|
|
13
|
+
// Provider types moved to ../types/providers.js
|
|
13
14
|
/**
|
|
14
15
|
* Abstract base class for all AI providers
|
|
15
16
|
* Tools are integrated as first-class citizens - always available by default
|
|
@@ -146,6 +147,8 @@ export class BaseProvider {
|
|
|
146
147
|
/**
|
|
147
148
|
* Text generation method - implements AIProvider interface
|
|
148
149
|
* Tools are always available unless explicitly disabled
|
|
150
|
+
* IMPLEMENTATION NOTE: Uses streamText() under the hood and accumulates results
|
|
151
|
+
* for consistency and better performance
|
|
149
152
|
*/
|
|
150
153
|
async generate(optionsOrPrompt, _analysisSchema) {
|
|
151
154
|
const options = this.normalizeTextOptions(optionsOrPrompt);
|
|
@@ -153,8 +156,9 @@ export class BaseProvider {
|
|
|
153
156
|
this.validateOptions(options);
|
|
154
157
|
const startTime = Date.now();
|
|
155
158
|
try {
|
|
156
|
-
// Import
|
|
157
|
-
|
|
159
|
+
// Import streamText dynamically to avoid circular dependencies
|
|
160
|
+
// Using streamText instead of generateText for unified implementation
|
|
161
|
+
const { streamText } = await import("ai");
|
|
158
162
|
// Get ALL available tools (direct + MCP + external from options)
|
|
159
163
|
const shouldUseTools = !options.disableTools && this.supportsTools();
|
|
160
164
|
const baseTools = shouldUseTools ? await this.getAllTools() : {};
|
|
@@ -175,7 +179,8 @@ export class BaseProvider {
|
|
|
175
179
|
const model = await this.getAISDKModelWithMiddleware(options);
|
|
176
180
|
// Build proper message array with conversation history
|
|
177
181
|
const messages = buildMessagesArray(options);
|
|
178
|
-
|
|
182
|
+
// Use streamText and accumulate results instead of generateText
|
|
183
|
+
const streamResult = await streamText({
|
|
179
184
|
model,
|
|
180
185
|
messages: messages,
|
|
181
186
|
tools,
|
|
@@ -184,31 +189,30 @@ export class BaseProvider {
|
|
|
184
189
|
temperature: options.temperature,
|
|
185
190
|
maxTokens: options.maxTokens || 8192,
|
|
186
191
|
});
|
|
192
|
+
// Accumulate the streamed content
|
|
193
|
+
let accumulatedContent = "";
|
|
194
|
+
// Wait for the stream to complete and accumulate content
|
|
195
|
+
for await (const chunk of streamResult.textStream) {
|
|
196
|
+
accumulatedContent += chunk;
|
|
197
|
+
}
|
|
198
|
+
// Get the final result - this should include usage, toolCalls, etc.
|
|
199
|
+
const usage = await streamResult.usage;
|
|
200
|
+
const toolCalls = await streamResult.toolCalls;
|
|
201
|
+
const toolResults = await streamResult.toolResults;
|
|
187
202
|
const responseTime = Date.now() - startTime;
|
|
203
|
+
// Create a result object compatible with generateText format
|
|
204
|
+
const result = {
|
|
205
|
+
text: accumulatedContent,
|
|
206
|
+
usage: usage,
|
|
207
|
+
toolCalls: toolCalls,
|
|
208
|
+
toolResults: toolResults,
|
|
209
|
+
steps: streamResult.steps, // Include steps for tool execution tracking
|
|
210
|
+
};
|
|
188
211
|
try {
|
|
189
|
-
|
|
190
|
-
const calculateActualCost = () => {
|
|
191
|
-
try {
|
|
192
|
-
const costInfo = modelConfig.getCostInfo(this.providerName, this.modelName);
|
|
193
|
-
if (!costInfo) {
|
|
194
|
-
return 0; // No cost info available
|
|
195
|
-
}
|
|
196
|
-
const promptTokens = result.usage?.promptTokens || 0;
|
|
197
|
-
const completionTokens = result.usage?.completionTokens || 0;
|
|
198
|
-
// Calculate cost per 1K tokens
|
|
199
|
-
const inputCost = (promptTokens / 1000) * costInfo.input;
|
|
200
|
-
const outputCost = (completionTokens / 1000) * costInfo.output;
|
|
201
|
-
return inputCost + outputCost;
|
|
202
|
-
}
|
|
203
|
-
catch (error) {
|
|
204
|
-
logger.debug(`Cost calculation failed for ${this.providerName}:`, error);
|
|
205
|
-
return 0; // Fallback to 0 on any error
|
|
206
|
-
}
|
|
207
|
-
};
|
|
208
|
-
const actualCost = calculateActualCost();
|
|
212
|
+
const actualCost = await this.calculateActualCost(usage || { promptTokens: 0, completionTokens: 0, totalTokens: 0 });
|
|
209
213
|
recordProviderPerformanceFromMetrics(this.providerName, {
|
|
210
214
|
responseTime,
|
|
211
|
-
tokensGenerated:
|
|
215
|
+
tokensGenerated: usage?.totalTokens || 0,
|
|
212
216
|
cost: actualCost,
|
|
213
217
|
success: true,
|
|
214
218
|
});
|
|
@@ -216,7 +220,7 @@ export class BaseProvider {
|
|
|
216
220
|
const optimizedProvider = getPerformanceOptimizedProvider("speed");
|
|
217
221
|
logger.debug(`🚀 Performance recorded for ${this.providerName}:`, {
|
|
218
222
|
responseTime: `${responseTime}ms`,
|
|
219
|
-
tokens:
|
|
223
|
+
tokens: usage?.totalTokens || 0,
|
|
220
224
|
estimatedCost: `$${actualCost.toFixed(6)}`,
|
|
221
225
|
recommendedSpeedProvider: optimizedProvider?.provider || "none",
|
|
222
226
|
});
|
|
@@ -228,11 +232,9 @@ export class BaseProvider {
|
|
|
228
232
|
// AI SDK puts tool calls in steps array for multi-step generation
|
|
229
233
|
const toolsUsed = [];
|
|
230
234
|
// First check direct tool calls (fallback)
|
|
231
|
-
if (
|
|
232
|
-
toolsUsed.push(...
|
|
233
|
-
return
|
|
234
|
-
tc.name ||
|
|
235
|
-
"unknown");
|
|
235
|
+
if (toolCalls && toolCalls.length > 0) {
|
|
236
|
+
toolsUsed.push(...toolCalls.map((tc) => {
|
|
237
|
+
return tc.toolName || "unknown";
|
|
236
238
|
}));
|
|
237
239
|
}
|
|
238
240
|
// Then check steps for tool calls (primary source for multi-step)
|
|
@@ -326,20 +328,14 @@ export class BaseProvider {
|
|
|
326
328
|
},
|
|
327
329
|
provider: this.providerName,
|
|
328
330
|
model: this.modelName,
|
|
329
|
-
toolCalls:
|
|
330
|
-
?
|
|
331
|
-
toolCallId: tc.toolCallId ||
|
|
332
|
-
|
|
333
|
-
|
|
334
|
-
toolName: tc.toolName ||
|
|
335
|
-
tc.name ||
|
|
336
|
-
"unknown",
|
|
337
|
-
args: tc.args ||
|
|
338
|
-
tc.parameters ||
|
|
339
|
-
{},
|
|
331
|
+
toolCalls: toolCalls
|
|
332
|
+
? toolCalls.map((tc) => ({
|
|
333
|
+
toolCallId: tc.toolCallId || "unknown",
|
|
334
|
+
toolName: tc.toolName || "unknown",
|
|
335
|
+
args: tc.args || {},
|
|
340
336
|
}))
|
|
341
337
|
: [],
|
|
342
|
-
toolResults:
|
|
338
|
+
toolResults: toolResults || [],
|
|
343
339
|
toolsUsed: uniqueToolsUsed,
|
|
344
340
|
toolExecutions, // ✅ Add extracted tool executions
|
|
345
341
|
availableTools: Object.keys(tools).map((name) => {
|
|
@@ -655,6 +651,27 @@ export class BaseProvider {
|
|
|
655
651
|
logger.debug(`[BaseProvider] getAllTools returning tools: ${getKeysAsString(tools)}`);
|
|
656
652
|
return tools;
|
|
657
653
|
}
|
|
654
|
+
/**
|
|
655
|
+
* Calculate actual cost based on token usage and provider configuration
|
|
656
|
+
*/
|
|
657
|
+
async calculateActualCost(usage) {
|
|
658
|
+
try {
|
|
659
|
+
const costInfo = modelConfig.getCostInfo(this.providerName, this.modelName);
|
|
660
|
+
if (!costInfo) {
|
|
661
|
+
return 0; // No cost info available
|
|
662
|
+
}
|
|
663
|
+
const promptTokens = usage?.promptTokens || 0;
|
|
664
|
+
const completionTokens = usage?.completionTokens || 0;
|
|
665
|
+
// Calculate cost per 1K tokens
|
|
666
|
+
const inputCost = (promptTokens / 1000) * costInfo.input;
|
|
667
|
+
const outputCost = (completionTokens / 1000) * costInfo.output;
|
|
668
|
+
return inputCost + outputCost;
|
|
669
|
+
}
|
|
670
|
+
catch (error) {
|
|
671
|
+
logger.debug(`Cost calculation failed for ${this.providerName}:`, error);
|
|
672
|
+
return 0; // Fallback to 0 on any error
|
|
673
|
+
}
|
|
674
|
+
}
|
|
658
675
|
/**
|
|
659
676
|
* Convert MCP JSON Schema to Zod schema for AI SDK tools
|
|
660
677
|
* Handles common MCP schema patterns safely
|