@juspay/neurolink 7.0.0 → 7.2.0

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.
Files changed (101) hide show
  1. package/CHANGELOG.md +15 -4
  2. package/README.md +16 -11
  3. package/dist/cli/commands/config.d.ts +2 -2
  4. package/dist/cli/commands/config.js +22 -21
  5. package/dist/cli/commands/mcp.d.ts +79 -0
  6. package/dist/cli/commands/mcp.js +916 -0
  7. package/dist/cli/commands/models.d.ts +63 -0
  8. package/dist/cli/commands/models.js +653 -0
  9. package/dist/cli/commands/ollama.js +56 -55
  10. package/dist/cli/factories/commandFactory.d.ts +67 -2
  11. package/dist/cli/factories/commandFactory.js +840 -92
  12. package/dist/cli/index.d.ts +6 -0
  13. package/dist/cli/index.js +42 -999
  14. package/dist/cli/utils/completeSetup.js +9 -8
  15. package/dist/cli/utils/envManager.js +7 -6
  16. package/dist/cli/utils/interactiveSetup.js +20 -19
  17. package/dist/core/analytics.js +25 -38
  18. package/dist/core/baseProvider.d.ts +8 -0
  19. package/dist/core/baseProvider.js +177 -68
  20. package/dist/core/constants.d.ts +11 -0
  21. package/dist/core/constants.js +17 -0
  22. package/dist/core/evaluation.js +25 -14
  23. package/dist/core/factory.js +21 -18
  24. package/dist/core/streamAnalytics.d.ts +65 -0
  25. package/dist/core/streamAnalytics.js +125 -0
  26. package/dist/factories/providerRegistry.js +3 -1
  27. package/dist/lib/core/analytics.js +25 -38
  28. package/dist/lib/core/baseProvider.d.ts +8 -0
  29. package/dist/lib/core/baseProvider.js +177 -68
  30. package/dist/lib/core/constants.d.ts +11 -0
  31. package/dist/lib/core/constants.js +17 -0
  32. package/dist/lib/core/evaluation.js +25 -14
  33. package/dist/lib/core/factory.js +22 -18
  34. package/dist/lib/core/streamAnalytics.d.ts +65 -0
  35. package/dist/lib/core/streamAnalytics.js +125 -0
  36. package/dist/lib/factories/providerRegistry.js +3 -1
  37. package/dist/lib/mcp/toolRegistry.d.ts +5 -0
  38. package/dist/lib/mcp/toolRegistry.js +60 -0
  39. package/dist/lib/models/modelRegistry.d.ts +132 -0
  40. package/dist/lib/models/modelRegistry.js +483 -0
  41. package/dist/lib/models/modelResolver.d.ts +115 -0
  42. package/dist/lib/models/modelResolver.js +467 -0
  43. package/dist/lib/neurolink.d.ts +4 -1
  44. package/dist/lib/neurolink.js +108 -69
  45. package/dist/lib/providers/anthropic.js +3 -0
  46. package/dist/lib/providers/googleAiStudio.js +13 -0
  47. package/dist/lib/providers/huggingFace.js +15 -3
  48. package/dist/lib/providers/mistral.js +19 -7
  49. package/dist/lib/providers/ollama.js +31 -7
  50. package/dist/lib/providers/openAI.js +12 -0
  51. package/dist/lib/sdk/toolRegistration.js +17 -0
  52. package/dist/lib/types/cli.d.ts +56 -1
  53. package/dist/lib/types/contextTypes.d.ts +110 -0
  54. package/dist/lib/types/contextTypes.js +176 -0
  55. package/dist/lib/types/index.d.ts +4 -1
  56. package/dist/lib/types/mcpTypes.d.ts +118 -7
  57. package/dist/lib/types/providers.d.ts +81 -0
  58. package/dist/lib/types/streamTypes.d.ts +44 -7
  59. package/dist/lib/types/tools.d.ts +9 -0
  60. package/dist/lib/types/universalProviderOptions.d.ts +3 -1
  61. package/dist/lib/types/universalProviderOptions.js +2 -1
  62. package/dist/lib/utils/logger.d.ts +7 -0
  63. package/dist/lib/utils/logger.js +16 -6
  64. package/dist/lib/utils/performance.d.ts +105 -0
  65. package/dist/lib/utils/performance.js +210 -0
  66. package/dist/lib/utils/providerUtils.js +9 -2
  67. package/dist/lib/utils/retryHandler.d.ts +89 -0
  68. package/dist/lib/utils/retryHandler.js +269 -0
  69. package/dist/mcp/toolRegistry.d.ts +5 -0
  70. package/dist/mcp/toolRegistry.js +60 -0
  71. package/dist/models/modelRegistry.d.ts +132 -0
  72. package/dist/models/modelRegistry.js +483 -0
  73. package/dist/models/modelResolver.d.ts +115 -0
  74. package/dist/models/modelResolver.js +468 -0
  75. package/dist/neurolink.d.ts +4 -1
  76. package/dist/neurolink.js +108 -69
  77. package/dist/providers/anthropic.js +3 -0
  78. package/dist/providers/googleAiStudio.js +13 -0
  79. package/dist/providers/huggingFace.js +15 -3
  80. package/dist/providers/mistral.js +19 -7
  81. package/dist/providers/ollama.js +31 -7
  82. package/dist/providers/openAI.js +12 -0
  83. package/dist/sdk/toolRegistration.js +17 -0
  84. package/dist/types/cli.d.ts +56 -1
  85. package/dist/types/contextTypes.d.ts +110 -0
  86. package/dist/types/contextTypes.js +177 -0
  87. package/dist/types/index.d.ts +4 -1
  88. package/dist/types/mcpTypes.d.ts +118 -7
  89. package/dist/types/providers.d.ts +81 -0
  90. package/dist/types/streamTypes.d.ts +44 -7
  91. package/dist/types/tools.d.ts +9 -0
  92. package/dist/types/universalProviderOptions.d.ts +3 -1
  93. package/dist/types/universalProviderOptions.js +3 -1
  94. package/dist/utils/logger.d.ts +7 -0
  95. package/dist/utils/logger.js +16 -6
  96. package/dist/utils/performance.d.ts +105 -0
  97. package/dist/utils/performance.js +210 -0
  98. package/dist/utils/providerUtils.js +9 -2
  99. package/dist/utils/retryHandler.d.ts +89 -0
  100. package/dist/utils/retryHandler.js +269 -0
  101. package/package.json +2 -1
@@ -48,7 +48,9 @@ export class ProviderRegistry {
48
48
  ProviderFactory.registerProvider(AIProviderName.AZURE, async (modelName) => {
49
49
  const { AzureOpenAIProvider } = await import("../providers/azureOpenai.js");
50
50
  return new AzureOpenAIProvider(modelName);
51
- }, "gpt-4o-mini", ["azure", "azureOpenai"]);
51
+ }, process.env.AZURE_MODEL ||
52
+ process.env.AZURE_OPENAI_DEPLOYMENT_ID ||
53
+ "gpt-4o-mini", ["azure", "azureOpenai"]);
52
54
  // Register Google Vertex AI provider
53
55
  ProviderFactory.registerProvider(AIProviderName.VERTEX, async (modelName) => {
54
56
  const { GoogleVertexProvider } = await import("../providers/googleVertex.js");
@@ -39,6 +39,11 @@ export declare class MCPToolRegistry extends MCPRegistry {
39
39
  private tools;
40
40
  private toolImpls;
41
41
  private toolExecutionStats;
42
+ constructor();
43
+ /**
44
+ * Register all direct tools from directAgentTools
45
+ */
46
+ private registerDirectTools;
42
47
  /**
43
48
  * Register a server with its tools (updated signature)
44
49
  */
@@ -5,10 +5,70 @@
5
5
  import { MCPRegistry } from "./registry.js";
6
6
  import { registryLogger } from "../utils/logger.js";
7
7
  import { randomUUID } from "crypto";
8
+ import { directAgentTools } from "../agent/directTools.js";
8
9
  export class MCPToolRegistry extends MCPRegistry {
9
10
  tools = new Map();
10
11
  toolImpls = new Map(); // Store actual tool implementations
11
12
  toolExecutionStats = new Map();
13
+ constructor() {
14
+ super();
15
+ // Auto-register direct tools on initialization
16
+ this.registerDirectTools();
17
+ }
18
+ /**
19
+ * Register all direct tools from directAgentTools
20
+ */
21
+ registerDirectTools() {
22
+ registryLogger.info("Auto-registering direct tools...");
23
+ for (const [toolName, toolDef] of Object.entries(directAgentTools)) {
24
+ const toolId = `direct.${toolName}`;
25
+ const toolInfo = {
26
+ name: toolName,
27
+ description: toolDef.description || `Direct tool: ${toolName}`,
28
+ inputSchema: {},
29
+ serverId: "direct",
30
+ category: "built-in",
31
+ };
32
+ this.tools.set(toolId, toolInfo);
33
+ this.toolImpls.set(toolId, {
34
+ execute: async (params, context) => {
35
+ try {
36
+ // Direct tools from AI SDK expect their specific parameter structure
37
+ // Each tool validates its own parameters, so we safely pass them through
38
+ const result = await toolDef.execute(params, {
39
+ toolCallId: context?.sessionId || "unknown",
40
+ messages: [],
41
+ });
42
+ // Return the result wrapped in our standard format
43
+ return {
44
+ success: true,
45
+ data: result,
46
+ metadata: {
47
+ toolName,
48
+ serverId: "direct",
49
+ executionTime: 0,
50
+ },
51
+ };
52
+ }
53
+ catch (error) {
54
+ return {
55
+ success: false,
56
+ error: error instanceof Error ? error.message : String(error),
57
+ metadata: {
58
+ toolName,
59
+ serverId: "direct",
60
+ executionTime: 0,
61
+ },
62
+ };
63
+ }
64
+ },
65
+ description: toolDef.description,
66
+ inputSchema: {},
67
+ });
68
+ registryLogger.debug(`Registered direct tool: ${toolName} as ${toolId}`);
69
+ }
70
+ registryLogger.info(`Auto-registered ${Object.keys(directAgentTools).length} direct tools`);
71
+ }
12
72
  /**
13
73
  * Register a server with its tools (updated signature)
14
74
  */
@@ -0,0 +1,132 @@
1
+ /**
2
+ * Model Registry for NeuroLink CLI Commands
3
+ * Provides centralized model data for models command system
4
+ * Part of Phase 4.1 - Models Command System
5
+ */
6
+ import { AIProviderName } from "../core/types.js";
7
+ import type { JsonValue } from "../types/common.js";
8
+ /**
9
+ * Model capabilities interface
10
+ */
11
+ export interface ModelCapabilities {
12
+ vision: boolean;
13
+ functionCalling: boolean;
14
+ codeGeneration: boolean;
15
+ reasoning: boolean;
16
+ multimodal: boolean;
17
+ streaming: boolean;
18
+ jsonMode: boolean;
19
+ }
20
+ /**
21
+ * Model pricing information
22
+ */
23
+ export interface ModelPricing {
24
+ inputCostPer1K: number;
25
+ outputCostPer1K: number;
26
+ currency: string;
27
+ }
28
+ /**
29
+ * Model performance characteristics
30
+ */
31
+ export interface ModelPerformance {
32
+ speed: "fast" | "medium" | "slow";
33
+ quality: "high" | "medium" | "low";
34
+ accuracy: "high" | "medium" | "low";
35
+ }
36
+ /**
37
+ * Model limitations and constraints
38
+ */
39
+ export interface ModelLimits {
40
+ maxContextTokens: number;
41
+ maxOutputTokens: number;
42
+ maxRequestsPerMinute?: number;
43
+ maxRequestsPerDay?: number;
44
+ }
45
+ /**
46
+ * Use case suitability scores (1-10 scale)
47
+ */
48
+ export interface UseCaseSuitability {
49
+ coding: number;
50
+ creative: number;
51
+ analysis: number;
52
+ conversation: number;
53
+ reasoning: number;
54
+ translation: number;
55
+ summarization: number;
56
+ }
57
+ /**
58
+ * Complete model information
59
+ */
60
+ export interface ModelInfo {
61
+ id: string;
62
+ name: string;
63
+ provider: AIProviderName;
64
+ description: string;
65
+ capabilities: ModelCapabilities;
66
+ pricing: ModelPricing;
67
+ performance: ModelPerformance;
68
+ limits: ModelLimits;
69
+ useCases: UseCaseSuitability;
70
+ aliases: string[];
71
+ deprecated: boolean;
72
+ isLocal: boolean;
73
+ releaseDate?: string;
74
+ category: "general" | "coding" | "creative" | "vision" | "reasoning";
75
+ }
76
+ /**
77
+ * Model search filters
78
+ */
79
+ export interface ModelSearchFilters {
80
+ provider?: AIProviderName | AIProviderName[];
81
+ capability?: keyof ModelCapabilities | (keyof ModelCapabilities)[];
82
+ useCase?: keyof UseCaseSuitability;
83
+ maxCost?: number;
84
+ minContextSize?: number;
85
+ maxContextSize?: number;
86
+ performance?: ModelPerformance["speed"] | ModelPerformance["quality"];
87
+ category?: ModelInfo["category"] | ModelInfo["category"][];
88
+ }
89
+ /**
90
+ * Model search result with ranking
91
+ */
92
+ export interface ModelSearchResult {
93
+ model: ModelInfo;
94
+ score: number;
95
+ matchReasons: string[];
96
+ }
97
+ /**
98
+ * Comprehensive model registry
99
+ */
100
+ export declare const MODEL_REGISTRY: Record<string, ModelInfo>;
101
+ /**
102
+ * Model aliases registry for quick resolution
103
+ */
104
+ export declare const MODEL_ALIASES: Record<string, string>;
105
+ /**
106
+ * Use case to model mappings
107
+ */
108
+ export declare const USE_CASE_RECOMMENDATIONS: Record<string, string[]>;
109
+ /**
110
+ * Get all models
111
+ */
112
+ export declare function getAllModels(): ModelInfo[];
113
+ /**
114
+ * Get model by ID
115
+ */
116
+ export declare function getModelById(id: string): ModelInfo | undefined;
117
+ /**
118
+ * Get models by provider
119
+ */
120
+ export declare function getModelsByProvider(provider: AIProviderName): ModelInfo[];
121
+ /**
122
+ * Get available providers
123
+ */
124
+ export declare function getAvailableProviders(): AIProviderName[];
125
+ /**
126
+ * Calculate estimated cost for a request
127
+ */
128
+ export declare function calculateCost(model: ModelInfo, inputTokens: number, outputTokens: number): number;
129
+ /**
130
+ * Format model for display
131
+ */
132
+ export declare function formatModelForDisplay(model: ModelInfo): JsonValue;
@@ -0,0 +1,483 @@
1
+ /**
2
+ * Model Registry for NeuroLink CLI Commands
3
+ * Provides centralized model data for models command system
4
+ * Part of Phase 4.1 - Models Command System
5
+ */
6
+ import { AIProviderName } from "../core/types.js";
7
+ /**
8
+ * Comprehensive model registry
9
+ */
10
+ export const MODEL_REGISTRY = {
11
+ // OpenAI Models
12
+ "gpt-4o": {
13
+ id: "gpt-4o",
14
+ name: "GPT-4 Omni",
15
+ provider: AIProviderName.OPENAI,
16
+ description: "Most capable OpenAI model with vision and advanced reasoning",
17
+ capabilities: {
18
+ vision: true,
19
+ functionCalling: true,
20
+ codeGeneration: true,
21
+ reasoning: true,
22
+ multimodal: true,
23
+ streaming: true,
24
+ jsonMode: true,
25
+ },
26
+ pricing: {
27
+ inputCostPer1K: 0.005,
28
+ outputCostPer1K: 0.015,
29
+ currency: "USD",
30
+ },
31
+ performance: {
32
+ speed: "medium",
33
+ quality: "high",
34
+ accuracy: "high",
35
+ },
36
+ limits: {
37
+ maxContextTokens: 128000,
38
+ maxOutputTokens: 4096,
39
+ maxRequestsPerMinute: 500,
40
+ },
41
+ useCases: {
42
+ coding: 9,
43
+ creative: 8,
44
+ analysis: 9,
45
+ conversation: 9,
46
+ reasoning: 9,
47
+ translation: 8,
48
+ summarization: 8,
49
+ },
50
+ aliases: ["gpt4o", "gpt-4-omni", "openai-flagship"],
51
+ deprecated: false,
52
+ isLocal: false, // Cloud-based model
53
+ releaseDate: "2024-05-13",
54
+ category: "general",
55
+ },
56
+ "gpt-4o-mini": {
57
+ id: "gpt-4o-mini",
58
+ name: "GPT-4 Omni Mini",
59
+ provider: AIProviderName.OPENAI,
60
+ description: "Fast and cost-effective model with strong performance",
61
+ capabilities: {
62
+ vision: true,
63
+ functionCalling: true,
64
+ codeGeneration: true,
65
+ reasoning: true,
66
+ multimodal: true,
67
+ streaming: true,
68
+ jsonMode: true,
69
+ },
70
+ pricing: {
71
+ inputCostPer1K: 0.00015,
72
+ outputCostPer1K: 0.0006,
73
+ currency: "USD",
74
+ },
75
+ performance: {
76
+ speed: "fast",
77
+ quality: "high",
78
+ accuracy: "high",
79
+ },
80
+ limits: {
81
+ maxContextTokens: 128000,
82
+ maxOutputTokens: 16384,
83
+ maxRequestsPerMinute: 1000,
84
+ },
85
+ useCases: {
86
+ coding: 8,
87
+ creative: 7,
88
+ analysis: 8,
89
+ conversation: 8,
90
+ reasoning: 8,
91
+ translation: 8,
92
+ summarization: 9,
93
+ },
94
+ aliases: ["gpt4o-mini", "gpt-4-mini", "fastest", "cheap"],
95
+ deprecated: false,
96
+ isLocal: false, // Cloud-based model
97
+ releaseDate: "2024-07-18",
98
+ category: "general",
99
+ },
100
+ // Google AI Studio Models
101
+ "gemini-2.5-pro": {
102
+ id: "gemini-2.5-pro",
103
+ name: "Gemini 2.5 Pro",
104
+ provider: AIProviderName.GOOGLE_AI,
105
+ description: "Google's most capable multimodal model with large context window",
106
+ capabilities: {
107
+ vision: true,
108
+ functionCalling: true,
109
+ codeGeneration: true,
110
+ reasoning: true,
111
+ multimodal: true,
112
+ streaming: true,
113
+ jsonMode: true,
114
+ },
115
+ pricing: {
116
+ inputCostPer1K: 0.00125,
117
+ outputCostPer1K: 0.005,
118
+ currency: "USD",
119
+ },
120
+ performance: {
121
+ speed: "medium",
122
+ quality: "high",
123
+ accuracy: "high",
124
+ },
125
+ limits: {
126
+ maxContextTokens: 2097152, // 2M tokens
127
+ maxOutputTokens: 8192,
128
+ maxRequestsPerMinute: 360,
129
+ },
130
+ useCases: {
131
+ coding: 9,
132
+ creative: 8,
133
+ analysis: 10,
134
+ conversation: 8,
135
+ reasoning: 9,
136
+ translation: 9,
137
+ summarization: 9,
138
+ },
139
+ aliases: ["gemini-pro", "google-flagship", "best-analysis"],
140
+ deprecated: false,
141
+ isLocal: false, // Cloud-based model
142
+ releaseDate: "2024-12-11",
143
+ category: "reasoning",
144
+ },
145
+ "gemini-2.5-flash": {
146
+ id: "gemini-2.5-flash",
147
+ name: "Gemini 2.5 Flash",
148
+ provider: AIProviderName.GOOGLE_AI,
149
+ description: "Fast and efficient multimodal model with large context",
150
+ capabilities: {
151
+ vision: true,
152
+ functionCalling: true,
153
+ codeGeneration: true,
154
+ reasoning: true,
155
+ multimodal: true,
156
+ streaming: true,
157
+ jsonMode: true,
158
+ },
159
+ pricing: {
160
+ inputCostPer1K: 0.000075,
161
+ outputCostPer1K: 0.0003,
162
+ currency: "USD",
163
+ },
164
+ performance: {
165
+ speed: "fast",
166
+ quality: "high",
167
+ accuracy: "high",
168
+ },
169
+ limits: {
170
+ maxContextTokens: 1048576, // 1M tokens
171
+ maxOutputTokens: 8192,
172
+ maxRequestsPerMinute: 1000,
173
+ },
174
+ useCases: {
175
+ coding: 8,
176
+ creative: 7,
177
+ analysis: 9,
178
+ conversation: 8,
179
+ reasoning: 8,
180
+ translation: 8,
181
+ summarization: 9,
182
+ },
183
+ aliases: ["gemini-flash", "google-fast", "best-value"],
184
+ deprecated: false,
185
+ isLocal: false, // Cloud-based model
186
+ releaseDate: "2024-12-11",
187
+ category: "general",
188
+ },
189
+ // Anthropic Models
190
+ "claude-3-5-sonnet-20241022": {
191
+ id: "claude-3-5-sonnet-20241022",
192
+ name: "Claude 3.5 Sonnet",
193
+ provider: AIProviderName.ANTHROPIC,
194
+ description: "Anthropic's most capable model with excellent reasoning and coding",
195
+ capabilities: {
196
+ vision: true,
197
+ functionCalling: true,
198
+ codeGeneration: true,
199
+ reasoning: true,
200
+ multimodal: true,
201
+ streaming: true,
202
+ jsonMode: false,
203
+ },
204
+ pricing: {
205
+ inputCostPer1K: 0.003,
206
+ outputCostPer1K: 0.015,
207
+ currency: "USD",
208
+ },
209
+ performance: {
210
+ speed: "medium",
211
+ quality: "high",
212
+ accuracy: "high",
213
+ },
214
+ limits: {
215
+ maxContextTokens: 200000,
216
+ maxOutputTokens: 8192,
217
+ maxRequestsPerMinute: 50,
218
+ },
219
+ useCases: {
220
+ coding: 10,
221
+ creative: 9,
222
+ analysis: 9,
223
+ conversation: 9,
224
+ reasoning: 10,
225
+ translation: 8,
226
+ summarization: 8,
227
+ },
228
+ aliases: [
229
+ "claude-3.5-sonnet",
230
+ "claude-sonnet",
231
+ "best-coding",
232
+ "claude-latest",
233
+ ],
234
+ deprecated: false,
235
+ isLocal: false, // Cloud-based model
236
+ releaseDate: "2024-10-22",
237
+ category: "coding",
238
+ },
239
+ "claude-3-5-haiku-20241022": {
240
+ id: "claude-3-5-haiku-20241022",
241
+ name: "Claude 3.5 Haiku",
242
+ provider: AIProviderName.ANTHROPIC,
243
+ description: "Fast and efficient Claude model for quick tasks",
244
+ capabilities: {
245
+ vision: false,
246
+ functionCalling: true,
247
+ codeGeneration: true,
248
+ reasoning: true,
249
+ multimodal: false,
250
+ streaming: true,
251
+ jsonMode: false,
252
+ },
253
+ pricing: {
254
+ inputCostPer1K: 0.001,
255
+ outputCostPer1K: 0.005,
256
+ currency: "USD",
257
+ },
258
+ performance: {
259
+ speed: "fast",
260
+ quality: "high",
261
+ accuracy: "high",
262
+ },
263
+ limits: {
264
+ maxContextTokens: 200000,
265
+ maxOutputTokens: 8192,
266
+ maxRequestsPerMinute: 100,
267
+ },
268
+ useCases: {
269
+ coding: 8,
270
+ creative: 7,
271
+ analysis: 8,
272
+ conversation: 8,
273
+ reasoning: 8,
274
+ translation: 8,
275
+ summarization: 9,
276
+ },
277
+ aliases: ["claude-3.5-haiku", "claude-haiku", "claude-fast"],
278
+ deprecated: false,
279
+ isLocal: false, // Cloud-based model
280
+ releaseDate: "2024-10-22",
281
+ category: "general",
282
+ },
283
+ // Mistral Models
284
+ "mistral-small-latest": {
285
+ id: "mistral-small-latest",
286
+ name: "Mistral Small",
287
+ provider: AIProviderName.MISTRAL,
288
+ description: "Efficient model for simple tasks and cost-sensitive applications",
289
+ capabilities: {
290
+ vision: false,
291
+ functionCalling: true,
292
+ codeGeneration: true,
293
+ reasoning: true,
294
+ multimodal: false,
295
+ streaming: true,
296
+ jsonMode: true,
297
+ },
298
+ pricing: {
299
+ inputCostPer1K: 0.001,
300
+ outputCostPer1K: 0.003,
301
+ currency: "USD",
302
+ },
303
+ performance: {
304
+ speed: "fast",
305
+ quality: "medium",
306
+ accuracy: "medium",
307
+ },
308
+ limits: {
309
+ maxContextTokens: 32768,
310
+ maxOutputTokens: 8192,
311
+ maxRequestsPerMinute: 200,
312
+ },
313
+ useCases: {
314
+ coding: 6,
315
+ creative: 6,
316
+ analysis: 7,
317
+ conversation: 7,
318
+ reasoning: 6,
319
+ translation: 7,
320
+ summarization: 7,
321
+ },
322
+ aliases: ["mistral-small", "mistral-cheap"],
323
+ deprecated: false,
324
+ isLocal: false, // Cloud-based model
325
+ releaseDate: "2024-02-26",
326
+ category: "general",
327
+ },
328
+ // Ollama Models (local)
329
+ "llama3.2:latest": {
330
+ id: "llama3.2:latest",
331
+ name: "Llama 3.2 Latest",
332
+ provider: AIProviderName.OLLAMA,
333
+ description: "Local Llama model for private, offline AI generation",
334
+ capabilities: {
335
+ vision: false,
336
+ functionCalling: false,
337
+ codeGeneration: true,
338
+ reasoning: true,
339
+ multimodal: false,
340
+ streaming: true,
341
+ jsonMode: false,
342
+ },
343
+ pricing: {
344
+ inputCostPer1K: 0, // Local execution
345
+ outputCostPer1K: 0,
346
+ currency: "USD",
347
+ },
348
+ performance: {
349
+ speed: "slow", // Depends on hardware
350
+ quality: "medium",
351
+ accuracy: "medium",
352
+ },
353
+ limits: {
354
+ maxContextTokens: 4096,
355
+ maxOutputTokens: 2048,
356
+ },
357
+ useCases: {
358
+ coding: 6,
359
+ creative: 7,
360
+ analysis: 6,
361
+ conversation: 7,
362
+ reasoning: 6,
363
+ translation: 6,
364
+ summarization: 6,
365
+ },
366
+ aliases: ["llama3.2", "llama", "local", "offline"],
367
+ deprecated: false,
368
+ isLocal: true, // Ollama runs locally
369
+ releaseDate: "2024-09-25",
370
+ category: "general",
371
+ },
372
+ };
373
+ /**
374
+ * Model aliases registry for quick resolution
375
+ */
376
+ export const MODEL_ALIASES = {};
377
+ // Build aliases from model data
378
+ Object.values(MODEL_REGISTRY).forEach((model) => {
379
+ model.aliases.forEach((alias) => {
380
+ MODEL_ALIASES[alias.toLowerCase()] = model.id;
381
+ });
382
+ });
383
+ // Add common aliases
384
+ Object.assign(MODEL_ALIASES, {
385
+ latest: "gpt-4o", // Default latest model
386
+ fastest: "gpt-4o-mini",
387
+ cheapest: "gemini-2.5-flash",
388
+ "best-coding": "claude-3-5-sonnet-20241022",
389
+ "best-analysis": "gemini-2.5-pro",
390
+ "best-creative": "claude-3-5-sonnet-20241022",
391
+ "best-value": "gemini-2.5-flash",
392
+ local: "llama3.2:latest",
393
+ });
394
+ /**
395
+ * Use case to model mappings
396
+ */
397
+ export const USE_CASE_RECOMMENDATIONS = {
398
+ coding: ["claude-3-5-sonnet-20241022", "gpt-4o", "gemini-2.5-pro"],
399
+ creative: ["claude-3-5-sonnet-20241022", "gpt-4o", "gemini-2.5-pro"],
400
+ analysis: ["gemini-2.5-pro", "claude-3-5-sonnet-20241022", "gpt-4o"],
401
+ conversation: [
402
+ "gpt-4o",
403
+ "claude-3-5-sonnet-20241022",
404
+ "claude-3-5-haiku-20241022",
405
+ ],
406
+ reasoning: ["claude-3-5-sonnet-20241022", "gemini-2.5-pro", "gpt-4o"],
407
+ translation: ["gemini-2.5-pro", "gpt-4o", "claude-3-5-haiku-20241022"],
408
+ summarization: [
409
+ "gemini-2.5-flash",
410
+ "gpt-4o-mini",
411
+ "claude-3-5-haiku-20241022",
412
+ ],
413
+ "cost-effective": ["gemini-2.5-flash", "gpt-4o-mini", "mistral-small-latest"],
414
+ "high-quality": ["claude-3-5-sonnet-20241022", "gpt-4o", "gemini-2.5-pro"],
415
+ fast: ["gpt-4o-mini", "gemini-2.5-flash", "claude-3-5-haiku-20241022"],
416
+ };
417
+ /**
418
+ * Get all models
419
+ */
420
+ export function getAllModels() {
421
+ return Object.values(MODEL_REGISTRY);
422
+ }
423
+ /**
424
+ * Get model by ID
425
+ */
426
+ export function getModelById(id) {
427
+ return MODEL_REGISTRY[id];
428
+ }
429
+ /**
430
+ * Get models by provider
431
+ */
432
+ export function getModelsByProvider(provider) {
433
+ return Object.values(MODEL_REGISTRY).filter((model) => model.provider === provider);
434
+ }
435
+ /**
436
+ * Get available providers
437
+ */
438
+ export function getAvailableProviders() {
439
+ const providers = new Set();
440
+ Object.values(MODEL_REGISTRY).forEach((model) => {
441
+ providers.add(model.provider);
442
+ });
443
+ return Array.from(providers);
444
+ }
445
+ /**
446
+ * Calculate estimated cost for a request
447
+ */
448
+ export function calculateCost(model, inputTokens, outputTokens) {
449
+ const inputCost = (inputTokens / 1000) * model.pricing.inputCostPer1K;
450
+ const outputCost = (outputTokens / 1000) * model.pricing.outputCostPer1K;
451
+ return inputCost + outputCost;
452
+ }
453
+ /**
454
+ * Format model for display
455
+ */
456
+ export function formatModelForDisplay(model) {
457
+ const result = {
458
+ id: model.id,
459
+ name: model.name,
460
+ provider: model.provider,
461
+ description: model.description,
462
+ category: model.category,
463
+ capabilities: Object.entries(model.capabilities)
464
+ .filter(([_, supported]) => supported)
465
+ .map(([capability]) => capability),
466
+ pricing: {
467
+ input: `$${model.pricing.inputCostPer1K.toFixed(6)}/1K tokens`,
468
+ output: `$${model.pricing.outputCostPer1K.toFixed(6)}/1K tokens`,
469
+ },
470
+ performance: {
471
+ speed: model.performance.speed,
472
+ quality: model.performance.quality,
473
+ accuracy: model.performance.accuracy,
474
+ },
475
+ contextSize: `${(model.limits.maxContextTokens / 1000).toFixed(0)}K tokens`,
476
+ maxOutput: `${(model.limits.maxOutputTokens / 1000).toFixed(0)}K tokens`,
477
+ aliases: model.aliases,
478
+ };
479
+ if (model.releaseDate) {
480
+ result.releaseDate = model.releaseDate;
481
+ }
482
+ return result;
483
+ }