llmjs2 1.3.8 → 1.3.9

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 (2) hide show
  1. package/index.js +4 -2
  2. package/package.json +1 -1
package/index.js CHANGED
@@ -152,13 +152,15 @@ class LLMJS2 {
152
152
  throw new Error('messages array cannot be empty');
153
153
  }
154
154
 
155
+
156
+
155
157
  // Validate message format
156
158
  for (const msg of input.messages) {
157
159
  if (!msg.role || !msg.content) {
158
160
  throw new Error('Each message must have role and content properties');
159
161
  }
160
- if (!['system', 'user', 'assistant'].includes(msg.role)) {
161
- throw new Error('Message role must be system, user, or assistant');
162
+ if (!['system', 'user', 'assistant', 'tool'].includes(msg.role)) {
163
+ throw new Error('Message role must be system, user, tool or assistant');
162
164
  }
163
165
  }
164
166
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "llmjs2",
3
- "version": "1.3.8",
3
+ "version": "1.3.9",
4
4
  "description": "A unified Node.js library for connecting to multiple LLM providers: OpenAI, Ollama, and OpenRouter",
5
5
  "main": "index.js",
6
6
  "type": "commonjs",