@juspay/neurolink 7.33.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 +2 -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 +1 -1
- package/dist/core/baseProvider.js +1 -0
- 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 +1 -1
- package/dist/lib/core/baseProvider.js +1 -0
- 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/dist/lib/core/factory.js
CHANGED
|
@@ -4,7 +4,7 @@
|
|
|
4
4
|
* Replaces hardcoded model-specific logic with configurable, runtime-updateable configurations.
|
|
5
5
|
* This addresses GitHub Copilot review comment about making model-specific logic configuration-based.
|
|
6
6
|
*/
|
|
7
|
-
import type {
|
|
7
|
+
import type { ModelTier, ProviderConfiguration, ConfigSource } from "../types/modelTypes.js";
|
|
8
8
|
/**
|
|
9
9
|
* Model name constants - extracted from hardcoded values for better maintainability
|
|
10
10
|
* These constants can be overridden by environment variables
|
|
@@ -61,67 +61,6 @@ export declare const MODEL_NAMES: {
|
|
|
61
61
|
readonly QUALITY: "mistral-large-latest";
|
|
62
62
|
};
|
|
63
63
|
};
|
|
64
|
-
/**
|
|
65
|
-
* Model performance tier definition
|
|
66
|
-
*/
|
|
67
|
-
export type ModelTier = "fast" | "balanced" | "quality";
|
|
68
|
-
/**
|
|
69
|
-
* Model configuration for a specific provider
|
|
70
|
-
*/
|
|
71
|
-
export interface ModelConfig {
|
|
72
|
-
/** Model identifier */
|
|
73
|
-
id: string;
|
|
74
|
-
/** Display name */
|
|
75
|
-
name: string;
|
|
76
|
-
/** Performance tier */
|
|
77
|
-
tier: ModelTier;
|
|
78
|
-
/** Cost per 1K tokens */
|
|
79
|
-
cost: {
|
|
80
|
-
input: number;
|
|
81
|
-
output: number;
|
|
82
|
-
};
|
|
83
|
-
/** Model capabilities */
|
|
84
|
-
capabilities: string[];
|
|
85
|
-
/** Model-specific options */
|
|
86
|
-
options?: Record<string, JsonValue>;
|
|
87
|
-
}
|
|
88
|
-
/**
|
|
89
|
-
* Provider configuration with models
|
|
90
|
-
*/
|
|
91
|
-
export interface ProviderConfig {
|
|
92
|
-
/** Provider name */
|
|
93
|
-
provider: string;
|
|
94
|
-
/** Available models by tier */
|
|
95
|
-
models: Record<ModelTier, string>;
|
|
96
|
-
/** Default cost per token (fallback) */
|
|
97
|
-
defaultCost: {
|
|
98
|
-
input: number;
|
|
99
|
-
output: number;
|
|
100
|
-
};
|
|
101
|
-
/** Required environment variables */
|
|
102
|
-
requiredEnvVars: string[];
|
|
103
|
-
/** Provider-specific performance metrics */
|
|
104
|
-
performance: {
|
|
105
|
-
speed: number;
|
|
106
|
-
quality: number;
|
|
107
|
-
cost: number;
|
|
108
|
-
};
|
|
109
|
-
/** Provider-specific model configurations */
|
|
110
|
-
modelConfigs?: Record<string, ModelConfig>;
|
|
111
|
-
/** Provider-specific model behavior configurations */
|
|
112
|
-
modelBehavior?: {
|
|
113
|
-
/** Models that have issues with maxTokens parameter */
|
|
114
|
-
maxTokensIssues?: string[];
|
|
115
|
-
/** Models that require special handling */
|
|
116
|
-
specialHandling?: Record<string, JsonValue>;
|
|
117
|
-
/** Models that support tool calling (Ollama-specific) */
|
|
118
|
-
toolCapableModels?: string[];
|
|
119
|
-
};
|
|
120
|
-
}
|
|
121
|
-
/**
|
|
122
|
-
* Configuration source type
|
|
123
|
-
*/
|
|
124
|
-
export type ConfigSource = "default" | "environment" | "file" | "dynamic";
|
|
125
64
|
/**
|
|
126
65
|
* Model configuration manager
|
|
127
66
|
*/
|
|
@@ -147,7 +86,7 @@ export declare class ModelConfigurationManager {
|
|
|
147
86
|
/**
|
|
148
87
|
* Create all provider configurations - centralized approach
|
|
149
88
|
*/
|
|
150
|
-
private
|
|
89
|
+
private createAllProviderConfigurations;
|
|
151
90
|
/**
|
|
152
91
|
* Create Anthropic provider configuration
|
|
153
92
|
*/
|
|
@@ -209,15 +148,15 @@ export declare class ModelConfigurationManager {
|
|
|
209
148
|
/**
|
|
210
149
|
* Get provider configuration
|
|
211
150
|
*/
|
|
212
|
-
|
|
151
|
+
getProviderConfiguration(provider: string): ProviderConfiguration | null;
|
|
213
152
|
/**
|
|
214
153
|
* Get all provider configurations
|
|
215
154
|
*/
|
|
216
|
-
getAllConfigurations(): Map<string,
|
|
155
|
+
getAllConfigurations(): Map<string, ProviderConfiguration>;
|
|
217
156
|
/**
|
|
218
157
|
* Update provider configuration (runtime updates)
|
|
219
158
|
*/
|
|
220
|
-
|
|
159
|
+
updateProviderConfiguration(provider: string, config: ProviderConfiguration): void;
|
|
221
160
|
/**
|
|
222
161
|
* Parse YAML content with basic support
|
|
223
162
|
* For full YAML support, would need a proper YAML library
|
|
@@ -244,7 +183,7 @@ export declare class ModelConfigurationManager {
|
|
|
244
183
|
/**
|
|
245
184
|
* Validate provider configuration structure
|
|
246
185
|
*/
|
|
247
|
-
private
|
|
186
|
+
private isValidProviderConfiguration;
|
|
248
187
|
/**
|
|
249
188
|
* Apply model name overrides from configuration file
|
|
250
189
|
*/
|
|
@@ -279,7 +218,7 @@ export declare class ModelConfigurationManager {
|
|
|
279
218
|
/**
|
|
280
219
|
* Get available providers
|
|
281
220
|
*/
|
|
282
|
-
getAvailableProviders():
|
|
221
|
+
getAvailableProviders(): ProviderConfiguration[];
|
|
283
222
|
}
|
|
284
223
|
/**
|
|
285
224
|
* Global instance accessor
|
|
@@ -291,7 +230,7 @@ export declare const modelConfig: ModelConfigurationManager;
|
|
|
291
230
|
/**
|
|
292
231
|
* Get provider configuration (backwards compatible)
|
|
293
232
|
*/
|
|
294
|
-
export declare function
|
|
233
|
+
export declare function getProviderConfiguration(provider: string): ProviderConfiguration | null;
|
|
295
234
|
/**
|
|
296
235
|
* Get model for tier (backwards compatible)
|
|
297
236
|
*/
|
|
@@ -175,7 +175,7 @@ export class ModelConfigurationManager {
|
|
|
175
175
|
/**
|
|
176
176
|
* Create all provider configurations - centralized approach
|
|
177
177
|
*/
|
|
178
|
-
|
|
178
|
+
createAllProviderConfigurations() {
|
|
179
179
|
return {
|
|
180
180
|
"google-ai": this.createGoogleAIConfig(),
|
|
181
181
|
"google-vertex": this.createVertexConfig(),
|
|
@@ -383,7 +383,7 @@ export class ModelConfigurationManager {
|
|
|
383
383
|
*/
|
|
384
384
|
loadDefaultConfigurations() {
|
|
385
385
|
// Load all provider configurations using centralized method
|
|
386
|
-
const defaultConfigs = this.
|
|
386
|
+
const defaultConfigs = this.createAllProviderConfigurations();
|
|
387
387
|
// Load configurations
|
|
388
388
|
for (const [provider, config] of Object.entries(defaultConfigs)) {
|
|
389
389
|
this.configurations.set(provider, config);
|
|
@@ -484,7 +484,7 @@ export class ModelConfigurationManager {
|
|
|
484
484
|
/**
|
|
485
485
|
* Get provider configuration
|
|
486
486
|
*/
|
|
487
|
-
|
|
487
|
+
getProviderConfiguration(provider) {
|
|
488
488
|
return this.configurations.get(provider) || null;
|
|
489
489
|
}
|
|
490
490
|
/**
|
|
@@ -496,7 +496,7 @@ export class ModelConfigurationManager {
|
|
|
496
496
|
/**
|
|
497
497
|
* Update provider configuration (runtime updates)
|
|
498
498
|
*/
|
|
499
|
-
|
|
499
|
+
updateProviderConfiguration(provider, config) {
|
|
500
500
|
this.configurations.set(provider, config);
|
|
501
501
|
this.lastUpdated = Date.now();
|
|
502
502
|
this.configSource = "dynamic";
|
|
@@ -596,7 +596,7 @@ export class ModelConfigurationManager {
|
|
|
596
596
|
if (config.providers && typeof config.providers === "object") {
|
|
597
597
|
const providers = config.providers;
|
|
598
598
|
for (const [providerName, providerConfig] of Object.entries(providers)) {
|
|
599
|
-
if (this.
|
|
599
|
+
if (this.isValidProviderConfiguration(providerConfig)) {
|
|
600
600
|
this.configurations.set(providerName, providerConfig);
|
|
601
601
|
logger.debug(`Loaded configuration for provider: ${providerName}`);
|
|
602
602
|
}
|
|
@@ -629,7 +629,7 @@ export class ModelConfigurationManager {
|
|
|
629
629
|
/**
|
|
630
630
|
* Validate provider configuration structure
|
|
631
631
|
*/
|
|
632
|
-
|
|
632
|
+
isValidProviderConfiguration(config) {
|
|
633
633
|
if (!config || typeof config !== "object") {
|
|
634
634
|
return false;
|
|
635
635
|
}
|
|
@@ -769,14 +769,14 @@ export class ModelConfigurationManager {
|
|
|
769
769
|
* Get model for specific tier and provider
|
|
770
770
|
*/
|
|
771
771
|
getModelForTier(provider, tier) {
|
|
772
|
-
const config = this.
|
|
772
|
+
const config = this.getProviderConfiguration(provider);
|
|
773
773
|
return config?.models[tier] || null;
|
|
774
774
|
}
|
|
775
775
|
/**
|
|
776
776
|
* Get cost information for provider and model
|
|
777
777
|
*/
|
|
778
778
|
getCostInfo(provider, model) {
|
|
779
|
-
const config = this.
|
|
779
|
+
const config = this.getProviderConfiguration(provider);
|
|
780
780
|
if (!config) {
|
|
781
781
|
return null;
|
|
782
782
|
}
|
|
@@ -790,7 +790,7 @@ export class ModelConfigurationManager {
|
|
|
790
790
|
* Check if provider is available (has required environment variables)
|
|
791
791
|
*/
|
|
792
792
|
isProviderAvailable(provider) {
|
|
793
|
-
const config = this.
|
|
793
|
+
const config = this.getProviderConfiguration(provider);
|
|
794
794
|
if (!config) {
|
|
795
795
|
return false;
|
|
796
796
|
}
|
|
@@ -816,8 +816,8 @@ export const modelConfig = ModelConfigurationManager.getInstance();
|
|
|
816
816
|
/**
|
|
817
817
|
* Get provider configuration (backwards compatible)
|
|
818
818
|
*/
|
|
819
|
-
export function
|
|
820
|
-
return modelConfig.
|
|
819
|
+
export function getProviderConfiguration(provider) {
|
|
820
|
+
return modelConfig.getProviderConfiguration(provider);
|
|
821
821
|
}
|
|
822
822
|
/**
|
|
823
823
|
* Get model for tier (backwards compatible)
|
|
@@ -2,14 +2,7 @@
|
|
|
2
2
|
* Service Registry for Dependency Injection
|
|
3
3
|
* Breaks circular dependencies by providing lazy loading and centralized service management
|
|
4
4
|
*/
|
|
5
|
-
|
|
6
|
-
(): T | Promise<T>;
|
|
7
|
-
}
|
|
8
|
-
export interface ServiceRegistration<T = unknown> {
|
|
9
|
-
factory: ServiceFactory<T>;
|
|
10
|
-
singleton: boolean;
|
|
11
|
-
instance?: T;
|
|
12
|
-
}
|
|
5
|
+
import type { ServiceFactory } from "../types/serviceTypes.js";
|
|
13
6
|
export declare class ServiceRegistry {
|
|
14
7
|
private static services;
|
|
15
8
|
private static initializing;
|
|
@@ -1,47 +1,5 @@
|
|
|
1
|
-
import type { AnalyticsData } from "
|
|
2
|
-
import type {
|
|
3
|
-
import type { ToolCall, ToolResult } from "../types/streamTypes.js";
|
|
4
|
-
/**
|
|
5
|
-
* Raw usage data from Vercel AI SDK (uses different field names)
|
|
6
|
-
*/
|
|
7
|
-
interface AISDKUsage {
|
|
8
|
-
promptTokens: number;
|
|
9
|
-
completionTokens: number;
|
|
10
|
-
totalTokens: number;
|
|
11
|
-
}
|
|
12
|
-
/**
|
|
13
|
-
* Stream analytics result from Vercel AI SDK streamText
|
|
14
|
-
*/
|
|
15
|
-
export interface StreamTextResult {
|
|
16
|
-
textStream: AsyncIterable<string>;
|
|
17
|
-
text: Promise<string>;
|
|
18
|
-
usage: Promise<AISDKUsage | undefined>;
|
|
19
|
-
response: Promise<{
|
|
20
|
-
id?: string;
|
|
21
|
-
model?: string;
|
|
22
|
-
timestamp?: number | Date;
|
|
23
|
-
} | undefined>;
|
|
24
|
-
finishReason: Promise<"stop" | "length" | "content-filter" | "tool-calls" | "error" | "other" | "unknown">;
|
|
25
|
-
toolResults?: Promise<ToolResult[]>;
|
|
26
|
-
toolCalls?: Promise<ToolCall[]>;
|
|
27
|
-
}
|
|
28
|
-
/**
|
|
29
|
-
* Interface for collecting analytics from streaming results
|
|
30
|
-
*/
|
|
31
|
-
export interface StreamAnalyticsCollector {
|
|
32
|
-
collectUsage(result: StreamTextResult): Promise<TokenUsage>;
|
|
33
|
-
collectMetadata(result: StreamTextResult): Promise<ResponseMetadata>;
|
|
34
|
-
createAnalytics(provider: string, model: string, result: StreamTextResult, responseTime: number, metadata?: Record<string, unknown>): Promise<AnalyticsData>;
|
|
35
|
-
}
|
|
36
|
-
/**
|
|
37
|
-
* Response metadata from stream result
|
|
38
|
-
*/
|
|
39
|
-
export interface ResponseMetadata {
|
|
40
|
-
id?: string;
|
|
41
|
-
model?: string;
|
|
42
|
-
timestamp?: number;
|
|
43
|
-
finishReason?: string;
|
|
44
|
-
}
|
|
1
|
+
import type { AnalyticsData, TokenUsage } from "../types/analytics.js";
|
|
2
|
+
import type { StreamTextResult, StreamAnalyticsCollector, ResponseMetadata } from "../types/streamTypes.js";
|
|
45
3
|
/**
|
|
46
4
|
* Base implementation for collecting analytics from Vercel AI SDK stream results
|
|
47
5
|
*/
|
|
@@ -67,4 +25,3 @@ export declare class BaseStreamAnalyticsCollector implements StreamAnalyticsColl
|
|
|
67
25
|
* Global instance of stream analytics collector
|
|
68
26
|
*/
|
|
69
27
|
export declare const streamAnalyticsCollector: BaseStreamAnalyticsCollector;
|
|
70
|
-
export {};
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type { AIProvider, AIProviderName } from "../
|
|
1
|
+
import type { AIProvider, AIProviderName } from "../types/index.js";
|
|
2
2
|
import type { UnknownRecord } from "../types/common.js";
|
|
3
3
|
/**
|
|
4
4
|
* Provider constructor interface - supports both sync constructors and async factory functions
|
|
@@ -2,7 +2,7 @@ import { ProviderFactory } from "./providerFactory.js";
|
|
|
2
2
|
// Lazy loading all providers to avoid circular dependencies
|
|
3
3
|
// Removed all static imports - providers loaded dynamically when needed
|
|
4
4
|
// This breaks the circular dependency chain completely
|
|
5
|
-
import { AIProviderName, GoogleAIModels, OpenAIModels } from "../
|
|
5
|
+
import { AIProviderName, GoogleAIModels, OpenAIModels, } from "../types/index.js";
|
|
6
6
|
import { logger } from "../utils/logger.js";
|
|
7
7
|
/**
|
|
8
8
|
* Provider Registry - registers all providers with the factory
|
package/dist/lib/index.d.ts
CHANGED
|
@@ -8,15 +8,15 @@
|
|
|
8
8
|
*/
|
|
9
9
|
import { AIProviderFactory } from "./core/factory.js";
|
|
10
10
|
export { AIProviderFactory };
|
|
11
|
-
export type { AIProvider, AIProviderName, ProviderConfig, StreamingOptions, ProviderAttempt, SupportedModelName, } from "./
|
|
11
|
+
export type { AIProvider, AIProviderName, ProviderConfig, StreamingOptions, ProviderAttempt, SupportedModelName, } from "./types/index.js";
|
|
12
12
|
export type { GenerateOptions, GenerateResult, EnhancedProvider, } from "./types/generateTypes.js";
|
|
13
13
|
export type { ToolContext } from "./sdk/toolRegistration.js";
|
|
14
14
|
export { validateTool } from "./sdk/toolRegistration.js";
|
|
15
15
|
export type { ToolResult, ToolDefinition } from "./types/tools.js";
|
|
16
|
-
export { BedrockModels, OpenAIModels, VertexModels, DEFAULT_PROVIDER_CONFIGS, } from "./
|
|
16
|
+
export { BedrockModels, OpenAIModels, VertexModels, DEFAULT_PROVIDER_CONFIGS, } from "./types/index.js";
|
|
17
17
|
export { getBestProvider, getAvailableProviders, isValidProvider, } from "./utils/providerUtils.js";
|
|
18
18
|
export { dynamicModelProvider } from "./core/dynamicModels.js";
|
|
19
|
-
export type {
|
|
19
|
+
export type { DynamicModelConfig, ModelRegistry } from "./types/modelTypes.js";
|
|
20
20
|
export { NeuroLink } from "./neurolink.js";
|
|
21
21
|
export type { ProviderStatus, MCPStatus } from "./neurolink.js";
|
|
22
22
|
export type { MCPServerInfo } from "./types/mcpTypes.js";
|
|
@@ -85,8 +85,7 @@ export declare function getTelemetryStatus(): {
|
|
|
85
85
|
enabled: boolean;
|
|
86
86
|
initialized: boolean;
|
|
87
87
|
};
|
|
88
|
-
export type { TextGenerationOptions, TextGenerationResult, AnalyticsData, } from "./
|
|
89
|
-
export type { EvaluationData } from "./types/providers.js";
|
|
88
|
+
export type { TextGenerationOptions, TextGenerationResult, AnalyticsData, EvaluationData, } from "./types/index.js";
|
|
90
89
|
/**
|
|
91
90
|
* BACKWARD COMPATIBILITY: Legacy generateText function
|
|
92
91
|
* Provides standalone generateText function for existing code that uses it
|
|
@@ -103,4 +102,4 @@ export type { EvaluationData } from "./types/providers.js";
|
|
|
103
102
|
* console.log(result.content);
|
|
104
103
|
* ```
|
|
105
104
|
*/
|
|
106
|
-
export declare function generateText(options: import("./
|
|
105
|
+
export declare function generateText(options: import("./types/index.js").TextGenerationOptions): Promise<import("./types/index.js").TextGenerationResult>;
|
package/dist/lib/index.js
CHANGED
|
@@ -11,7 +11,7 @@ import { AIProviderFactory } from "./core/factory.js";
|
|
|
11
11
|
export { AIProviderFactory };
|
|
12
12
|
export { validateTool } from "./sdk/toolRegistration.js";
|
|
13
13
|
// Model enums
|
|
14
|
-
export { BedrockModels, OpenAIModels, VertexModels, DEFAULT_PROVIDER_CONFIGS, } from "./
|
|
14
|
+
export { BedrockModels, OpenAIModels, VertexModels, DEFAULT_PROVIDER_CONFIGS, } from "./types/index.js";
|
|
15
15
|
// Utility exports
|
|
16
16
|
export { getBestProvider, getAvailableProviders, isValidProvider, } from "./utils/providerUtils.js";
|
|
17
17
|
// Dynamic Models exports
|
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
* Provides centralized model data for models command system
|
|
4
4
|
* Part of Phase 4.1 - Models Command System
|
|
5
5
|
*/
|
|
6
|
-
import { AIProviderName } from "../
|
|
6
|
+
import { AIProviderName } from "../types/index.js";
|
|
7
7
|
import type { JsonValue } from "../types/common.js";
|
|
8
8
|
/**
|
|
9
9
|
* Model capabilities interface
|
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
* Provides model resolution, search, and recommendation functionality
|
|
4
4
|
* Part of Phase 4.1 - Models Command System
|
|
5
5
|
*/
|
|
6
|
-
import { AIProviderName } from "../
|
|
6
|
+
import { AIProviderName } from "../types/index.js";
|
|
7
7
|
import type { JsonValue } from "../types/common.js";
|
|
8
8
|
import { type ModelInfo, type ModelSearchFilters, type ModelSearchResult, type ModelCapabilities, type UseCaseSuitability } from "./modelRegistry.js";
|
|
9
9
|
/**
|
package/dist/lib/neurolink.d.ts
CHANGED
|
@@ -5,7 +5,7 @@
|
|
|
5
5
|
* Enhanced AI provider system with natural MCP tool access.
|
|
6
6
|
* Uses real MCP infrastructure for tool discovery and execution.
|
|
7
7
|
*/
|
|
8
|
-
import type { TextGenerationOptions, TextGenerationResult } from "./
|
|
8
|
+
import type { TextGenerationOptions, TextGenerationResult } from "./types/index.js";
|
|
9
9
|
import type { GenerateOptions, GenerateResult } from "./types/generateTypes.js";
|
|
10
10
|
import type { StreamOptions, StreamResult } from "./types/streamTypes.js";
|
|
11
11
|
import type { MCPServerInfo, MCPExecutableTool } from "./types/mcpTypes.js";
|
package/dist/lib/neurolink.js
CHANGED
|
@@ -36,7 +36,7 @@ import { ExternalServerManager } from "./mcp/externalServerManager.js";
|
|
|
36
36
|
// Import direct tools server for automatic registration
|
|
37
37
|
import { directToolsServer } from "./mcp/servers/agent/directToolsServer.js";
|
|
38
38
|
import { isNonNullObject } from "./utils/typeUtils.js";
|
|
39
|
-
// Core types imported from
|
|
39
|
+
// Core types imported from "./types/index.js"
|
|
40
40
|
export class NeuroLink {
|
|
41
41
|
mcpInitialized = false;
|
|
42
42
|
emitter = new EventEmitter();
|
|
@@ -1,8 +1,7 @@
|
|
|
1
1
|
import { BedrockRuntimeClient } from "@aws-sdk/client-bedrock-runtime";
|
|
2
2
|
import { BaseProvider } from "../core/baseProvider.js";
|
|
3
|
-
import type { AIProviderName, EnhancedGenerateResult } from "../
|
|
3
|
+
import type { AIProviderName, EnhancedGenerateResult, TextGenerationOptions } from "../types/index.js";
|
|
4
4
|
import type { StreamOptions, StreamResult } from "../types/streamTypes.js";
|
|
5
|
-
import type { TextGenerationOptions } from "../core/types.js";
|
|
6
5
|
import type { NeuroLink } from "../neurolink.js";
|
|
7
6
|
export declare class AmazonBedrockProvider extends BaseProvider {
|
|
8
7
|
private bedrockClient;
|
|
@@ -6,7 +6,7 @@
|
|
|
6
6
|
*/
|
|
7
7
|
import type { ZodType, ZodTypeDef } from "zod";
|
|
8
8
|
import type { Schema, LanguageModelV1 } from "ai";
|
|
9
|
-
import type { AIProviderName } from "../
|
|
9
|
+
import type { AIProviderName } from "../types/index.js";
|
|
10
10
|
import type { StreamOptions, StreamResult } from "../types/streamTypes.js";
|
|
11
11
|
import { BaseProvider } from "../core/baseProvider.js";
|
|
12
12
|
/**
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { type LanguageModelV1 } from "ai";
|
|
2
2
|
import type { ValidationSchema } from "../types/typeAliases.js";
|
|
3
|
-
import type { AIProviderName } from "../
|
|
3
|
+
import type { AIProviderName } from "../types/index.js";
|
|
4
4
|
import type { StreamOptions, StreamResult } from "../types/streamTypes.js";
|
|
5
5
|
import { BaseProvider } from "../core/baseProvider.js";
|
|
6
6
|
/**
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { createAnthropic } from "@ai-sdk/anthropic";
|
|
2
2
|
import { streamText } from "ai";
|
|
3
|
-
import { AnthropicModels } from "../
|
|
3
|
+
import { AnthropicModels } from "../types/index.js";
|
|
4
4
|
import { BaseProvider } from "../core/baseProvider.js";
|
|
5
5
|
import { logger } from "../utils/logger.js";
|
|
6
6
|
import { createTimeoutController, TimeoutError } from "../utils/timeout.js";
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import type { ZodType, ZodTypeDef } from "zod";
|
|
2
2
|
import { type Schema, type LanguageModelV1 } from "ai";
|
|
3
|
-
import type { AIProviderName } from "../
|
|
3
|
+
import type { AIProviderName } from "../types/index.js";
|
|
4
4
|
import type { StreamOptions, StreamResult } from "../types/streamTypes.js";
|
|
5
5
|
import { BaseProvider } from "../core/baseProvider.js";
|
|
6
6
|
/**
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { createAnthropic } from "@ai-sdk/anthropic";
|
|
2
2
|
import { streamText } from "ai";
|
|
3
|
-
import { AnthropicModels } from "../
|
|
3
|
+
import { AnthropicModels } from "../types/index.js";
|
|
4
4
|
import { BaseProvider } from "../core/baseProvider.js";
|
|
5
5
|
import { logger } from "../utils/logger.js";
|
|
6
6
|
import { createTimeoutController, TimeoutError } from "../utils/timeout.js";
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { type LanguageModelV1 } from "ai";
|
|
2
2
|
import { BaseProvider } from "../core/baseProvider.js";
|
|
3
|
-
import type { AIProviderName } from "../
|
|
3
|
+
import type { AIProviderName } from "../types/index.js";
|
|
4
4
|
import type { StreamOptions, StreamResult } from "../types/streamTypes.js";
|
|
5
5
|
export declare class AzureOpenAIProvider extends BaseProvider {
|
|
6
6
|
private apiKey;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { type Schema, type LanguageModelV1 } from "ai";
|
|
2
2
|
import type { ZodUnknownSchema } from "../types/typeAliases.js";
|
|
3
|
-
import type { AIProviderName } from "../
|
|
3
|
+
import type { AIProviderName } from "../types/index.js";
|
|
4
4
|
import type { StreamOptions, StreamResult } from "../types/streamTypes.js";
|
|
5
5
|
import { BaseProvider } from "../core/baseProvider.js";
|
|
6
6
|
/**
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { createGoogleGenerativeAI } from "@ai-sdk/google";
|
|
2
2
|
import { streamText } from "ai";
|
|
3
|
-
import { GoogleAIModels } from "../
|
|
3
|
+
import { GoogleAIModels } from "../types/index.js";
|
|
4
4
|
import { BaseProvider } from "../core/baseProvider.js";
|
|
5
5
|
import { logger } from "../utils/logger.js";
|
|
6
6
|
import { createTimeoutController, TimeoutError } from "../utils/timeout.js";
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import type { ZodType, ZodTypeDef } from "zod";
|
|
2
2
|
import { type Schema, type LanguageModelV1, type LanguageModel } from "ai";
|
|
3
|
-
import type { AIProviderName } from "../
|
|
3
|
+
import type { AIProviderName } from "../types/index.js";
|
|
4
4
|
import type { StreamOptions, StreamResult } from "../types/streamTypes.js";
|
|
5
5
|
import { BaseProvider } from "../core/baseProvider.js";
|
|
6
6
|
/**
|
|
@@ -1122,7 +1122,7 @@ export class GoogleVertexProvider extends BaseProvider {
|
|
|
1122
1122
|
// Cache expired, refresh it with memory management
|
|
1123
1123
|
GoogleVertexProvider.modelConfigCache.clear();
|
|
1124
1124
|
const config = ModelConfigurationManager.getInstance();
|
|
1125
|
-
const vertexConfig = config.
|
|
1125
|
+
const vertexConfig = config.getProviderConfiguration("google-vertex");
|
|
1126
1126
|
GoogleVertexProvider.modelConfigCache.set(cacheKey, vertexConfig);
|
|
1127
1127
|
GoogleVertexProvider.modelConfigCacheTime = now;
|
|
1128
1128
|
}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import type { ZodType, ZodTypeDef } from "zod";
|
|
2
2
|
import { type Schema, type LanguageModelV1 } from "ai";
|
|
3
|
-
import type { AIProviderName } from "../
|
|
3
|
+
import type { AIProviderName } from "../types/index.js";
|
|
4
4
|
import type { StreamOptions, StreamResult } from "../types/streamTypes.js";
|
|
5
5
|
import { BaseProvider } from "../core/baseProvider.js";
|
|
6
6
|
/**
|
|
@@ -14,7 +14,7 @@ export { HuggingFaceProvider as HuggingFace } from "./huggingFace.js";
|
|
|
14
14
|
export { OllamaProvider as Ollama } from "./ollama.js";
|
|
15
15
|
export { MistralProvider as MistralAI } from "./mistral.js";
|
|
16
16
|
export { LiteLLMProvider as LiteLLM } from "./litellm.js";
|
|
17
|
-
export type { AIProvider } from "../
|
|
17
|
+
export type { AIProvider } from "../types/index.js";
|
|
18
18
|
/**
|
|
19
19
|
* Provider registry for dynamic provider instantiation
|
|
20
20
|
*/
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import type { ZodType, ZodTypeDef } from "zod";
|
|
2
2
|
import { type Schema, type LanguageModelV1 } from "ai";
|
|
3
|
-
import type { AIProviderName } from "../
|
|
3
|
+
import type { AIProviderName } from "../types/index.js";
|
|
4
4
|
import type { StreamOptions, StreamResult } from "../types/streamTypes.js";
|
|
5
5
|
import { BaseProvider } from "../core/baseProvider.js";
|
|
6
6
|
/**
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { type LanguageModelV1 } from "ai";
|
|
2
2
|
import type { ValidationSchema } from "../types/typeAliases.js";
|
|
3
|
-
import type { AIProviderName } from "../
|
|
3
|
+
import type { AIProviderName } from "../types/index.js";
|
|
4
4
|
import type { StreamOptions, StreamResult } from "../types/streamTypes.js";
|
|
5
5
|
import { BaseProvider } from "../core/baseProvider.js";
|
|
6
6
|
/**
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type { AIProviderName } from "../
|
|
1
|
+
import type { AIProviderName } from "../types/index.js";
|
|
2
2
|
import type { LanguageModelV1 } from "ai";
|
|
3
3
|
import type { StreamOptions, StreamResult } from "../types/streamTypes.js";
|
|
4
4
|
import type { ZodUnknownSchema } from "../types/typeAliases.js";
|
|
@@ -273,7 +273,7 @@ export class OllamaProvider extends BaseProvider {
|
|
|
273
273
|
supportsTools() {
|
|
274
274
|
const modelName = this.modelName.toLowerCase();
|
|
275
275
|
// Get tool-capable models from configuration
|
|
276
|
-
const ollamaConfig = modelConfig.
|
|
276
|
+
const ollamaConfig = modelConfig.getProviderConfiguration("ollama");
|
|
277
277
|
const toolCapableModels = ollamaConfig?.modelBehavior?.toolCapableModels || [];
|
|
278
278
|
// Check if current model matches tool-capable model patterns
|
|
279
279
|
const isToolCapable = toolCapableModels.some((capableModel) => modelName.includes(capableModel));
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { type LanguageModelV1 } from "ai";
|
|
2
2
|
import type { ValidationSchema } from "../types/typeAliases.js";
|
|
3
|
-
import { AIProviderName } from "../
|
|
3
|
+
import { AIProviderName } from "../types/index.js";
|
|
4
4
|
import type { StreamOptions, StreamResult } from "../types/streamTypes.js";
|
|
5
5
|
import { BaseProvider } from "../core/baseProvider.js";
|
|
6
6
|
import type { NeuroLink } from "../neurolink.js";
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { createOpenAI } from "@ai-sdk/openai";
|
|
2
2
|
import { streamText } from "ai";
|
|
3
|
-
import { AIProviderName } from "../
|
|
3
|
+
import { AIProviderName } from "../types/index.js";
|
|
4
4
|
import { BaseProvider } from "../core/baseProvider.js";
|
|
5
5
|
import { logger } from "../utils/logger.js";
|
|
6
6
|
import { createTimeoutController, TimeoutError } from "../utils/timeout.js";
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { type Schema, type LanguageModelV1 } from "ai";
|
|
2
2
|
import type { ZodUnknownSchema } from "../types/typeAliases.js";
|
|
3
|
-
import type { AIProviderName } from "../
|
|
3
|
+
import type { AIProviderName } from "../types/index.js";
|
|
4
4
|
import type { StreamOptions, StreamResult } from "../types/streamTypes.js";
|
|
5
5
|
import { BaseProvider } from "../core/baseProvider.js";
|
|
6
6
|
/**
|
|
@@ -126,7 +126,7 @@ export declare class SageMakerLanguageModel implements LanguageModelV1 {
|
|
|
126
126
|
provider: string;
|
|
127
127
|
specificationVersion: string;
|
|
128
128
|
endpointName: string;
|
|
129
|
-
modelType: "
|
|
129
|
+
modelType: "huggingface" | "mistral" | "custom" | "claude" | "llama" | "jumpstart" | undefined;
|
|
130
130
|
region: string;
|
|
131
131
|
};
|
|
132
132
|
/**
|
|
@@ -173,7 +173,7 @@ export declare class SageMakerLanguageModel implements LanguageModelV1 {
|
|
|
173
173
|
provider: string;
|
|
174
174
|
specificationVersion: string;
|
|
175
175
|
endpointName: string;
|
|
176
|
-
modelType: "
|
|
176
|
+
modelType: "huggingface" | "mistral" | "custom" | "claude" | "llama" | "jumpstart" | undefined;
|
|
177
177
|
region: string;
|
|
178
178
|
};
|
|
179
179
|
}
|