@juspay/neurolink 7.4.0 → 7.6.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.
- package/CHANGELOG.md +15 -4
- package/README.md +182 -213
- package/dist/cli/factories/commandFactory.js +2 -0
- package/dist/cli/utils/interactiveSetup.js +43 -0
- package/dist/core/types.d.ts +2 -0
- package/dist/core/types.js +2 -0
- package/dist/factories/providerRegistry.js +11 -0
- package/dist/lib/core/types.d.ts +2 -0
- package/dist/lib/core/types.js +2 -0
- package/dist/lib/factories/providerRegistry.js +11 -0
- package/dist/lib/neurolink.js +1 -0
- package/dist/lib/providers/index.d.ts +2 -0
- package/dist/lib/providers/index.js +2 -0
- package/dist/lib/providers/litellm.d.ts +43 -0
- package/dist/lib/providers/litellm.js +188 -0
- package/dist/lib/providers/openaiCompatible.d.ts +49 -0
- package/dist/lib/providers/openaiCompatible.js +260 -0
- package/dist/lib/utils/providerConfig.d.ts +4 -0
- package/dist/lib/utils/providerConfig.js +20 -0
- package/dist/lib/utils/providerUtils.js +4 -0
- package/dist/neurolink.js +1 -0
- package/dist/providers/index.d.ts +2 -0
- package/dist/providers/index.js +2 -0
- package/dist/providers/litellm.d.ts +43 -0
- package/dist/providers/litellm.js +188 -0
- package/dist/providers/openaiCompatible.d.ts +49 -0
- package/dist/providers/openaiCompatible.js +261 -0
- package/dist/utils/providerConfig.d.ts +4 -0
- package/dist/utils/providerConfig.js +20 -0
- package/dist/utils/providerUtils.js +4 -0
- package/package.json +6 -2
package/CHANGELOG.md
CHANGED
|
@@ -1,16 +1,27 @@
|
|
|
1
|
-
# [7.
|
|
1
|
+
# [7.6.0](https://github.com/juspay/neurolink/compare/v7.5.0...v7.6.0) (2025-08-09)
|
|
2
2
|
|
|
3
3
|
|
|
4
4
|
### Features
|
|
5
5
|
|
|
6
|
-
* add
|
|
6
|
+
* **openai-compatible:** add OpenAI Compatible provider with intelligent model auto-discovery ([3041d26](https://github.com/juspay/neurolink/commit/3041d26fb33881e5962cb1f13d3d06f021f642f2))
|
|
7
7
|
|
|
8
|
-
|
|
8
|
+
# [7.5.0](https://github.com/juspay/neurolink/compare/v7.4.0...v7.5.0) (2025-08-06)
|
|
9
|
+
|
|
10
|
+
### Features
|
|
11
|
+
|
|
12
|
+
- **providers:** add LiteLLM provider integration with access to 100+ AI models ([8918f8e](https://github.com/juspay/neurolink/commit/8918f8efc853a2fa42b75838259b22d8022f02b3))
|
|
9
13
|
|
|
14
|
+
# [7.4.0](https://github.com/juspay/neurolink/compare/v7.3.8...v7.4.0) (2025-08-06)
|
|
15
|
+
|
|
16
|
+
### Features
|
|
17
|
+
|
|
18
|
+
- add Bitbucket MCP server integration ([239ca6d](https://github.com/juspay/neurolink/commit/239ca6df81be5474d983df95998f90e2e6d633b9))
|
|
19
|
+
|
|
20
|
+
## [7.3.8](https://github.com/juspay/neurolink/compare/v7.3.7...v7.3.8) (2025-08-05)
|
|
10
21
|
|
|
11
22
|
### Bug Fixes
|
|
12
23
|
|
|
13
|
-
|
|
24
|
+
- **lint:** improve linting ([580130a](https://github.com/juspay/neurolink/commit/580130aa33700b67f9d99de60dbe3d0c7415adfc))
|
|
14
25
|
|
|
15
26
|
## [7.3.7](https://github.com/juspay/neurolink/compare/v7.3.6...v7.3.7) (2025-08-04)
|
|
16
27
|
|
package/README.md
CHANGED
|
@@ -7,48 +7,44 @@
|
|
|
7
7
|
[](https://www.typescriptlang.org/)
|
|
8
8
|
[](https://github.com/juspay/neurolink/actions)
|
|
9
9
|
|
|
10
|
-
> Enterprise AI Development Platform with
|
|
10
|
+
> **Enterprise AI Development Platform** with universal provider support, factory pattern architecture, and **access to 100+ AI models** through LiteLLM integration. Production-ready with TypeScript support.
|
|
11
11
|
|
|
12
|
-
**NeuroLink** is an Enterprise AI Development Platform that unifies
|
|
12
|
+
**NeuroLink** is an Enterprise AI Development Platform that unifies **10 major AI providers** with intelligent fallback and built-in tool support. Available as both a **programmatic SDK** and **professional CLI tool**. Features LiteLLM integration for **100+ models**, plus 6 core tools working across all providers. Extracted from production use at Juspay.
|
|
13
13
|
|
|
14
|
-
##
|
|
15
|
-
|
|
16
|
-
- **🏭 Factory Pattern Architecture** - Unified provider management through BaseProvider inheritance
|
|
17
|
-
- **🔧 Tools-First Design** - All providers include built-in tool support without additional configuration
|
|
18
|
-
- **🌐 Real-time WebSocket Infrastructure** - [Coming Soon - Broken in migration, being fixed]
|
|
19
|
-
- **📊 Advanced Telemetry** - [Coming Soon - Broken in migration, being fixed]
|
|
20
|
-
- **💬 Enhanced Chat Services** - [Coming Soon - Broken in migration, being fixed]
|
|
21
|
-
- **🏗️ Enterprise Architecture** - Production-ready with clean abstractions
|
|
22
|
-
- **🔄 Configuration Management** - Flexible provider configuration
|
|
23
|
-
- **✅ Type Safety** - Industry-standard TypeScript interfaces
|
|
24
|
-
- **⚡ Performance** - Fast response times with streaming support
|
|
25
|
-
- **🛡️ Error Recovery** - Graceful failures with provider fallback
|
|
26
|
-
|
|
27
|
-
## ✅ LATEST UPDATE: Advanced Features & Performance Optimization Complete (2025-08-03)
|
|
14
|
+
## 🎉 **NEW: LiteLLM Integration - Access 100+ AI Models**
|
|
28
15
|
|
|
29
|
-
**NeuroLink
|
|
16
|
+
**NeuroLink now supports LiteLLM**, providing unified access to **100+ AI models** from all major providers through a single interface:
|
|
30
17
|
|
|
31
|
-
-
|
|
32
|
-
-
|
|
33
|
-
-
|
|
34
|
-
-
|
|
35
|
-
-
|
|
36
|
-
- ✅ **Scalability Improvements**: Retry logic, circuit breakers, and rate limiting
|
|
37
|
-
- ✅ **Factory Pattern Architecture**: All providers inherit from BaseProvider with built-in tool support
|
|
38
|
-
- ✅ **Direct Tools**: Six core tools available across all providers (getCurrentTime, readFile, listDirectory, calculateMath, writeFile, searchFiles)
|
|
18
|
+
- **🔄 Universal Access**: OpenAI, Anthropic, Google, Mistral, Meta, and more
|
|
19
|
+
- **🎯 Unified Interface**: OpenAI-compatible API for all models
|
|
20
|
+
- **💰 Cost Optimization**: Automatic routing to cost-effective models
|
|
21
|
+
- **⚡ Load Balancing**: Automatic failover and load distribution
|
|
22
|
+
- **📊 Analytics**: Built-in usage tracking and monitoring
|
|
39
23
|
|
|
40
|
-
|
|
24
|
+
```bash
|
|
25
|
+
# Quick start with LiteLLM
|
|
26
|
+
pip install litellm && litellm --port 4000
|
|
41
27
|
|
|
42
|
-
|
|
28
|
+
# Use any of 100+ models through one interface
|
|
29
|
+
npx @juspay/neurolink generate "Hello" --provider litellm --model "openai/gpt-4o"
|
|
30
|
+
npx @juspay/neurolink generate "Hello" --provider litellm --model "anthropic/claude-3-5-sonnet"
|
|
31
|
+
npx @juspay/neurolink generate "Hello" --provider litellm --model "google/gemini-2.0-flash"
|
|
32
|
+
```
|
|
43
33
|
|
|
44
|
-
**
|
|
34
|
+
**[📖 Complete LiteLLM Integration Guide](./docs/LITELLM-INTEGRATION.md)** - Setup, configuration, and 100+ model access
|
|
45
35
|
|
|
46
|
-
|
|
47
|
-
- ✅ **Enhanced Generation**: `generate()` as primary generation function
|
|
48
|
-
- ✅ **Factory Enhanced**: Better provider management across all methods
|
|
49
|
-
- ✅ **Zero Breaking Changes**: All existing code continues working (backward compatibility)
|
|
36
|
+
## 🚀 Enterprise Platform Features
|
|
50
37
|
|
|
51
|
-
|
|
38
|
+
- **🏭 Factory Pattern Architecture** - Unified provider management through BaseProvider inheritance
|
|
39
|
+
- **🔧 Tools-First Design** - All providers include built-in tool support without additional configuration
|
|
40
|
+
- **🔗 LiteLLM Integration** - **100+ models** from all major providers through unified interface
|
|
41
|
+
- **🏗️ Enterprise Architecture** - Production-ready with clean abstractions
|
|
42
|
+
- **🔄 Configuration Management** - Flexible provider configuration with automatic backups
|
|
43
|
+
- **✅ Type Safety** - Industry-standard TypeScript interfaces
|
|
44
|
+
- **⚡ Performance** - Fast response times with streaming support and 68% improved status checks
|
|
45
|
+
- **🛡️ Error Recovery** - Graceful failures with provider fallback and retry logic
|
|
46
|
+
- **📊 Analytics & Evaluation** - Built-in usage tracking and AI-powered quality assessment
|
|
47
|
+
- **🔧 MCP Integration** - Model Context Protocol with 6 built-in tools and 58+ discoverable servers
|
|
52
48
|
|
|
53
49
|
---
|
|
54
50
|
|
|
@@ -57,26 +53,34 @@
|
|
|
57
53
|
### Install & Run (2 minutes)
|
|
58
54
|
|
|
59
55
|
```bash
|
|
60
|
-
#
|
|
56
|
+
# Option 1: LiteLLM - Access 100+ models through one interface
|
|
57
|
+
pip install litellm && litellm --port 4000
|
|
58
|
+
export LITELLM_BASE_URL="http://localhost:4000"
|
|
59
|
+
export LITELLM_API_KEY="sk-anything"
|
|
60
|
+
|
|
61
|
+
# Use any of 100+ models
|
|
62
|
+
npx @juspay/neurolink generate "Hello, AI" --provider litellm --model "openai/gpt-4o"
|
|
63
|
+
npx @juspay/neurolink generate "Hello, AI" --provider litellm --model "anthropic/claude-3-5-sonnet"
|
|
64
|
+
|
|
65
|
+
# Option 2: OpenAI Compatible - Use any OpenAI-compatible endpoint with auto-discovery
|
|
66
|
+
export OPENAI_COMPATIBLE_BASE_URL="https://api.openrouter.ai/api/v1"
|
|
67
|
+
export OPENAI_COMPATIBLE_API_KEY="sk-or-v1-your-api-key"
|
|
68
|
+
# Auto-discovers available models via /v1/models endpoint
|
|
69
|
+
npx @juspay/neurolink generate "Hello, AI" --provider openai-compatible
|
|
70
|
+
|
|
71
|
+
# Or specify a model explicitly
|
|
72
|
+
export OPENAI_COMPATIBLE_MODEL="claude-3-5-sonnet"
|
|
73
|
+
npx @juspay/neurolink generate "Hello, AI" --provider openai-compatible
|
|
74
|
+
|
|
75
|
+
# Option 3: Direct Provider - Quick setup with Google AI Studio (free tier)
|
|
61
76
|
export GOOGLE_AI_API_KEY="AIza-your-google-ai-api-key"
|
|
77
|
+
npx @juspay/neurolink generate "Hello, AI" --provider google-ai
|
|
62
78
|
|
|
63
|
-
# CLI - No installation required
|
|
64
|
-
npx @juspay/neurolink generate "
|
|
65
|
-
npx @juspay/neurolink gen "
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
npx @juspay/neurolink generate "Explain AI" --provider google-ai
|
|
69
|
-
npx @juspay/neurolink gen "Write code" --provider openai # Shortest form
|
|
70
|
-
|
|
71
|
-
# 🆕 AI Enhancement Features (Phase 3 Complete)
|
|
72
|
-
npx @juspay/neurolink generate "Explain AI" --enableAnalytics --debug
|
|
73
|
-
npx @juspay/neurolink generate "Write code" --enableEvaluation --debug
|
|
74
|
-
npx @juspay/neurolink generate "Help me" --context '{"userId":"123"}' --debug
|
|
75
|
-
|
|
76
|
-
# 🚀 Real Streaming with Analytics (Phase 3.2B Complete)
|
|
77
|
-
npx @juspay/neurolink stream "Explain quantum computing" --enableAnalytics --enableEvaluation
|
|
78
|
-
|
|
79
|
-
npx @juspay/neurolink status
|
|
79
|
+
# CLI Commands - No installation required
|
|
80
|
+
npx @juspay/neurolink generate "Explain AI" # Auto-selects best provider
|
|
81
|
+
npx @juspay/neurolink gen "Write code" # Shortest form
|
|
82
|
+
npx @juspay/neurolink stream "Tell a story" # Real-time streaming
|
|
83
|
+
npx @juspay/neurolink status # Check all providers
|
|
80
84
|
```
|
|
81
85
|
|
|
82
86
|
```bash
|
|
@@ -87,20 +91,38 @@ npm install @juspay/neurolink
|
|
|
87
91
|
### Basic Usage
|
|
88
92
|
|
|
89
93
|
```typescript
|
|
90
|
-
import { NeuroLink } from "@juspay/neurolink";
|
|
91
|
-
|
|
92
|
-
//
|
|
93
|
-
const
|
|
94
|
-
|
|
94
|
+
import { NeuroLink, AIProviderFactory } from "@juspay/neurolink";
|
|
95
|
+
|
|
96
|
+
// LiteLLM - Access 100+ models through unified interface
|
|
97
|
+
const litellmProvider = await AIProviderFactory.createProvider(
|
|
98
|
+
"litellm",
|
|
99
|
+
"openai/gpt-4o",
|
|
100
|
+
);
|
|
101
|
+
const result = await litellmProvider.generate({
|
|
95
102
|
input: { text: "Write a haiku about programming" },
|
|
96
|
-
provider: "google-ai",
|
|
97
|
-
timeout: "30s", // Optional: Set custom timeout (default: 30s)
|
|
98
103
|
});
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
const
|
|
102
|
-
|
|
103
|
-
|
|
104
|
+
|
|
105
|
+
// Compare multiple models simultaneously
|
|
106
|
+
const models = [
|
|
107
|
+
"openai/gpt-4o",
|
|
108
|
+
"anthropic/claude-3-5-sonnet",
|
|
109
|
+
"google/gemini-2.0-flash",
|
|
110
|
+
];
|
|
111
|
+
const comparisons = await Promise.all(
|
|
112
|
+
models.map(async (model) => {
|
|
113
|
+
const provider = await AIProviderFactory.createProvider("litellm", model);
|
|
114
|
+
const result = await provider.generate({
|
|
115
|
+
input: { text: "Explain quantum computing" },
|
|
116
|
+
});
|
|
117
|
+
return { model, response: result.content, provider: result.provider };
|
|
118
|
+
}),
|
|
119
|
+
);
|
|
120
|
+
|
|
121
|
+
// Auto-select best available provider
|
|
122
|
+
const neurolink = new NeuroLink();
|
|
123
|
+
const autoResult = await neurolink.generate({
|
|
124
|
+
input: { text: "Write a business email" },
|
|
125
|
+
provider: "google-ai", // or let it auto-select
|
|
104
126
|
timeout: "30s",
|
|
105
127
|
});
|
|
106
128
|
|
|
@@ -132,119 +154,58 @@ const poem = await provider.generate({ input: { text: "Write a poem" } });
|
|
|
132
154
|
const joke = await provider.gen({ input: { text: "Tell me a joke" } });
|
|
133
155
|
```
|
|
134
156
|
|
|
135
|
-
###
|
|
157
|
+
### Enhanced Features
|
|
136
158
|
|
|
137
|
-
####
|
|
159
|
+
#### CLI with Analytics & Evaluation
|
|
138
160
|
|
|
139
161
|
```bash
|
|
140
|
-
# Basic AI generation
|
|
162
|
+
# Basic AI generation with auto-provider selection
|
|
141
163
|
npx @juspay/neurolink generate "Write a business email"
|
|
142
164
|
|
|
143
|
-
#
|
|
144
|
-
npx @juspay/neurolink generate "Write
|
|
165
|
+
# LiteLLM with specific model
|
|
166
|
+
npx @juspay/neurolink generate "Write code" --provider litellm --model "anthropic/claude-3-5-sonnet"
|
|
145
167
|
|
|
146
|
-
#
|
|
147
|
-
|
|
148
|
-
# ⭐ Response Evaluation: AI-powered quality scores
|
|
168
|
+
# With analytics and evaluation
|
|
169
|
+
npx @juspay/neurolink generate "Write a proposal" --enable-analytics --enable-evaluation --debug
|
|
149
170
|
|
|
150
|
-
#
|
|
151
|
-
npx @juspay/neurolink
|
|
171
|
+
# Streaming with tools (default behavior)
|
|
172
|
+
npx @juspay/neurolink stream "What time is it and write a file with the current date"
|
|
152
173
|
```
|
|
153
174
|
|
|
154
|
-
####
|
|
175
|
+
#### SDK with LiteLLM and Enhancement Features
|
|
155
176
|
|
|
156
177
|
```typescript
|
|
157
|
-
import { NeuroLink } from "@juspay/neurolink";
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
178
|
+
import { NeuroLink, AIProviderFactory } from "@juspay/neurolink";
|
|
179
|
+
|
|
180
|
+
// LiteLLM multi-model comparison
|
|
181
|
+
const models = [
|
|
182
|
+
"openai/gpt-4o",
|
|
183
|
+
"anthropic/claude-3-5-sonnet",
|
|
184
|
+
"google/gemini-2.0-flash",
|
|
185
|
+
];
|
|
186
|
+
const comparisons = await Promise.all(
|
|
187
|
+
models.map(async (model) => {
|
|
188
|
+
const provider = await AIProviderFactory.createProvider("litellm", model);
|
|
189
|
+
return await provider.generate({
|
|
190
|
+
input: { text: "Explain the benefits of renewable energy" },
|
|
191
|
+
enableAnalytics: true,
|
|
192
|
+
enableEvaluation: true,
|
|
193
|
+
});
|
|
194
|
+
}),
|
|
195
|
+
);
|
|
162
196
|
|
|
163
|
-
//
|
|
164
|
-
const
|
|
197
|
+
// Enhanced generation with analytics
|
|
198
|
+
const neurolink = new NeuroLink();
|
|
199
|
+
const result = await neurolink.generate({
|
|
165
200
|
input: { text: "Write a business proposal" },
|
|
166
201
|
enableAnalytics: true, // Get usage & cost data
|
|
167
202
|
enableEvaluation: true, // Get AI quality scores
|
|
168
|
-
context: { project: "Q1-sales" },
|
|
169
|
-
});
|
|
170
|
-
|
|
171
|
-
// Access enhancement data
|
|
172
|
-
console.log("📊 Usage:", enhancedResult.analytics);
|
|
173
|
-
console.log("⭐ Quality:", enhancedResult.evaluation);
|
|
174
|
-
console.log("Response:", enhancedResult.content);
|
|
175
|
-
|
|
176
|
-
// Enhanced evaluation included when enableEvaluation is true
|
|
177
|
-
// Returns basic quality scores for the generated content
|
|
178
|
-
```
|
|
179
|
-
|
|
180
|
-
### 🌐 Enterprise Real-time Features (NEW! 🚀)
|
|
181
|
-
|
|
182
|
-
#### Real-time WebSocket Chat
|
|
183
|
-
|
|
184
|
-
```typescript
|
|
185
|
-
import {
|
|
186
|
-
createEnhancedChatService,
|
|
187
|
-
NeuroLinkWebSocketServer,
|
|
188
|
-
} from "@juspay/neurolink";
|
|
189
|
-
|
|
190
|
-
// Enhanced chat with WebSocket support
|
|
191
|
-
const chatService = createEnhancedChatService({
|
|
192
|
-
provider: await createBestAIProvider(),
|
|
193
|
-
enableWebSocket: true,
|
|
194
|
-
enableSSE: true,
|
|
195
|
-
streamingConfig: {
|
|
196
|
-
bufferSize: 8192,
|
|
197
|
-
compressionEnabled: true,
|
|
198
|
-
},
|
|
199
|
-
});
|
|
200
|
-
|
|
201
|
-
// WebSocket server for real-time applications
|
|
202
|
-
const wsServer = new NeuroLinkWebSocketServer({
|
|
203
|
-
port: 8080,
|
|
204
|
-
maxConnections: 1000,
|
|
205
|
-
enableCompression: true,
|
|
206
|
-
});
|
|
207
|
-
|
|
208
|
-
// Handle real-time chat
|
|
209
|
-
wsServer.on("chat-message", async ({ connectionId, message }) => {
|
|
210
|
-
await chatService.streamChat({
|
|
211
|
-
prompt: message.data.prompt,
|
|
212
|
-
onChunk: (chunk) => {
|
|
213
|
-
wsServer.sendMessage(connectionId, {
|
|
214
|
-
type: "ai-chunk",
|
|
215
|
-
data: { chunk },
|
|
216
|
-
});
|
|
217
|
-
},
|
|
218
|
-
});
|
|
219
|
-
});
|
|
220
|
-
```
|
|
221
|
-
|
|
222
|
-
#### Enterprise Telemetry Integration
|
|
223
|
-
|
|
224
|
-
```typescript
|
|
225
|
-
import { initializeTelemetry, getTelemetryStatus } from "@juspay/neurolink";
|
|
226
|
-
|
|
227
|
-
// Optional enterprise monitoring (zero overhead when disabled)
|
|
228
|
-
const telemetry = initializeTelemetry({
|
|
229
|
-
serviceName: "my-ai-app",
|
|
230
|
-
endpoint: "http://localhost:4318",
|
|
231
|
-
enableTracing: true,
|
|
232
|
-
enableMetrics: true,
|
|
233
|
-
enableLogs: true,
|
|
203
|
+
context: { project: "Q1-sales" },
|
|
234
204
|
});
|
|
235
205
|
|
|
236
|
-
|
|
237
|
-
|
|
238
|
-
console.log("
|
|
239
|
-
console.log("Service:", status.service);
|
|
240
|
-
console.log("Version:", status.version);
|
|
241
|
-
|
|
242
|
-
// All AI operations are now automatically monitored
|
|
243
|
-
const provider = await createBestAIProvider();
|
|
244
|
-
const result = await provider.generate({
|
|
245
|
-
prompt: "Generate business report",
|
|
246
|
-
});
|
|
247
|
-
// Telemetry automatically tracks: response time, token usage, cost, errors
|
|
206
|
+
console.log("📊 Usage:", result.analytics);
|
|
207
|
+
console.log("⭐ Quality:", result.evaluation);
|
|
208
|
+
console.log("Response:", result.content);
|
|
248
209
|
```
|
|
249
210
|
|
|
250
211
|
### Environment Setup
|
|
@@ -263,22 +224,20 @@ npx @juspay/neurolink status
|
|
|
263
224
|
|
|
264
225
|
## ✨ Key Features
|
|
265
226
|
|
|
227
|
+
- 🔗 **LiteLLM Integration** - **Access 100+ AI models** from all major providers through unified interface
|
|
228
|
+
- 🔍 **Smart Model Auto-Discovery** - OpenAI Compatible provider automatically detects available models via `/v1/models` endpoint
|
|
266
229
|
- 🏭 **Factory Pattern Architecture** - Unified provider management with BaseProvider inheritance
|
|
267
|
-
- 🔧 **Tools-First Design** - All providers automatically include direct
|
|
268
|
-
- 🔄 **
|
|
269
|
-
-
|
|
270
|
-
-
|
|
271
|
-
-
|
|
272
|
-
-
|
|
273
|
-
-
|
|
274
|
-
-
|
|
275
|
-
-
|
|
276
|
-
-
|
|
277
|
-
-
|
|
278
|
-
- 🤖 **AI Analysis Tools** - Built-in optimization and workflow assistance
|
|
279
|
-
- 🏠 **Local AI Support** - Run completely offline with Ollama
|
|
280
|
-
- 🌍 **Open Source Models** - Access 100,000+ models via Hugging Face
|
|
281
|
-
- 🇪🇺 **GDPR Compliance** - European data processing with Mistral AI
|
|
230
|
+
- 🔧 **Tools-First Design** - All providers automatically include 6 direct tools (getCurrentTime, readFile, listDirectory, calculateMath, writeFile, searchFiles)
|
|
231
|
+
- 🔄 **11 AI Providers** - OpenAI, Bedrock, Vertex AI, Google AI Studio, Anthropic, Azure, **LiteLLM**, **OpenAI Compatible**, Hugging Face, Ollama, Mistral AI
|
|
232
|
+
- 💰 **Cost Optimization** - Automatic selection of cheapest models and LiteLLM routing
|
|
233
|
+
- ⚡ **Automatic Fallback** - Never fail when providers are down, intelligent provider switching
|
|
234
|
+
- 🖥️ **CLI + SDK** - Use from command line or integrate programmatically with TypeScript support
|
|
235
|
+
- 🛡️ **Production Ready** - Enterprise-grade error handling, performance optimization, extracted from production
|
|
236
|
+
- ✅ **MCP Integration** - Model Context Protocol with working built-in tools and 58+ discoverable external servers
|
|
237
|
+
- 🔍 **Smart Model Resolution** - Fuzzy matching, aliases, and capability-based search across all providers
|
|
238
|
+
- 🏠 **Local AI Support** - Run completely offline with Ollama or through LiteLLM proxy
|
|
239
|
+
- 🌍 **Universal Model Access** - Direct providers + 100,000+ models via Hugging Face + 100+ models via LiteLLM
|
|
240
|
+
- 📊 **Analytics & Evaluation** - Built-in usage tracking and AI-powered quality assessment
|
|
282
241
|
|
|
283
242
|
## 🛠️ MCP Integration Status ✅ **BUILT-IN TOOLS WORKING**
|
|
284
243
|
|
|
@@ -353,45 +312,28 @@ neurolink.registerTools({
|
|
|
353
312
|
});
|
|
354
313
|
```
|
|
355
314
|
|
|
356
|
-
##
|
|
357
|
-
|
|
358
|
-
NeuroLink now features a revolutionary dynamic model configuration system that eliminates hardcoded model lists and enables automatic cost optimization.
|
|
315
|
+
## 💰 Smart Model Selection
|
|
359
316
|
|
|
360
|
-
|
|
317
|
+
NeuroLink features intelligent model selection and cost optimization:
|
|
361
318
|
|
|
362
|
-
|
|
363
|
-
- **💰 Cost-Optimized**: Automatic selection of cheapest models for tasks
|
|
364
|
-
- **🔍 Smart Search**: Find models by capabilities (functionCalling, vision, etc.)
|
|
365
|
-
- **🏷️ Alias Support**: Use friendly names like "claude-latest" or "best-coding"
|
|
366
|
-
- **📊 Real-Time Pricing**: Always current model costs and performance data
|
|
319
|
+
### Cost Optimization Features
|
|
367
320
|
|
|
368
|
-
|
|
321
|
+
- **💰 Automatic Cost Optimization**: Selects cheapest models for simple tasks
|
|
322
|
+
- **🔄 LiteLLM Model Routing**: Access 100+ models with automatic load balancing
|
|
323
|
+
- **🔍 Capability-Based Selection**: Find models with specific features (vision, function calling)
|
|
324
|
+
- **⚡ Intelligent Fallback**: Seamless switching when providers fail
|
|
369
325
|
|
|
370
326
|
```bash
|
|
371
327
|
# Cost optimization - automatically use cheapest model
|
|
372
328
|
npx @juspay/neurolink generate "Hello" --optimize-cost
|
|
373
329
|
|
|
374
|
-
#
|
|
375
|
-
npx @juspay/neurolink generate "
|
|
330
|
+
# LiteLLM specific model selection
|
|
331
|
+
npx @juspay/neurolink generate "Complex analysis" --provider litellm --model "anthropic/claude-3-5-sonnet"
|
|
376
332
|
|
|
377
|
-
#
|
|
378
|
-
npx @juspay/neurolink
|
|
379
|
-
|
|
380
|
-
# Test dynamic model server
|
|
381
|
-
npm run model-server # Starts config server on localhost:3001
|
|
382
|
-
npm run test:dynamicModels # Comprehensive test suite
|
|
333
|
+
# Auto-select best available provider
|
|
334
|
+
npx @juspay/neurolink generate "Write code" # Automatically chooses optimal provider
|
|
383
335
|
```
|
|
384
336
|
|
|
385
|
-
### 📊 Current Model Inventory (Auto-Updated)
|
|
386
|
-
|
|
387
|
-
- **10 active models** across 4 providers
|
|
388
|
-
- **Cheapest**: Gemini 2.0 Flash ($0.000075/1K tokens)
|
|
389
|
-
- **Most capable**: Claude 3 Opus (functionCalling + vision + analysis)
|
|
390
|
-
- **Best for coding**: Claude 3 Opus, Gemini 2.0 Flash
|
|
391
|
-
- **1 deprecated model** automatically excluded
|
|
392
|
-
|
|
393
|
-
**[📖 Complete Dynamic Models Guide](./docs/DYNAMIC-MODELS.md)** - Setup, configuration, and advanced usage
|
|
394
|
-
|
|
395
337
|
## 💻 Essential Examples
|
|
396
338
|
|
|
397
339
|
### CLI Commands
|
|
@@ -533,17 +475,19 @@ cd neurolink-demo && node server.js
|
|
|
533
475
|
|
|
534
476
|
## 🏗️ Supported Providers & Models
|
|
535
477
|
|
|
536
|
-
| Provider
|
|
537
|
-
|
|
|
538
|
-
| **
|
|
539
|
-
|
|
|
540
|
-
| **
|
|
541
|
-
| **
|
|
542
|
-
| **Anthropic**
|
|
543
|
-
| **
|
|
544
|
-
| **
|
|
545
|
-
| **
|
|
546
|
-
| **
|
|
478
|
+
| Provider | Models | Auth Method | Free Tier | Tool Support | Key Benefit |
|
|
479
|
+
| --------------------------- | ---------------------------------- | ------------------ | --------- | ------------ | -------------------------------- |
|
|
480
|
+
| **🔗 LiteLLM** 🆕 | **100+ Models** (All Providers) | Proxy Server | Varies | ✅ Full | **Universal Access** |
|
|
481
|
+
| **🔗 OpenAI Compatible** 🆕 | **Any OpenAI-compatible endpoint** | API Key + Base URL | Varies | ✅ Full | **Auto-Discovery + Flexibility** |
|
|
482
|
+
| **Google AI Studio** | Gemini 2.5 Flash/Pro | API Key | ✅ | ✅ Full | Free Tier Available |
|
|
483
|
+
| **OpenAI** | GPT-4o, GPT-4o-mini | API Key | ❌ | ✅ Full | Industry Standard |
|
|
484
|
+
| **Anthropic** | Claude 3.5 Sonnet | API Key | ❌ | ✅ Full | Advanced Reasoning |
|
|
485
|
+
| **Amazon Bedrock** | Claude 3.5/3.7 Sonnet | AWS Credentials | ❌ | ✅ Full\* | Enterprise Scale |
|
|
486
|
+
| **Google Vertex AI** | Gemini 2.5 Flash | Service Account | ❌ | ✅ Full | Enterprise Google |
|
|
487
|
+
| **Azure OpenAI** | GPT-4, GPT-3.5 | API Key + Endpoint | ❌ | ✅ Full | Microsoft Ecosystem |
|
|
488
|
+
| **Ollama** 🆕 | Llama 3.2, Gemma, Mistral (Local) | None (Local) | ✅ | ⚠️ Partial | Complete Privacy |
|
|
489
|
+
| **Hugging Face** 🆕 | 100,000+ open source models | API Key | ✅ | ⚠️ Partial | Open Source |
|
|
490
|
+
| **Mistral AI** 🆕 | Tiny, Small, Medium, Large | API Key | ✅ | ✅ Full | European/GDPR |
|
|
547
491
|
|
|
548
492
|
**Tool Support Legend:**
|
|
549
493
|
|
|
@@ -554,6 +498,31 @@ cd neurolink-demo && node server.js
|
|
|
554
498
|
|
|
555
499
|
**✨ Auto-Selection**: NeuroLink automatically chooses the best available provider based on speed, reliability, and configuration.
|
|
556
500
|
|
|
501
|
+
### 🔍 Smart Model Auto-Discovery (OpenAI Compatible)
|
|
502
|
+
|
|
503
|
+
The OpenAI Compatible provider includes intelligent model discovery that automatically detects available models from any endpoint:
|
|
504
|
+
|
|
505
|
+
```bash
|
|
506
|
+
# Setup - no model specified
|
|
507
|
+
export OPENAI_COMPATIBLE_BASE_URL="https://api.your-endpoint.ai/v1"
|
|
508
|
+
export OPENAI_COMPATIBLE_API_KEY="your-api-key"
|
|
509
|
+
|
|
510
|
+
# Auto-discovers and uses first available model
|
|
511
|
+
npx @juspay/neurolink generate "Hello!" --provider openai-compatible
|
|
512
|
+
# → 🔍 Auto-discovered model: claude-sonnet-4 from 3 available models
|
|
513
|
+
|
|
514
|
+
# Or specify explicitly to skip discovery
|
|
515
|
+
export OPENAI_COMPATIBLE_MODEL="gemini-2.5-pro"
|
|
516
|
+
npx @juspay/neurolink generate "Hello!" --provider openai-compatible
|
|
517
|
+
```
|
|
518
|
+
|
|
519
|
+
**How it works:**
|
|
520
|
+
|
|
521
|
+
- Queries `/v1/models` endpoint to discover available models
|
|
522
|
+
- Automatically selects the first available model when none specified
|
|
523
|
+
- Falls back gracefully if discovery fails
|
|
524
|
+
- Works with any OpenAI-compatible service (OpenRouter, vLLM, LiteLLM, etc.)
|
|
525
|
+
|
|
557
526
|
## 🎯 Production Features
|
|
558
527
|
|
|
559
528
|
### Enterprise-Grade Reliability
|
|
@@ -17,6 +17,7 @@ export class CLICommandFactory {
|
|
|
17
17
|
choices: [
|
|
18
18
|
"auto",
|
|
19
19
|
"openai",
|
|
20
|
+
"openai-compatible",
|
|
20
21
|
"bedrock",
|
|
21
22
|
"vertex",
|
|
22
23
|
"googleVertex",
|
|
@@ -26,6 +27,7 @@ export class CLICommandFactory {
|
|
|
26
27
|
"huggingface",
|
|
27
28
|
"ollama",
|
|
28
29
|
"mistral",
|
|
30
|
+
"litellm",
|
|
29
31
|
],
|
|
30
32
|
default: "auto",
|
|
31
33
|
description: "AI provider to use (auto-selects best available)",
|
|
@@ -133,6 +133,49 @@ export const PROVIDER_CONFIGS = [
|
|
|
133
133
|
{ key: "MISTRAL_API_KEY", prompt: "Mistral AI API Key", secure: true },
|
|
134
134
|
],
|
|
135
135
|
},
|
|
136
|
+
{
|
|
137
|
+
id: AIProviderName.LITELLM,
|
|
138
|
+
name: "LiteLLM",
|
|
139
|
+
description: "Access 100+ models via LiteLLM proxy server",
|
|
140
|
+
envVars: [
|
|
141
|
+
{
|
|
142
|
+
key: "LITELLM_BASE_URL",
|
|
143
|
+
prompt: "LiteLLM Proxy Server URL",
|
|
144
|
+
default: "http://localhost:4000",
|
|
145
|
+
secure: false,
|
|
146
|
+
},
|
|
147
|
+
{
|
|
148
|
+
key: "LITELLM_API_KEY",
|
|
149
|
+
prompt: "LiteLLM API Key (or any value)",
|
|
150
|
+
default: "sk-anything",
|
|
151
|
+
secure: false,
|
|
152
|
+
optional: true,
|
|
153
|
+
},
|
|
154
|
+
],
|
|
155
|
+
},
|
|
156
|
+
{
|
|
157
|
+
id: AIProviderName.OPENAI_COMPATIBLE,
|
|
158
|
+
name: "OpenAI Compatible",
|
|
159
|
+
description: "Any OpenAI-compatible endpoint (OpenRouter, vLLM, etc.)",
|
|
160
|
+
envVars: [
|
|
161
|
+
{
|
|
162
|
+
key: "OPENAI_COMPATIBLE_BASE_URL",
|
|
163
|
+
prompt: "OpenAI-compatible endpoint URL (e.g., https://api.openrouter.ai/api/v1)",
|
|
164
|
+
secure: false,
|
|
165
|
+
},
|
|
166
|
+
{
|
|
167
|
+
key: "OPENAI_COMPATIBLE_API_KEY",
|
|
168
|
+
prompt: "API Key for the OpenAI-compatible service",
|
|
169
|
+
secure: true,
|
|
170
|
+
},
|
|
171
|
+
{
|
|
172
|
+
key: "OPENAI_COMPATIBLE_MODEL",
|
|
173
|
+
prompt: "Model name (optional - will auto-discover if not specified)",
|
|
174
|
+
secure: false,
|
|
175
|
+
optional: true,
|
|
176
|
+
},
|
|
177
|
+
],
|
|
178
|
+
},
|
|
136
179
|
];
|
|
137
180
|
/**
|
|
138
181
|
* Run the interactive setup wizard
|
package/dist/core/types.d.ts
CHANGED
|
@@ -42,6 +42,7 @@ export interface TextGenerationResult {
|
|
|
42
42
|
export declare enum AIProviderName {
|
|
43
43
|
BEDROCK = "bedrock",
|
|
44
44
|
OPENAI = "openai",
|
|
45
|
+
OPENAI_COMPATIBLE = "openai-compatible",
|
|
45
46
|
VERTEX = "vertex",
|
|
46
47
|
ANTHROPIC = "anthropic",
|
|
47
48
|
AZURE = "azure",
|
|
@@ -49,6 +50,7 @@ export declare enum AIProviderName {
|
|
|
49
50
|
HUGGINGFACE = "huggingface",
|
|
50
51
|
OLLAMA = "ollama",
|
|
51
52
|
MISTRAL = "mistral",
|
|
53
|
+
LITELLM = "litellm",
|
|
52
54
|
AUTO = "auto"
|
|
53
55
|
}
|
|
54
56
|
/**
|
package/dist/core/types.js
CHANGED
|
@@ -5,6 +5,7 @@ export var AIProviderName;
|
|
|
5
5
|
(function (AIProviderName) {
|
|
6
6
|
AIProviderName["BEDROCK"] = "bedrock";
|
|
7
7
|
AIProviderName["OPENAI"] = "openai";
|
|
8
|
+
AIProviderName["OPENAI_COMPATIBLE"] = "openai-compatible";
|
|
8
9
|
AIProviderName["VERTEX"] = "vertex";
|
|
9
10
|
AIProviderName["ANTHROPIC"] = "anthropic";
|
|
10
11
|
AIProviderName["AZURE"] = "azure";
|
|
@@ -12,6 +13,7 @@ export var AIProviderName;
|
|
|
12
13
|
AIProviderName["HUGGINGFACE"] = "huggingface";
|
|
13
14
|
AIProviderName["OLLAMA"] = "ollama";
|
|
14
15
|
AIProviderName["MISTRAL"] = "mistral";
|
|
16
|
+
AIProviderName["LITELLM"] = "litellm";
|
|
15
17
|
AIProviderName["AUTO"] = "auto";
|
|
16
18
|
})(AIProviderName || (AIProviderName = {}));
|
|
17
19
|
/**
|
|
@@ -71,6 +71,17 @@ export class ProviderRegistry {
|
|
|
71
71
|
const { OllamaProvider } = await import("../providers/ollama.js");
|
|
72
72
|
return new OllamaProvider(modelName);
|
|
73
73
|
}, process.env.OLLAMA_MODEL || "llama3.1:8b", ["ollama", "local"]);
|
|
74
|
+
// Register LiteLLM provider
|
|
75
|
+
ProviderFactory.registerProvider(AIProviderName.LITELLM, async (modelName, providerName, sdk) => {
|
|
76
|
+
const { LiteLLMProvider } = await import("../providers/litellm.js");
|
|
77
|
+
return new LiteLLMProvider(modelName, sdk);
|
|
78
|
+
}, process.env.LITELLM_MODEL || "openai/gpt-4o-mini", ["litellm"]);
|
|
79
|
+
// Register OpenAI Compatible provider
|
|
80
|
+
ProviderFactory.registerProvider(AIProviderName.OPENAI_COMPATIBLE, async (modelName, providerName, sdk) => {
|
|
81
|
+
const { OpenAICompatibleProvider } = await import("../providers/openaiCompatible.js");
|
|
82
|
+
return new OpenAICompatibleProvider(modelName, sdk);
|
|
83
|
+
}, process.env.OPENAI_COMPATIBLE_MODEL || undefined, // Enable auto-discovery when no model specified
|
|
84
|
+
["openai-compatible", "openrouter", "vllm", "compatible"]);
|
|
74
85
|
logger.debug("All providers registered successfully");
|
|
75
86
|
this.registered = true;
|
|
76
87
|
}
|