@node-llm/core 1.0.0 → 1.1.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/README.md +0 -164
- package/dist/aliases.json +126 -0
- package/dist/chat/Chat.d.ts +4 -1
- package/dist/chat/Chat.d.ts.map +1 -1
- package/dist/chat/Chat.js +2 -3
- package/dist/config.d.ts +1 -1
- package/dist/errors/index.d.ts +1 -1
- package/dist/errors/index.js +2 -2
- package/dist/index.d.ts +10 -18
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +10 -12
- package/dist/llm.d.ts +2 -2
- package/dist/llm.d.ts.map +1 -1
- package/dist/llm.js +18 -9
- package/dist/model_aliases.d.ts +3 -0
- package/dist/model_aliases.d.ts.map +1 -0
- package/dist/model_aliases.js +20 -0
- package/dist/models/models.js +17 -17
- package/dist/providers/BaseProvider.d.ts +3 -1
- package/dist/providers/BaseProvider.d.ts.map +1 -1
- package/dist/providers/BaseProvider.js +4 -1
- package/dist/providers/Provider.d.ts +1 -3
- package/dist/providers/Provider.d.ts.map +1 -1
- package/dist/providers/gemini/index.d.ts +1 -1
- package/dist/providers/gemini/index.js +1 -1
- package/dist/providers/ollama/index.d.ts +1 -1
- package/dist/providers/ollama/index.js +1 -1
- package/dist/providers/openai/index.d.ts +1 -1
- package/dist/providers/openai/index.js +1 -1
- package/dist/providers/openrouter/index.d.ts +1 -1
- package/dist/providers/openrouter/index.js +1 -1
- package/dist/providers/registry.js +1 -1
- package/package.json +2 -2
package/README.md
CHANGED
|
@@ -1,164 +0,0 @@
|
|
|
1
|
-
<p align="left">
|
|
2
|
-
<img src="../../docs/assets/images/logo.jpg" alt="node-llm logo" width="300" />
|
|
3
|
-
</p>
|
|
4
|
-
|
|
5
|
-
# @node-llm/core
|
|
6
|
-
|
|
7
|
-
[](https://www.npmjs.com/package/@node-llm/core)
|
|
8
|
-
[](https://opensource.org/licenses/MIT)
|
|
9
|
-
[](https://www.typescriptlang.org/)
|
|
10
|
-
|
|
11
|
-
**An opinionated architectural layer for using Large Language Models in Node.js.**
|
|
12
|
-
|
|
13
|
-
node-llm provides a unified, production-oriented API for interacting with over **540+ models** across multiple providers (OpenAI, Gemini, Anthropic, DeepSeek, OpenRouter, Ollama, etc.) without coupling your application to any single SDK.
|
|
14
|
-
|
|
15
|
-
---
|
|
16
|
-
|
|
17
|
-
## ⚡ The Golden Path
|
|
18
|
-
|
|
19
|
-
```ts
|
|
20
|
-
import { LLM } from "@node-llm/core";
|
|
21
|
-
|
|
22
|
-
// 1. Configure once
|
|
23
|
-
LLM.configure({ provider: "openai" });
|
|
24
|
-
|
|
25
|
-
// 2. Chat (High-level request/response)
|
|
26
|
-
const chat = LLM.chat("gpt-4o");
|
|
27
|
-
const response = await chat.ask("Explain event-driven architecture");
|
|
28
|
-
console.log(response.content);
|
|
29
|
-
|
|
30
|
-
// 3. Streaming (Standard AsyncIterator)
|
|
31
|
-
for await (const chunk of chat.stream("Explain event-driven architecture")) {
|
|
32
|
-
process.stdout.write(chunk.content);
|
|
33
|
-
}
|
|
34
|
-
```
|
|
35
|
-
|
|
36
|
-
---
|
|
37
|
-
|
|
38
|
-
### Why node-llm?
|
|
39
|
-
|
|
40
|
-
Most AI integrations today are provider-specific and create long-term architectural risk. node-llm exists to solve these problems by providing:
|
|
41
|
-
|
|
42
|
-
- **Provider Isolation**: Your application never touches a provider SDK directly.
|
|
43
|
-
- **Unified Mental Model**: Tools, vision, and structured outputs feel identical across providers.
|
|
44
|
-
- **Production-First**: Core concern for streaming, retries, and error handling.
|
|
45
|
-
|
|
46
|
-
<br/>
|
|
47
|
-
|
|
48
|
-
<p align="left">
|
|
49
|
-
<img src="https://registry.npmmirror.com/@lobehub/icons-static-svg/latest/files/icons/openai.svg" height="28" />
|
|
50
|
-
<img src="https://registry.npmmirror.com/@lobehub/icons-static-svg/latest/files/icons/openai-text.svg" height="22" />
|
|
51
|
-
|
|
52
|
-
<img src="https://registry.npmmirror.com/@lobehub/icons-static-svg/latest/files/icons/anthropic-text.svg" height="18" />
|
|
53
|
-
|
|
54
|
-
<img src="https://registry.npmmirror.com/@lobehub/icons-static-svg/latest/files/icons/gemini-color.svg" height="28" />
|
|
55
|
-
<img src="https://registry.npmmirror.com/@lobehub/icons-static-svg/latest/files/icons/gemini-text.svg" height="20" />
|
|
56
|
-
|
|
57
|
-
<img src="https://registry.npmmirror.com/@lobehub/icons-static-svg/latest/files/icons/deepseek-color.svg" height="28" />
|
|
58
|
-
<img src="https://registry.npmmirror.com/@lobehub/icons-static-svg/latest/files/icons/deepseek-text.svg" height="20" />
|
|
59
|
-
|
|
60
|
-
<img src="https://registry.npmmirror.com/@lobehub/icons-static-svg/latest/files/icons/openrouter.svg" height="28" />
|
|
61
|
-
<img src="https://registry.npmmirror.com/@lobehub/icons-static-svg/latest/files/icons/openrouter-text.svg" height="22" />
|
|
62
|
-
|
|
63
|
-
<img src="https://registry.npmmirror.com/@lobehub/icons-static-svg/latest/files/icons/ollama.svg" height="28" />
|
|
64
|
-
<img src="https://registry.npmmirror.com/@lobehub/icons-static-svg/latest/files/icons/ollama-text.svg" height="18" />
|
|
65
|
-
</p>
|
|
66
|
-
|
|
67
|
-
<br/>
|
|
68
|
-
|
|
69
|
-
---
|
|
70
|
-
|
|
71
|
-
## 🔮 Capabilities
|
|
72
|
-
|
|
73
|
-
### 💬 Unified Chat
|
|
74
|
-
Stop rewriting code for every provider. `node-llm` normalizes inputs and outputs into a single, predictable mental model.
|
|
75
|
-
```ts
|
|
76
|
-
const chat = LLM.chat(); // Defaults to GPT-4o
|
|
77
|
-
await chat.ask("Hello world");
|
|
78
|
-
```
|
|
79
|
-
|
|
80
|
-
### 👁️ Smart Vision & Files
|
|
81
|
-
Pass images, PDFs, or audio files directly. We handle the heavy lifting: fetching remote URLs, base64 encoding, and MIME type mapping.
|
|
82
|
-
```ts
|
|
83
|
-
await chat.ask("Analyze this interface", {
|
|
84
|
-
files: ["./screenshot.png", "https://example.com/spec.pdf"]
|
|
85
|
-
});
|
|
86
|
-
```
|
|
87
|
-
|
|
88
|
-
### 🛠️ Auto-Executing Tools
|
|
89
|
-
Define tools once; node-llm manages the recursive execution loop for you, keeping your controller logic clean.
|
|
90
|
-
```ts
|
|
91
|
-
const tools = [{
|
|
92
|
-
handler: async ({ loc }) => `Sunny in ${loc}`,
|
|
93
|
-
function: { name: 'get_weather', description: 'Get current weather', parameters: { ... } }
|
|
94
|
-
}];
|
|
95
|
-
|
|
96
|
-
await chat.withTools(tools).ask("Weather in Tokyo?");
|
|
97
|
-
```
|
|
98
|
-
|
|
99
|
-
### ✨ Structured Output
|
|
100
|
-
Get type-safe, validated JSON back using **Zod** schemas.
|
|
101
|
-
```ts
|
|
102
|
-
import { z } from "zod";
|
|
103
|
-
const Product = z.object({ name: z.string(), price: z.number() });
|
|
104
|
-
|
|
105
|
-
const res = await chat.withSchema(Product).ask("Generate a gadget");
|
|
106
|
-
console.log(res.parsed.name); // Full type-safety
|
|
107
|
-
```
|
|
108
|
-
|
|
109
|
-
### 🎨 Image Generation
|
|
110
|
-
```ts
|
|
111
|
-
await LLM.paint("A cyberpunk city in rain");
|
|
112
|
-
```
|
|
113
|
-
|
|
114
|
-
### 🎤 Audio Transcription
|
|
115
|
-
```ts
|
|
116
|
-
await LLM.transcribe("meeting-recording.wav");
|
|
117
|
-
```
|
|
118
|
-
|
|
119
|
-
### 🧠 Deep Reasoning
|
|
120
|
-
Direct access to the thought process of models like **DeepSeek R1** or **OpenAI o1/o3** using the `.reasoning` field.
|
|
121
|
-
```ts
|
|
122
|
-
const res = await LLM.chat("deepseek-reasoner").ask("Solve this logical puzzle");
|
|
123
|
-
console.log(res.reasoning); // Chain-of-thought
|
|
124
|
-
```
|
|
125
|
-
|
|
126
|
-
---
|
|
127
|
-
|
|
128
|
-
## 🚀 Why use this over official SDKs?
|
|
129
|
-
|
|
130
|
-
| Feature | node-llm | Official SDKs | Architectural Impact |
|
|
131
|
-
| :--- | :--- | :--- | :--- |
|
|
132
|
-
| **Provider Logic** | Transparently Handled | Exposed to your code | **Low Coupling** |
|
|
133
|
-
| **Streaming** | Standard `AsyncIterator` | Vendor-specific Events | **Predictable Data Flow** |
|
|
134
|
-
| **Tool Loops** | Automated Recursion | Manual implementation | **Reduced Boilerplate** |
|
|
135
|
-
| **Files/Vision** | Intelligent Path/URL handling | Base64/Buffer management | **Cleaner Service Layer** |
|
|
136
|
-
|
|
137
|
-
---
|
|
138
|
-
|
|
139
|
-
## 📋 Supported Providers
|
|
140
|
-
|
|
141
|
-
| Provider | Supported Features |
|
|
142
|
-
| :--- | :--- |
|
|
143
|
-
| <img src="https://registry.npmmirror.com/@lobehub/icons-static-svg/latest/files/icons/openai.svg" height="18"> **OpenAI** | Chat, Streaming, Tools, Vision, Audio, Images, Transcription, **Reasoning** |
|
|
144
|
-
| <img src="https://registry.npmmirror.com/@lobehub/icons-static-svg/latest/files/icons/gemini-color.svg" height="18"> **Gemini** | Chat, Streaming, Tools, Vision, Audio, Video, Embeddings |
|
|
145
|
-
| <img src="https://registry.npmmirror.com/@lobehub/icons-static-svg/latest/files/icons/anthropic-text.svg" height="12"> **Anthropic** | Chat, Streaming, Tools, Vision, PDF, Structured Output |
|
|
146
|
-
| <img src="https://registry.npmmirror.com/@lobehub/icons-static-svg/latest/files/icons/deepseek-color.svg" height="18"> **DeepSeek** | Chat (V3), **Reasoning (R1)**, Tools, Streaming |
|
|
147
|
-
| <img src="https://registry.npmmirror.com/@lobehub/icons-static-svg/latest/files/icons/openrouter.svg" height="18"> **OpenRouter** | **Aggregator**, Chat, Streaming, Tools, Vision, Embeddings, **Reasoning** |
|
|
148
|
-
| <img src="https://registry.npmmirror.com/@lobehub/icons-static-svg/latest/files/icons/ollama.svg" height="18"> **Ollama** | **Local Inference**, Chat, Streaming, Tools, Vision, Embeddings |
|
|
149
|
-
|
|
150
|
-
---
|
|
151
|
-
|
|
152
|
-
## 📚 Documentation & Installation
|
|
153
|
-
|
|
154
|
-
```bash
|
|
155
|
-
npm install @node-llm/core
|
|
156
|
-
```
|
|
157
|
-
|
|
158
|
-
**[View Full Documentation ↗](https://node-llm.eshaiju.com/)**
|
|
159
|
-
|
|
160
|
-
---
|
|
161
|
-
|
|
162
|
-
## 🫶 Credits
|
|
163
|
-
|
|
164
|
-
Heavily inspired by the elegant design of [RubyLLM](https://rubyllm.com/).
|
|
@@ -0,0 +1,126 @@
|
|
|
1
|
+
{
|
|
2
|
+
"chatgpt-4o": {
|
|
3
|
+
"openai": "chatgpt-4o-latest",
|
|
4
|
+
"openrouter": "openai/chatgpt-4o-latest"
|
|
5
|
+
},
|
|
6
|
+
"claude-3-5-haiku": {
|
|
7
|
+
"anthropic": "claude-3-5-haiku-20241022",
|
|
8
|
+
"openrouter": "anthropic/claude-3.5-haiku",
|
|
9
|
+
"bedrock": "anthropic.claude-3-5-haiku-20241022-v1:0"
|
|
10
|
+
},
|
|
11
|
+
"claude-3-5-sonnet": {
|
|
12
|
+
"anthropic": "claude-3-5-sonnet-20240620",
|
|
13
|
+
"openrouter": "anthropic/claude-3.5-sonnet",
|
|
14
|
+
"bedrock": "anthropic.claude-3-5-sonnet-20240620-v1:0"
|
|
15
|
+
},
|
|
16
|
+
"claude-3-7-sonnet": {
|
|
17
|
+
"anthropic": "claude-3-7-sonnet-20250219",
|
|
18
|
+
"openrouter": "anthropic/claude-3.7-sonnet",
|
|
19
|
+
"bedrock": "us.anthropic.claude-3-7-sonnet-20250219-v1:0"
|
|
20
|
+
},
|
|
21
|
+
"claude-3-haiku": {
|
|
22
|
+
"anthropic": "claude-3-haiku-20240307",
|
|
23
|
+
"openrouter": "anthropic/claude-3-haiku",
|
|
24
|
+
"bedrock": "anthropic.claude-3-haiku-20240307-v1:0:200k"
|
|
25
|
+
},
|
|
26
|
+
"claude-3-opus": {
|
|
27
|
+
"anthropic": "claude-3-opus-20240229",
|
|
28
|
+
"openrouter": "anthropic/claude-3-opus",
|
|
29
|
+
"bedrock": "anthropic.claude-3-opus-20240229-v1:0:200k"
|
|
30
|
+
},
|
|
31
|
+
"claude-3-sonnet": {
|
|
32
|
+
"bedrock": "anthropic.claude-3-sonnet-20240229-v1:0"
|
|
33
|
+
},
|
|
34
|
+
"deepseek-chat": {
|
|
35
|
+
"deepseek": "deepseek-chat",
|
|
36
|
+
"openrouter": "deepseek/deepseek-chat"
|
|
37
|
+
},
|
|
38
|
+
"gemini-flash": {
|
|
39
|
+
"gemini": "gemini-flash-latest",
|
|
40
|
+
"vertexai": "gemini-flash-latest",
|
|
41
|
+
"openrouter": "google/gemini-flash-latest"
|
|
42
|
+
},
|
|
43
|
+
"gemini-pro": {
|
|
44
|
+
"gemini": "gemini-1.5-pro-001",
|
|
45
|
+
"vertexai": "gemini-1.5-pro-001",
|
|
46
|
+
"openrouter": "google/gemini-1.5-pro-001"
|
|
47
|
+
},
|
|
48
|
+
"gemini-1.5-flash": {
|
|
49
|
+
"gemini": "gemini-1.5-flash-001",
|
|
50
|
+
"vertexai": "gemini-1.5-flash-001",
|
|
51
|
+
"openrouter": "google/gemini-1.5-flash-001"
|
|
52
|
+
},
|
|
53
|
+
"gemini-1.5-pro": {
|
|
54
|
+
"gemini": "gemini-1.5-pro-001",
|
|
55
|
+
"vertexai": "gemini-1.5-pro-001",
|
|
56
|
+
"openrouter": "google/gemini-1.5-pro-001"
|
|
57
|
+
},
|
|
58
|
+
"gemini-2.0-flash": {
|
|
59
|
+
"gemini": "gemini-2.0-flash",
|
|
60
|
+
"vertexai": "gemini-2.0-flash"
|
|
61
|
+
},
|
|
62
|
+
"gemini-2.0-flash-001": {
|
|
63
|
+
"gemini": "gemini-2.0-flash-001",
|
|
64
|
+
"openrouter": "google/gemini-2.0-flash-001",
|
|
65
|
+
"vertexai": "gemini-2.0-flash-001"
|
|
66
|
+
},
|
|
67
|
+
"gpt-3.5-turbo": {
|
|
68
|
+
"openai": "gpt-3.5-turbo",
|
|
69
|
+
"openrouter": "openai/gpt-3.5-turbo"
|
|
70
|
+
},
|
|
71
|
+
"gpt-4": {
|
|
72
|
+
"openai": "gpt-4",
|
|
73
|
+
"openrouter": "openai/gpt-4"
|
|
74
|
+
},
|
|
75
|
+
"gpt-4-turbo": {
|
|
76
|
+
"openai": "gpt-4-turbo",
|
|
77
|
+
"openrouter": "openai/gpt-4-turbo"
|
|
78
|
+
},
|
|
79
|
+
"gpt-4o": {
|
|
80
|
+
"openai": "gpt-4o",
|
|
81
|
+
"openrouter": "openai/gpt-4o"
|
|
82
|
+
},
|
|
83
|
+
"gpt-4o-mini": {
|
|
84
|
+
"openai": "gpt-4o-mini",
|
|
85
|
+
"openrouter": "openai/gpt-4o-mini"
|
|
86
|
+
},
|
|
87
|
+
"llama-3-1-405b": {
|
|
88
|
+
"openrouter": "meta-llama/llama-3.1-405b"
|
|
89
|
+
},
|
|
90
|
+
"llama-3-1-405b-instruct": {
|
|
91
|
+
"openrouter": "meta-llama/llama-3.1-405b-instruct"
|
|
92
|
+
},
|
|
93
|
+
"llama-3-1-70b": {
|
|
94
|
+
"openrouter": "meta-llama/llama-3.1-70b"
|
|
95
|
+
},
|
|
96
|
+
"llama-3-1-70b-instruct": {
|
|
97
|
+
"openrouter": "meta-llama/llama-3.1-70b-instruct"
|
|
98
|
+
},
|
|
99
|
+
"llama-3-1-8b": {
|
|
100
|
+
"openrouter": "meta-llama/llama-3.1-8b"
|
|
101
|
+
},
|
|
102
|
+
"llama-3-1-8b-instruct": {
|
|
103
|
+
"openrouter": "meta-llama/llama-3.1-8b-instruct"
|
|
104
|
+
},
|
|
105
|
+
"llama-3-2-1b-instruct": {
|
|
106
|
+
"openrouter": "meta-llama/llama-3.2-1b-instruct"
|
|
107
|
+
},
|
|
108
|
+
"llama-3-2-3b-instruct": {
|
|
109
|
+
"openrouter": "meta-llama/llama-3.2-3b-instruct"
|
|
110
|
+
},
|
|
111
|
+
"llama-3-3-70b-instruct": {
|
|
112
|
+
"openrouter": "meta-llama/llama-3.3-70b-instruct"
|
|
113
|
+
},
|
|
114
|
+
"mistral-large": {
|
|
115
|
+
"mistral": "mistral-large-latest",
|
|
116
|
+
"openrouter": "mistralai/mistral-large"
|
|
117
|
+
},
|
|
118
|
+
"mistral-medium": {
|
|
119
|
+
"mistral": "mistral-medium-latest",
|
|
120
|
+
"openrouter": "mistralai/mistral-medium"
|
|
121
|
+
},
|
|
122
|
+
"mistral-small": {
|
|
123
|
+
"mistral": "mistral-small-latest",
|
|
124
|
+
"openrouter": "mistralai/mistral-small"
|
|
125
|
+
}
|
|
126
|
+
}
|
package/dist/chat/Chat.d.ts
CHANGED
|
@@ -19,7 +19,10 @@ export declare class Chat {
|
|
|
19
19
|
private readonly options;
|
|
20
20
|
private messages;
|
|
21
21
|
private executor;
|
|
22
|
-
constructor(provider: Provider, model: string, options?: ChatOptions
|
|
22
|
+
constructor(provider: Provider, model: string, options?: ChatOptions, retryConfig?: {
|
|
23
|
+
attempts: number;
|
|
24
|
+
delayMs: number;
|
|
25
|
+
});
|
|
23
26
|
/**
|
|
24
27
|
* Read-only access to message history
|
|
25
28
|
*/
|
package/dist/chat/Chat.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Chat.d.ts","sourceRoot":"","sources":["../../src/chat/Chat.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,OAAO,EAAE,MAAM,cAAc,CAAC;AACvC,OAAO,EAAE,WAAW,EAAE,MAAM,kBAAkB,CAAC;AAC/C,OAAO,EAAE,QAAQ,EAAE,KAAK,EAAE,SAAS,EAAE,MAAM,0BAA0B,CAAC;
|
|
1
|
+
{"version":3,"file":"Chat.d.ts","sourceRoot":"","sources":["../../src/chat/Chat.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,OAAO,EAAE,MAAM,cAAc,CAAC;AACvC,OAAO,EAAE,WAAW,EAAE,MAAM,kBAAkB,CAAC;AAC/C,OAAO,EAAE,QAAQ,EAAE,KAAK,EAAE,SAAS,EAAE,MAAM,0BAA0B,CAAC;AAGtE,OAAO,EAAE,MAAM,EAAE,MAAM,wBAAwB,CAAC;AACh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/dist/chat/Chat.js
CHANGED
|
@@ -1,6 +1,5 @@
|
|
|
1
1
|
import { FileLoader } from "../utils/FileLoader.js";
|
|
2
2
|
import { Executor } from "../executor/Executor.js";
|
|
3
|
-
import { LLM } from "../llm.js";
|
|
4
3
|
import { ChatStream } from "./ChatStream.js";
|
|
5
4
|
import { Schema } from "../schema/Schema.js";
|
|
6
5
|
import { toJsonSchema } from "../schema/to-json-schema.js";
|
|
@@ -12,11 +11,11 @@ export class Chat {
|
|
|
12
11
|
options;
|
|
13
12
|
messages = [];
|
|
14
13
|
executor;
|
|
15
|
-
constructor(provider, model, options = {}) {
|
|
14
|
+
constructor(provider, model, options = {}, retryConfig = { attempts: 1, delayMs: 0 }) {
|
|
16
15
|
this.provider = provider;
|
|
17
16
|
this.model = model;
|
|
18
17
|
this.options = options;
|
|
19
|
-
this.executor = new Executor(provider,
|
|
18
|
+
this.executor = new Executor(provider, retryConfig);
|
|
20
19
|
if (options.systemPrompt) {
|
|
21
20
|
this.messages.push({
|
|
22
21
|
role: "system",
|
package/dist/config.d.ts
CHANGED
package/dist/errors/index.d.ts
CHANGED
|
@@ -64,7 +64,7 @@ export declare class CapabilityError extends LLMError {
|
|
|
64
64
|
constructor(message: string);
|
|
65
65
|
}
|
|
66
66
|
/**
|
|
67
|
-
* Thrown when
|
|
67
|
+
* Thrown when NodeLLM provider is not configured
|
|
68
68
|
*/
|
|
69
69
|
export declare class ProviderNotConfiguredError extends LLMError {
|
|
70
70
|
constructor();
|
package/dist/errors/index.js
CHANGED
|
@@ -96,11 +96,11 @@ export class CapabilityError extends LLMError {
|
|
|
96
96
|
}
|
|
97
97
|
}
|
|
98
98
|
/**
|
|
99
|
-
* Thrown when
|
|
99
|
+
* Thrown when NodeLLM provider is not configured
|
|
100
100
|
*/
|
|
101
101
|
export class ProviderNotConfiguredError extends LLMError {
|
|
102
102
|
constructor() {
|
|
103
|
-
super("
|
|
103
|
+
super("NodeLLM provider not configured", "PROVIDER_NOT_CONFIGURED");
|
|
104
104
|
}
|
|
105
105
|
}
|
|
106
106
|
/**
|
package/dist/index.d.ts
CHANGED
|
@@ -1,23 +1,15 @@
|
|
|
1
|
-
export
|
|
2
|
-
export
|
|
3
|
-
export
|
|
4
|
-
export
|
|
5
|
-
export
|
|
6
|
-
export
|
|
7
|
-
export
|
|
8
|
-
export
|
|
1
|
+
export * from "./chat/Message.js";
|
|
2
|
+
export * from "./chat/Content.js";
|
|
3
|
+
export * from "./chat/Tool.js";
|
|
4
|
+
export * from "./chat/ChatOptions.js";
|
|
5
|
+
export * from "./chat/ChatResponse.js";
|
|
6
|
+
export * from "./chat/Chat.js";
|
|
7
|
+
export * from "./chat/ChatStream.js";
|
|
8
|
+
export * from "./streaming/Stream.js";
|
|
9
9
|
export { z } from "zod";
|
|
10
|
-
export {
|
|
10
|
+
export { NodeLLM, Transcription, Moderation, Embedding } from "./llm.js";
|
|
11
11
|
export { config } from "./config.js";
|
|
12
12
|
export type { NodeLLMConfig } from "./config.js";
|
|
13
13
|
export { providerRegistry } from "./providers/registry.js";
|
|
14
|
-
export {
|
|
15
|
-
export { OpenAIProvider } from "./providers/openai/OpenAIProvider.js";
|
|
16
|
-
export { registerOpenAIProvider } from "./providers/openai/index.js";
|
|
17
|
-
export { registerAnthropicProvider } from "./providers/anthropic/index.js";
|
|
18
|
-
export { registerOllamaProvider, OllamaProvider } from "./providers/ollama/index.js";
|
|
19
|
-
export { OpenRouterProvider } from "./providers/openrouter/OpenRouterProvider.js";
|
|
20
|
-
export { registerOpenRouterProvider } from "./providers/registry.js";
|
|
21
|
-
export type { ImageRequest, ImageResponse } from "./providers/Provider.js";
|
|
22
|
-
export * from "./errors/index.js";
|
|
14
|
+
export { Schema } from "./schema/Schema.js";
|
|
23
15
|
//# sourceMappingURL=index.d.ts.map
|
package/dist/index.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,cAAc,mBAAmB,CAAC;AAClC,cAAc,mBAAmB,CAAC;AAClC,cAAc,gBAAgB,CAAC;AAC/B,cAAc,uBAAuB,CAAC;AACtC,cAAc,wBAAwB,CAAC;AACvC,cAAc,gBAAgB,CAAC;AAC/B,cAAc,sBAAsB,CAAC;AACrC,cAAc,uBAAuB,CAAC;AAEtC,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAExB,OAAO,EAAE,OAAO,EAAE,aAAa,EAAE,UAAU,EAAE,SAAS,EAAE,MAAM,UAAU,CAAC;AACzE,OAAO,EAAE,MAAM,EAAE,MAAM,aAAa,CAAC;AACrC,YAAY,EAAE,aAAa,EAAE,MAAM,aAAa,CAAC;AACjD,OAAO,EAAE,gBAAgB,EAAE,MAAM,yBAAyB,CAAC;AAC3D,OAAO,EAAE,MAAM,EAAE,MAAM,oBAAoB,CAAC"}
|
package/dist/index.js
CHANGED
|
@@ -1,15 +1,13 @@
|
|
|
1
|
-
export
|
|
2
|
-
export
|
|
3
|
-
export
|
|
1
|
+
export * from "./chat/Message.js";
|
|
2
|
+
export * from "./chat/Content.js";
|
|
3
|
+
export * from "./chat/Tool.js";
|
|
4
|
+
export * from "./chat/ChatOptions.js";
|
|
5
|
+
export * from "./chat/ChatResponse.js";
|
|
6
|
+
export * from "./chat/Chat.js";
|
|
7
|
+
export * from "./chat/ChatStream.js";
|
|
8
|
+
export * from "./streaming/Stream.js";
|
|
4
9
|
export { z } from "zod";
|
|
5
|
-
export {
|
|
10
|
+
export { NodeLLM, Transcription, Moderation, Embedding } from "./llm.js";
|
|
6
11
|
export { config } from "./config.js";
|
|
7
12
|
export { providerRegistry } from "./providers/registry.js";
|
|
8
|
-
export {
|
|
9
|
-
export { OpenAIProvider } from "./providers/openai/OpenAIProvider.js";
|
|
10
|
-
export { registerOpenAIProvider } from "./providers/openai/index.js";
|
|
11
|
-
export { registerAnthropicProvider } from "./providers/anthropic/index.js";
|
|
12
|
-
export { registerOllamaProvider, OllamaProvider } from "./providers/ollama/index.js";
|
|
13
|
-
export { OpenRouterProvider } from "./providers/openrouter/OpenRouterProvider.js";
|
|
14
|
-
export { registerOpenRouterProvider } from "./providers/registry.js";
|
|
15
|
-
export * from "./errors/index.js";
|
|
13
|
+
export { Schema } from "./schema/Schema.js";
|
package/dist/llm.d.ts
CHANGED
|
@@ -18,7 +18,7 @@ type LLMConfig = {
|
|
|
18
18
|
defaultModerationModel?: string;
|
|
19
19
|
defaultEmbeddingModel?: string;
|
|
20
20
|
} & Partial<NodeLLMConfig>;
|
|
21
|
-
declare class
|
|
21
|
+
declare class NodeLLMCore {
|
|
22
22
|
readonly models: typeof ModelRegistry;
|
|
23
23
|
readonly config: {
|
|
24
24
|
openaiApiKey?: string;
|
|
@@ -71,5 +71,5 @@ declare class LLMCore {
|
|
|
71
71
|
}): Promise<Embedding>;
|
|
72
72
|
}
|
|
73
73
|
export { Transcription, Moderation, Embedding };
|
|
74
|
-
export declare const
|
|
74
|
+
export declare const NodeLLM: NodeLLMCore;
|
|
75
75
|
//# sourceMappingURL=llm.d.ts.map
|
package/dist/llm.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"llm.d.ts","sourceRoot":"","sources":["../src/llm.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,IAAI,EAAE,MAAM,gBAAgB,CAAC;AACtC,OAAO,EAAE,WAAW,EAAE,MAAM,uBAAuB,CAAC;AACpD,OAAO,EACL,QAAQ,EACR,SAAS,
|
|
1
|
+
{"version":3,"file":"llm.d.ts","sourceRoot":"","sources":["../src/llm.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,IAAI,EAAE,MAAM,gBAAgB,CAAC;AACtC,OAAO,EAAE,WAAW,EAAE,MAAM,uBAAuB,CAAC;AACpD,OAAO,EACL,QAAQ,EACR,SAAS,EAIV,MAAM,yBAAyB,CAA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"}
|
package/dist/llm.js
CHANGED
|
@@ -6,6 +6,7 @@ import { Transcription } from "./transcription/Transcription.js";
|
|
|
6
6
|
import { Moderation } from "./moderation/Moderation.js";
|
|
7
7
|
import { Embedding } from "./embedding/Embedding.js";
|
|
8
8
|
import { ProviderNotConfiguredError, UnsupportedFeatureError, ModelCapabilityError } from "./errors/index.js";
|
|
9
|
+
import { resolveModelAlias } from "./model_aliases.js";
|
|
9
10
|
import { config } from "./config.js";
|
|
10
11
|
// Provider registration map
|
|
11
12
|
const PROVIDER_REGISTRARS = {
|
|
@@ -16,7 +17,7 @@ const PROVIDER_REGISTRARS = {
|
|
|
16
17
|
ollama: registerOllamaProvider,
|
|
17
18
|
openrouter: registerOpenRouterProvider,
|
|
18
19
|
};
|
|
19
|
-
class
|
|
20
|
+
class NodeLLMCore {
|
|
20
21
|
models = ModelRegistry;
|
|
21
22
|
config = config;
|
|
22
23
|
provider;
|
|
@@ -79,7 +80,9 @@ class LLMCore {
|
|
|
79
80
|
if (!this.provider) {
|
|
80
81
|
throw new ProviderNotConfiguredError();
|
|
81
82
|
}
|
|
82
|
-
|
|
83
|
+
// Resolve model alias based on the current provider
|
|
84
|
+
const resolvedModel = resolveModelAlias(model, this.provider.id);
|
|
85
|
+
return new Chat(this.provider, resolvedModel, options, this.retry);
|
|
83
86
|
}
|
|
84
87
|
async listModels() {
|
|
85
88
|
const provider = this.ensureProviderSupport("listModels");
|
|
@@ -90,7 +93,9 @@ class LLMCore {
|
|
|
90
93
|
}
|
|
91
94
|
async paint(prompt, options) {
|
|
92
95
|
const provider = this.ensureProviderSupport("paint");
|
|
93
|
-
|
|
96
|
+
// Default to resolving aliases
|
|
97
|
+
const rawModel = options?.model;
|
|
98
|
+
const model = resolveModelAlias(rawModel || "", provider.id);
|
|
94
99
|
if (options?.assumeModelExists) {
|
|
95
100
|
console.warn(`[NodeLLM] Skipping validation for model ${model}`);
|
|
96
101
|
}
|
|
@@ -100,12 +105,14 @@ class LLMCore {
|
|
|
100
105
|
const response = await provider.paint({
|
|
101
106
|
prompt,
|
|
102
107
|
...options,
|
|
108
|
+
model,
|
|
103
109
|
});
|
|
104
110
|
return new GeneratedImage(response);
|
|
105
111
|
}
|
|
106
112
|
async transcribe(file, options) {
|
|
107
113
|
const provider = this.ensureProviderSupport("transcribe");
|
|
108
|
-
const
|
|
114
|
+
const rawModel = options?.model || this.defaultTranscriptionModelId || "";
|
|
115
|
+
const model = resolveModelAlias(rawModel, provider.id);
|
|
109
116
|
if (options?.assumeModelExists) {
|
|
110
117
|
console.warn(`[NodeLLM] Skipping validation for model ${model}`);
|
|
111
118
|
}
|
|
@@ -114,8 +121,8 @@ class LLMCore {
|
|
|
114
121
|
}
|
|
115
122
|
const response = await provider.transcribe({
|
|
116
123
|
file,
|
|
117
|
-
model,
|
|
118
124
|
...options,
|
|
125
|
+
model,
|
|
119
126
|
});
|
|
120
127
|
return new Transcription(response);
|
|
121
128
|
}
|
|
@@ -133,7 +140,8 @@ class LLMCore {
|
|
|
133
140
|
}
|
|
134
141
|
async moderate(input, options) {
|
|
135
142
|
const provider = this.ensureProviderSupport("moderate");
|
|
136
|
-
const
|
|
143
|
+
const rawModel = options?.model || this.defaultModerationModelId || "";
|
|
144
|
+
const model = resolveModelAlias(rawModel, provider.id);
|
|
137
145
|
if (options?.assumeModelExists) {
|
|
138
146
|
console.warn(`[NodeLLM] Skipping validation for model ${model}`);
|
|
139
147
|
}
|
|
@@ -142,14 +150,15 @@ class LLMCore {
|
|
|
142
150
|
}
|
|
143
151
|
const response = await provider.moderate({
|
|
144
152
|
input,
|
|
145
|
-
model,
|
|
146
153
|
...options,
|
|
154
|
+
model,
|
|
147
155
|
});
|
|
148
156
|
return new Moderation(response);
|
|
149
157
|
}
|
|
150
158
|
async embed(input, options) {
|
|
151
159
|
const provider = this.ensureProviderSupport("embed");
|
|
152
|
-
const
|
|
160
|
+
const rawModel = options?.model || this.defaultEmbeddingModelId || "";
|
|
161
|
+
const model = resolveModelAlias(rawModel, provider.id);
|
|
153
162
|
const request = {
|
|
154
163
|
input,
|
|
155
164
|
model,
|
|
@@ -166,4 +175,4 @@ class LLMCore {
|
|
|
166
175
|
}
|
|
167
176
|
}
|
|
168
177
|
export { Transcription, Moderation, Embedding };
|
|
169
|
-
export const
|
|
178
|
+
export const NodeLLM = new NodeLLMCore();
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"model_aliases.d.ts","sourceRoot":"","sources":["../src/model_aliases.ts"],"names":[],"mappings":"AAKA,MAAM,MAAM,YAAY,GAAG,QAAQ,GAAG,WAAW,GAAG,QAAQ,GAAG,UAAU,GAAG,YAAY,GAAG,SAAS,GAAG,UAAU,GAAG,SAAS,GAAG,MAAM,CAAC;AAEvI,wBAAgB,iBAAiB,CAAC,KAAK,EAAE,MAAM,EAAE,QAAQ,CAAC,EAAE,YAAY,GAAG,MAAM,CAkBhF"}
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
// This file is auto-generated or manually maintained to map generic model aliases
|
|
2
|
+
// to provider-specific model IDs.
|
|
3
|
+
// @ts-ignore
|
|
4
|
+
import aliases from "./aliases.json" assert { type: "json" };
|
|
5
|
+
export function resolveModelAlias(alias, provider) {
|
|
6
|
+
if (!provider) {
|
|
7
|
+
return alias;
|
|
8
|
+
}
|
|
9
|
+
// Check if the alias exists in our registry
|
|
10
|
+
const aliasEntry = aliases[alias];
|
|
11
|
+
if (aliasEntry) {
|
|
12
|
+
// Check if there is a specific mapping for this provider
|
|
13
|
+
if (aliasEntry[provider.toLowerCase()]) {
|
|
14
|
+
return aliasEntry[provider.toLowerCase()];
|
|
15
|
+
}
|
|
16
|
+
}
|
|
17
|
+
// If no alias found or no mapping for this provider, return the original string
|
|
18
|
+
// This allows users to pass raw model IDs that aren't in our alias list.
|
|
19
|
+
return alias;
|
|
20
|
+
}
|
package/dist/models/models.js
CHANGED
|
@@ -9419,7 +9419,7 @@ export const modelsData = [
|
|
|
9419
9419
|
}
|
|
9420
9420
|
},
|
|
9421
9421
|
"metadata": {
|
|
9422
|
-
"description": "Virtuoso‑Large is Arcee's top‑tier general‑purpose
|
|
9422
|
+
"description": "Virtuoso‑Large is Arcee's top‑tier general‑purpose NodeLLM at 72 B parameters, tuned to tackle cross‑domain reasoning, creative writing and enterprise QA. Unlike many 70 B peers, it retains the 128 k context inherited from Qwen 2.5, letting it ingest books, codebases or financial filings wholesale. Training blended DeepSeek R1 distillation, multi‑epoch supervised fine‑tuning and a final DPO/RLHF alignment stage, yielding strong performance on BIG‑Bench‑Hard, GSM‑8K and long‑context Needle‑In‑Haystack tests. Enterprises use Virtuoso‑Large as the \"fallback\" brain in Conductor pipelines when other SLMs flag low confidence. Despite its size, aggressive KV‑cache optimizations keep first‑token latency in the low‑second range on 8× H100 nodes, making it a practical production‑grade powerhouse.",
|
|
9423
9423
|
"architecture": {
|
|
9424
9424
|
"modality": "text->text",
|
|
9425
9425
|
"input_modalities": [
|
|
@@ -9771,7 +9771,7 @@ export const modelsData = [
|
|
|
9771
9771
|
}
|
|
9772
9772
|
},
|
|
9773
9773
|
"metadata": {
|
|
9774
|
-
"description": "ERNIE-4.5-300B-A47B is a 300B parameter Mixture-of-Experts (MoE) language model developed by Baidu as part of the ERNIE 4.5 series. It activates 47B parameters per token and supports text generation in both English and Chinese. Optimized for high-throughput inference and efficient scaling, it uses a heterogeneous MoE structure with advanced routing and quantization strategies, including FP8 and 2-bit formats. This version is fine-tuned for language-only tasks and supports reasoning, tool parameters, and extended context lengths up to 131k tokens. Suitable for general-purpose
|
|
9774
|
+
"description": "ERNIE-4.5-300B-A47B is a 300B parameter Mixture-of-Experts (MoE) language model developed by Baidu as part of the ERNIE 4.5 series. It activates 47B parameters per token and supports text generation in both English and Chinese. Optimized for high-throughput inference and efficient scaling, it uses a heterogeneous MoE structure with advanced routing and quantization strategies, including FP8 and 2-bit formats. This version is fine-tuned for language-only tasks and supports reasoning, tool parameters, and extended context lengths up to 131k tokens. Suitable for general-purpose NodeLLM applications with high reasoning and throughput demands.",
|
|
9775
9775
|
"architecture": {
|
|
9776
9776
|
"modality": "text->text",
|
|
9777
9777
|
"input_modalities": [
|
|
@@ -11794,7 +11794,7 @@ export const modelsData = [
|
|
|
11794
11794
|
}
|
|
11795
11795
|
},
|
|
11796
11796
|
"metadata": {
|
|
11797
|
-
"description": "A large
|
|
11797
|
+
"description": "A large NodeLLM created by combining two fine-tuned Llama 70B models into one 120B model. Combines Xwin and Euryale.\n\nCredits to\n- [@chargoddard](https://huggingface.co/chargoddard) for developing the framework used to merge the model - [mergekit](https://github.com/cg123/mergekit).\n- [@Undi95](https://huggingface.co/Undi95) for helping with the merge ratios.\n\n#merge",
|
|
11798
11798
|
"architecture": {
|
|
11799
11799
|
"modality": "text->text",
|
|
11800
11800
|
"input_modalities": [
|
|
@@ -13893,7 +13893,7 @@ export const modelsData = [
|
|
|
13893
13893
|
}
|
|
13894
13894
|
},
|
|
13895
13895
|
"metadata": {
|
|
13896
|
-
"description": "Llama Guard 3 is a Llama-3.1-8B pretrained model, fine-tuned for content safety classification. Similar to previous versions, it can be used to classify content in both
|
|
13896
|
+
"description": "Llama Guard 3 is a Llama-3.1-8B pretrained model, fine-tuned for content safety classification. Similar to previous versions, it can be used to classify content in both NodeLLM inputs (prompt classification) and in NodeLLM responses (response classification). It acts as an NodeLLM – it generates text in its output that indicates whether a given prompt or response is safe or unsafe, and if unsafe, it also lists the content categories violated.\n\nLlama Guard 3 was aligned to safeguard against the MLCommons standardized hazards taxonomy and designed to support Llama 3.1 capabilities. Specifically, it provides content moderation in 8 languages, and was optimized to support safety and security for search and code interpreter tool calls.\n",
|
|
13897
13897
|
"architecture": {
|
|
13898
13898
|
"modality": "text->text",
|
|
13899
13899
|
"input_modalities": [
|
|
@@ -14926,7 +14926,7 @@ export const modelsData = [
|
|
|
14926
14926
|
}
|
|
14927
14927
|
},
|
|
14928
14928
|
"metadata": {
|
|
14929
|
-
"description": "The Meta Llama 3.3 multilingual large language model (
|
|
14929
|
+
"description": "The Meta Llama 3.3 multilingual large language model (NodeLLM) is a pretrained and instruction tuned generative model in 70B (text in/text out). The Llama 3.3 instruction tuned text only model is optimized for multilingual dialogue use cases and outperforms many of the available open source and closed chat models on common industry benchmarks.\n\nSupported languages: English, German, French, Italian, Portuguese, Hindi, Spanish, and Thai.\n\n[Model Card](https://github.com/meta-llama/llama-models/blob/main/models/llama3_3/MODEL_CARD.md)",
|
|
14930
14930
|
"architecture": {
|
|
14931
14931
|
"modality": "text->text",
|
|
14932
14932
|
"input_modalities": [
|
|
@@ -14989,7 +14989,7 @@ export const modelsData = [
|
|
|
14989
14989
|
],
|
|
14990
14990
|
"pricing": {},
|
|
14991
14991
|
"metadata": {
|
|
14992
|
-
"description": "The Meta Llama 3.3 multilingual large language model (
|
|
14992
|
+
"description": "The Meta Llama 3.3 multilingual large language model (NodeLLM) is a pretrained and instruction tuned generative model in 70B (text in/text out). The Llama 3.3 instruction tuned text only model is optimized for multilingual dialogue use cases and outperforms many of the available open source and closed chat models on common industry benchmarks.\n\nSupported languages: English, German, French, Italian, Portuguese, Hindi, Spanish, and Thai.\n\n[Model Card](https://github.com/meta-llama/llama-models/blob/main/models/llama3_3/MODEL_CARD.md)",
|
|
14993
14993
|
"architecture": {
|
|
14994
14994
|
"modality": "text->text",
|
|
14995
14995
|
"input_modalities": [
|
|
@@ -15197,7 +15197,7 @@ export const modelsData = [
|
|
|
15197
15197
|
}
|
|
15198
15198
|
},
|
|
15199
15199
|
"metadata": {
|
|
15200
|
-
"description": "Llama Guard 4 is a Llama 4 Scout-derived multimodal pretrained model, fine-tuned for content safety classification. Similar to previous versions, it can be used to classify content in both
|
|
15200
|
+
"description": "Llama Guard 4 is a Llama 4 Scout-derived multimodal pretrained model, fine-tuned for content safety classification. Similar to previous versions, it can be used to classify content in both NodeLLM inputs (prompt classification) and in NodeLLM responses (response classification). It acts as an NodeLLM—generating text in its output that indicates whether a given prompt or response is safe or unsafe, and if unsafe, it also lists the content categories violated.\n\nLlama Guard 4 was aligned to safeguard against the standardized MLCommons hazards taxonomy and designed to support multimodal Llama 4 capabilities. Specifically, it combines features from previous Llama Guard models, providing content moderation for English and multiple supported languages, along with enhanced capabilities to handle mixed text-and-image prompts, including multiple images. Additionally, Llama Guard 4 is integrated into the Llama Moderations API, extending robust safety classification to text and images.",
|
|
15201
15201
|
"architecture": {
|
|
15202
15202
|
"modality": "text+image->text",
|
|
15203
15203
|
"input_modalities": [
|
|
@@ -15262,7 +15262,7 @@ export const modelsData = [
|
|
|
15262
15262
|
}
|
|
15263
15263
|
},
|
|
15264
15264
|
"metadata": {
|
|
15265
|
-
"description": "This safeguard model has 8B parameters and is based on the Llama 3 family. Just like is predecessor, [LlamaGuard 1](https://huggingface.co/meta-llama/LlamaGuard-7b), it can do both prompt and response classification.\n\nLlamaGuard 2 acts as a normal
|
|
15265
|
+
"description": "This safeguard model has 8B parameters and is based on the Llama 3 family. Just like is predecessor, [LlamaGuard 1](https://huggingface.co/meta-llama/LlamaGuard-7b), it can do both prompt and response classification.\n\nLlamaGuard 2 acts as a normal NodeLLM would, generating text that indicates whether the given input/output is safe/unsafe. If deemed unsafe, it will also share the content categories violated.\n\nFor best results, please use raw prompt input or the `/completions` endpoint, instead of the chat API.\n\nIt has demonstrated strong performance compared to leading closed-source models in human evaluations.\n\nTo read more about the model release, [click here](https://ai.meta.com/blog/meta-llama-3/). Usage of this model is subject to [Meta's Acceptable Use Policy](https://llama.meta.com/llama3/use-policy/).",
|
|
15266
15266
|
"architecture": {
|
|
15267
15267
|
"modality": "text->text",
|
|
15268
15268
|
"input_modalities": [
|
|
@@ -15947,7 +15947,7 @@ export const modelsData = [
|
|
|
15947
15947
|
}
|
|
15948
15948
|
},
|
|
15949
15949
|
"metadata": {
|
|
15950
|
-
"description": "MiniMax-01 is a combines MiniMax-Text-01 for text generation and MiniMax-VL-01 for image understanding. It has 456 billion parameters, with 45.9 billion parameters activated per inference, and can handle a context of up to 4 million tokens.\n\nThe text model adopts a hybrid architecture that combines Lightning Attention, Softmax Attention, and Mixture-of-Experts (MoE). The image model adopts the “ViT-MLP-
|
|
15950
|
+
"description": "MiniMax-01 is a combines MiniMax-Text-01 for text generation and MiniMax-VL-01 for image understanding. It has 456 billion parameters, with 45.9 billion parameters activated per inference, and can handle a context of up to 4 million tokens.\n\nThe text model adopts a hybrid architecture that combines Lightning Attention, Softmax Attention, and Mixture-of-Experts (MoE). The image model adopts the “ViT-MLP-NodeLLM” framework and is trained on top of the text model.\n\nTo read more about the release, see: https://www.minimaxi.com/en/news/minimax-01-series-2",
|
|
15951
15951
|
"architecture": {
|
|
15952
15952
|
"modality": "text+image->text",
|
|
15953
15953
|
"input_modalities": [
|
|
@@ -16583,7 +16583,7 @@ export const modelsData = [
|
|
|
16583
16583
|
}
|
|
16584
16584
|
},
|
|
16585
16585
|
"metadata": {
|
|
16586
|
-
"description": "Devstral-Small-2505 is a 24B parameter agentic
|
|
16586
|
+
"description": "Devstral-Small-2505 is a 24B parameter agentic NodeLLM fine-tuned from Mistral-Small-3.1, jointly developed by Mistral AI and All Hands AI for advanced software engineering tasks. It is optimized for codebase exploration, multi-file editing, and integration into coding agents, achieving state-of-the-art results on SWE-Bench Verified (46.8%).\n\nDevstral supports a 128k context window and uses a custom Tekken tokenizer. It is text-only, with the vision encoder removed, and is suitable for local deployment on high-end consumer hardware (e.g., RTX 4090, 32GB RAM Macs). Devstral is best used in agentic workflows via the OpenHands scaffold and is compatible with inference frameworks like vLLM, Transformers, and Ollama. It is released under the Apache 2.0 license.",
|
|
16587
16587
|
"architecture": {
|
|
16588
16588
|
"modality": "text->text",
|
|
16589
16589
|
"input_modalities": [
|
|
@@ -19601,7 +19601,7 @@ export const modelsData = [
|
|
|
19601
19601
|
}
|
|
19602
19602
|
},
|
|
19603
19603
|
"metadata": {
|
|
19604
|
-
"description": "Llama-3.1-Nemotron-Ultra-253B-v1 is a large language model (
|
|
19604
|
+
"description": "Llama-3.1-Nemotron-Ultra-253B-v1 is a large language model (NodeLLM) optimized for advanced reasoning, human-interactive chat, retrieval-augmented generation (RAG), and tool-calling tasks. Derived from Meta’s Llama-3.1-405B-Instruct, it has been significantly customized using Neural Architecture Search (NAS), resulting in enhanced efficiency, reduced memory usage, and improved inference latency. The model supports a context length of up to 128K tokens and can operate efficiently on an 8x NVIDIA H100 node.\n\nNote: you must include `detailed thinking on` in the system prompt to enable reasoning. Please see [Usage Recommendations](https://huggingface.co/nvidia/Llama-3_1-Nemotron-Ultra-253B-v1#quick-start-and-usage-recommendations) for more.",
|
|
19605
19605
|
"architecture": {
|
|
19606
19606
|
"modality": "text->text",
|
|
19607
19607
|
"input_modalities": [
|
|
@@ -19856,7 +19856,7 @@ export const modelsData = [
|
|
|
19856
19856
|
}
|
|
19857
19857
|
},
|
|
19858
19858
|
"metadata": {
|
|
19859
|
-
"description": "NVIDIA-Nemotron-Nano-9B-v2 is a large language model (
|
|
19859
|
+
"description": "NVIDIA-Nemotron-Nano-9B-v2 is a large language model (NodeLLM) trained from scratch by NVIDIA, and designed as a unified model for both reasoning and non-reasoning tasks. It responds to user queries and tasks by first generating a reasoning trace and then concluding with a final response. \n\nThe model's reasoning capabilities can be controlled via a system prompt. If the user prefers the model to provide its final answer without intermediate reasoning traces, it can be configured to do so.",
|
|
19860
19860
|
"architecture": {
|
|
19861
19861
|
"modality": "text->text",
|
|
19862
19862
|
"input_modalities": [
|
|
@@ -19918,7 +19918,7 @@ export const modelsData = [
|
|
|
19918
19918
|
],
|
|
19919
19919
|
"pricing": {},
|
|
19920
19920
|
"metadata": {
|
|
19921
|
-
"description": "NVIDIA-Nemotron-Nano-9B-v2 is a large language model (
|
|
19921
|
+
"description": "NVIDIA-Nemotron-Nano-9B-v2 is a large language model (NodeLLM) trained from scratch by NVIDIA, and designed as a unified model for both reasoning and non-reasoning tasks. It responds to user queries and tasks by first generating a reasoning trace and then concluding with a final response. \n\nThe model's reasoning capabilities can be controlled via a system prompt. If the user prefers the model to provide its final answer without intermediate reasoning traces, it can be configured to do so.",
|
|
19922
19922
|
"architecture": {
|
|
19923
19923
|
"modality": "text->text",
|
|
19924
19924
|
"input_modalities": [
|
|
@@ -22688,7 +22688,7 @@ export const modelsData = [
|
|
|
22688
22688
|
}
|
|
22689
22689
|
},
|
|
22690
22690
|
"metadata": {
|
|
22691
|
-
"description": "gpt-oss-safeguard-20b is a safety reasoning model from OpenAI built upon gpt-oss-20b. This open-weight, 21B-parameter Mixture-of-Experts (MoE) model offers lower latency for safety tasks like content classification,
|
|
22691
|
+
"description": "gpt-oss-safeguard-20b is a safety reasoning model from OpenAI built upon gpt-oss-20b. This open-weight, 21B-parameter Mixture-of-Experts (MoE) model offers lower latency for safety tasks like content classification, NodeLLM filtering, and trust & safety labeling.\n\nLearn more about this model in OpenAI's gpt-oss-safeguard [user guide](https://cookbook.openai.com/articles/gpt-oss-safeguard-guide).",
|
|
22692
22692
|
"architecture": {
|
|
22693
22693
|
"modality": "text->text",
|
|
22694
22694
|
"input_modalities": [
|
|
@@ -24601,7 +24601,7 @@ export const modelsData = [
|
|
|
24601
24601
|
}
|
|
24602
24602
|
},
|
|
24603
24603
|
"metadata": {
|
|
24604
|
-
"description": "Qwen2.5 VL 7B is a multimodal
|
|
24604
|
+
"description": "Qwen2.5 VL 7B is a multimodal NodeLLM from the Qwen Team with the following key enhancements:\n\n- SoTA understanding of images of various resolution & ratio: Qwen2.5-VL achieves state-of-the-art performance on visual understanding benchmarks, including MathVista, DocVQA, RealWorldQA, MTVQA, etc.\n\n- Understanding videos of 20min+: Qwen2.5-VL can understand videos over 20 minutes for high-quality video-based question answering, dialog, content creation, etc.\n\n- Agent that can operate your mobiles, robots, etc.: with the abilities of complex reasoning and decision making, Qwen2.5-VL can be integrated with devices like mobile phones, robots, etc., for automatic operation based on visual environment and text instructions.\n\n- Multilingual Support: to serve global users, besides English and Chinese, Qwen2.5-VL now supports the understanding of texts in different languages inside images, including most European languages, Japanese, Korean, Arabic, Vietnamese, etc.\n\nFor more details, see this [blog post](https://qwenlm.github.io/blog/qwen2-vl/) and [GitHub repo](https://github.com/QwenLM/Qwen2-VL).\n\nUsage of this model is subject to [Tongyi Qianwen LICENSE AGREEMENT](https://huggingface.co/Qwen/Qwen1.5-110B-Chat/blob/main/LICENSE).",
|
|
24605
24605
|
"architecture": {
|
|
24606
24606
|
"modality": "text+image->text",
|
|
24607
24607
|
"input_modalities": [
|
|
@@ -26850,7 +26850,7 @@ export const modelsData = [
|
|
|
26850
26850
|
}
|
|
26851
26851
|
},
|
|
26852
26852
|
"metadata": {
|
|
26853
|
-
"description": "Relace Apply 3 is a specialized code-patching
|
|
26853
|
+
"description": "Relace Apply 3 is a specialized code-patching NodeLLM that merges AI-suggested edits straight into your source files. It can apply updates from GPT-4o, Claude, and others into your files at 10,000 tokens/sec on average.\n\nThe model requires the prompt to be in the following format: \n<instruction>{instruction}</instruction>\n<code>{initial_code}</code>\n<update>{edit_snippet}</update>\n\nZero Data Retention is enabled for Relace. Learn more about this model in their [documentation](https://docs.relace.ai/api-reference/instant-apply/apply)",
|
|
26854
26854
|
"architecture": {
|
|
26855
26855
|
"modality": "text->text",
|
|
26856
26856
|
"input_modalities": [
|
|
@@ -28432,7 +28432,7 @@ export const modelsData = [
|
|
|
28432
28432
|
],
|
|
28433
28433
|
"pricing": {},
|
|
28434
28434
|
"metadata": {
|
|
28435
|
-
"description": "Venice Uncensored Dolphin Mistral 24B Venice Edition is a fine-tuned variant of Mistral-Small-24B-Instruct-2501, developed by dphn.ai in collaboration with Venice.ai. This model is designed as an “uncensored” instruct-tuned
|
|
28435
|
+
"description": "Venice Uncensored Dolphin Mistral 24B Venice Edition is a fine-tuned variant of Mistral-Small-24B-Instruct-2501, developed by dphn.ai in collaboration with Venice.ai. This model is designed as an “uncensored” instruct-tuned NodeLLM, preserving user control over alignment, system prompts, and behavior. Intended for advanced and unrestricted use cases, Venice Uncensored emphasizes steerability and transparent behavior, removing default safety and alignment layers typically found in mainstream assistant models.",
|
|
28436
28436
|
"architecture": {
|
|
28437
28437
|
"modality": "text->text",
|
|
28438
28438
|
"input_modalities": [
|
|
@@ -1,13 +1,15 @@
|
|
|
1
1
|
import { Provider, ChatRequest, ChatResponse, ChatChunk, ModelInfo, ImageRequest, ImageResponse, TranscriptionRequest, TranscriptionResponse, ModerationRequest, ModerationResponse, EmbeddingRequest, EmbeddingResponse } from "./Provider.js";
|
|
2
2
|
/**
|
|
3
|
-
* Abstract base class for all
|
|
3
|
+
* Abstract base class for all NodeLLM providers.
|
|
4
4
|
* Provides common functionality and default implementations for unsupported features.
|
|
5
5
|
* Each provider must implement the abstract methods and can override default implementations.
|
|
6
6
|
*/
|
|
7
7
|
export declare abstract class BaseProvider implements Provider {
|
|
8
8
|
abstract apiBase(): string;
|
|
9
9
|
abstract headers(): Record<string, string>;
|
|
10
|
+
abstract headers(): Record<string, string>;
|
|
10
11
|
protected abstract providerName(): string;
|
|
12
|
+
get id(): string;
|
|
11
13
|
protected throwUnsupportedError(feature: string): never;
|
|
12
14
|
abstract chat(request: ChatRequest): Promise<ChatResponse>;
|
|
13
15
|
abstract capabilities?: any;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"BaseProvider.d.ts","sourceRoot":"","sources":["../../src/providers/BaseProvider.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,QAAQ,EACR,WAAW,EACX,YAAY,EACZ,SAAS,EACT,SAAS,EACT,YAAY,EACZ,aAAa,EACb,oBAAoB,EACpB,qBAAqB,EACrB,iBAAiB,EACjB,kBAAkB,EAClB,gBAAgB,EAChB,iBAAiB,EAClB,MAAM,eAAe,CAAC;AAEvB;;;;GAIG;AACH,8BAAsB,YAAa,YAAW,QAAQ;aACpC,OAAO,IAAI,MAAM;aACjB,OAAO,IAAI,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC;IACjD,SAAS,CAAC,QAAQ,CAAC,YAAY,IAAI,MAAM;IAEzC,SAAS,CAAC,qBAAqB,CAAC,OAAO,EAAE,MAAM,GAAG,KAAK;IAIvD,QAAQ,CAAC,IAAI,CAAC,OAAO,EAAE,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IAC1D,QAAQ,CAAC,YAAY,CAAC,EAAE,GAAG,CAAC;IAErB,MAAM,CAAC,CAAC,OAAO,EAAE,WAAW,GAAG,aAAa,CAAC,SAAS,CAAC;IAIxD,UAAU,CAAC,IAAI,OAAO,CAAC,SAAS,EAAE,CAAC;IAInC,KAAK,CAAC,CAAC,OAAO,EAAE,YAAY,GAAG,OAAO,CAAC,aAAa,CAAC;IAIrD,UAAU,CAAC,CAAC,OAAO,EAAE,oBAAoB,GAAG,OAAO,CAAC,qBAAqB,CAAC;IAI1E,QAAQ,CAAC,CAAC,OAAO,EAAE,iBAAiB,GAAG,OAAO,CAAC,kBAAkB,CAAC;IAIlE,KAAK,CAAC,CAAC,OAAO,EAAE,gBAAgB,GAAG,OAAO,CAAC,iBAAiB,CAAC;CAGpE"}
|
|
@@ -1,9 +1,12 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* Abstract base class for all
|
|
2
|
+
* Abstract base class for all NodeLLM providers.
|
|
3
3
|
* Provides common functionality and default implementations for unsupported features.
|
|
4
4
|
* Each provider must implement the abstract methods and can override default implementations.
|
|
5
5
|
*/
|
|
6
6
|
export class BaseProvider {
|
|
7
|
+
get id() {
|
|
8
|
+
return this.providerName();
|
|
9
|
+
}
|
|
7
10
|
throwUnsupportedError(feature) {
|
|
8
11
|
throw new Error(`${this.providerName()} does not support ${feature}`);
|
|
9
12
|
}
|
|
@@ -122,10 +122,8 @@ export interface EmbeddingResponse {
|
|
|
122
122
|
input_tokens: number;
|
|
123
123
|
dimensions: number;
|
|
124
124
|
}
|
|
125
|
-
export interface EmbeddingProvider {
|
|
126
|
-
embed(request: EmbeddingRequest): Promise<EmbeddingResponse>;
|
|
127
|
-
}
|
|
128
125
|
export interface Provider {
|
|
126
|
+
id: string;
|
|
129
127
|
chat(request: ChatRequest): Promise<ChatResponse>;
|
|
130
128
|
stream?(request: ChatRequest): AsyncIterable<ChatChunk>;
|
|
131
129
|
listModels?(): Promise<ModelInfo[]>;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Provider.d.ts","sourceRoot":"","sources":["../../src/providers/Provider.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,MAAM,oBAAoB,CAAC;AAC7C,OAAO,EAAE,IAAI,EAAE,QAAQ,EAAE,MAAM,iBAAiB,CAAC;
|
|
1
|
+
{"version":3,"file":"Provider.d.ts","sourceRoot":"","sources":["../../src/providers/Provider.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,MAAM,oBAAoB,CAAC;AAC7C,OAAO,EAAE,IAAI,EAAE,QAAQ,EAAE,MAAM,iBAAiB,CAAC;AAEjD,MAAM,WAAW,WAAW;IAC1B,KAAK,EAAE,MAAM,CAAC;IACd,QAAQ,EAAE,OAAO,EAAE,CAAC;IACpB,KAAK,CAAC,EAAE,IAAI,EAAE,CAAC;IACf,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,eAAe,CAAC,EAAE,GAAG,CAAC;IACtB,OAAO,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;IACjC,CAAC,GAAG,EAAE,MAAM,GAAG,GAAG,CAAC;CACpB;AAED,MAAM,WAAW,SAAS;IACxB,OAAO,EAAE,MAAM,CAAC;IAChB,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,IAAI,CAAC,EAAE,OAAO,CAAC;CAChB;AAED,MAAM,WAAW,KAAK;IACpB,YAAY,EAAE,MAAM,CAAC;IACrB,aAAa,EAAE,MAAM,CAAC;IACtB,YAAY,EAAE,MAAM,CAAC;IACrB,aAAa,CAAC,EAAE,MAAM,CAAC;IACvB,qBAAqB,CAAC,EAAE,MAAM,CAAC;IAC/B,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,WAAW,CAAC,EAAE,MAAM,CAAC;CACtB;AAED,MAAM,WAAW,YAAY;IAC3B,OAA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,CAAC,EAAE,oBAAoB,CAAC;CACrC"}
|
|
@@ -4,7 +4,7 @@ import { GeminiProvider } from "./GeminiProvider.js";
|
|
|
4
4
|
let registered = false;
|
|
5
5
|
/**
|
|
6
6
|
* Idempotent registration of the Gemini provider.
|
|
7
|
-
* Automatically called by
|
|
7
|
+
* Automatically called by NodeLLM.configure({ provider: 'gemini' })
|
|
8
8
|
*/
|
|
9
9
|
export function registerGeminiProvider() {
|
|
10
10
|
if (registered)
|
|
@@ -2,7 +2,7 @@ import { OllamaProvider } from "./OllamaProvider.js";
|
|
|
2
2
|
export { OllamaProvider };
|
|
3
3
|
/**
|
|
4
4
|
* Idempotent registration of the Ollama provider.
|
|
5
|
-
* Automatically called by
|
|
5
|
+
* Automatically called by NodeLLM.configure({ provider: 'ollama' })
|
|
6
6
|
*/
|
|
7
7
|
export declare function registerOllamaProvider(): void;
|
|
8
8
|
export declare const ensureOllamaRegistered: typeof registerOllamaProvider;
|
|
@@ -4,7 +4,7 @@ export { OllamaProvider };
|
|
|
4
4
|
let registered = false;
|
|
5
5
|
/**
|
|
6
6
|
* Idempotent registration of the Ollama provider.
|
|
7
|
-
* Automatically called by
|
|
7
|
+
* Automatically called by NodeLLM.configure({ provider: 'ollama' })
|
|
8
8
|
*/
|
|
9
9
|
export function registerOllamaProvider() {
|
|
10
10
|
if (registered)
|
|
@@ -4,7 +4,7 @@ import { OpenAIProvider } from "./OpenAIProvider.js";
|
|
|
4
4
|
let registered = false;
|
|
5
5
|
/**
|
|
6
6
|
* Idempotent registration of the OpenAI provider.
|
|
7
|
-
* Automatically called by
|
|
7
|
+
* Automatically called by NodeLLM.configure({ provider: 'openai' })
|
|
8
8
|
*/
|
|
9
9
|
export function registerOpenAIProvider() {
|
|
10
10
|
if (registered)
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
export * from "./OpenRouterProvider.js";
|
|
2
2
|
/**
|
|
3
3
|
* Idempotent registration of the OpenRouter provider.
|
|
4
|
-
* Automatically called by
|
|
4
|
+
* Automatically called by NodeLLM.configure({ provider: 'openrouter' })
|
|
5
5
|
*/
|
|
6
6
|
export declare function registerOpenRouterProvider(): void;
|
|
7
7
|
/**
|
|
@@ -5,7 +5,7 @@ export * from "./OpenRouterProvider.js";
|
|
|
5
5
|
let registered = false;
|
|
6
6
|
/**
|
|
7
7
|
* Idempotent registration of the OpenRouter provider.
|
|
8
|
-
* Automatically called by
|
|
8
|
+
* Automatically called by NodeLLM.configure({ provider: 'openrouter' })
|
|
9
9
|
*/
|
|
10
10
|
export function registerOpenRouterProvider() {
|
|
11
11
|
if (registered)
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@node-llm/core",
|
|
3
|
-
"version": "1.
|
|
3
|
+
"version": "1.1.0",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"main": "./dist/index.js",
|
|
6
6
|
"types": "./dist/index.d.ts",
|
|
@@ -10,7 +10,7 @@
|
|
|
10
10
|
"default": "./dist/index.js"
|
|
11
11
|
}
|
|
12
12
|
},
|
|
13
|
-
"description": "A provider-agnostic
|
|
13
|
+
"description": "A provider-agnostic NodeLLM core for Node.js, inspired by ruby-llm.",
|
|
14
14
|
"author": "node-llm contributors",
|
|
15
15
|
"license": "MIT",
|
|
16
16
|
"engines": {
|