llm-switcher 1.6.13 → 1.6.14
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 +4 -0
- package/formats.mjs +1 -1
- package/package.json +1 -1
- package/tests/formats.test.mjs +11 -0
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,9 @@
|
|
|
1
1
|
# Changelog — LLM Switcher
|
|
2
2
|
|
|
3
|
+
## Release 1.6.14 — 2026-10-12
|
|
4
|
+
|
|
5
|
+
- **System turn with an odd content shape.** On the translated route, a `system` turn whose `content` is not text and not a list is dropped. Before, the request failed with a `TypeError`.
|
|
6
|
+
|
|
3
7
|
## Release 1.6.13 — 2026-10-12
|
|
4
8
|
|
|
5
9
|
- **`switch on` with no profile.** `switch on` gives each tool the profile that it had before `switch off`. A tool that was off stays off. A tool that is on keeps its profile.
|
package/formats.mjs
CHANGED
|
@@ -462,7 +462,7 @@ function anthropicToIR(payload) {
|
|
|
462
462
|
const text =
|
|
463
463
|
typeof msg.content === 'string'
|
|
464
464
|
? msg.content
|
|
465
|
-
: (msg.content
|
|
465
|
+
: Array.isArray(msg.content) ? msg.content.filter(p => p && p.type === 'text').map(p => p.text).join('\n') : '';
|
|
466
466
|
if (text.trim()) ir.system = ir.system ? `${ir.system}\n\n${text}` : text;
|
|
467
467
|
return true;
|
|
468
468
|
};
|
package/package.json
CHANGED
package/tests/formats.test.mjs
CHANGED
|
@@ -112,6 +112,17 @@ test('healAnthropicPayload: native Anthropic passthrough keeps the billing heade
|
|
|
112
112
|
assert.equal(payload.system[0].text, header);
|
|
113
113
|
});
|
|
114
114
|
|
|
115
|
+
test('anthropicToIR: a system turn whose content is neither text nor a list is dropped, not thrown', () => {
|
|
116
|
+
for (const content of [{ type: 'text', text: 'odd' }, 42, null]) {
|
|
117
|
+
const ir = anthropicToIR({
|
|
118
|
+
model: 'claude-opus-4-6', max_tokens: 10,
|
|
119
|
+
messages: [{ role: 'system', content }, { role: 'user', content: 'hi' }]
|
|
120
|
+
});
|
|
121
|
+
assert.equal(ir.system, '', JSON.stringify(content));
|
|
122
|
+
assert.deepEqual(ir.messages.map(m => m.role), ['user']);
|
|
123
|
+
}
|
|
124
|
+
});
|
|
125
|
+
|
|
115
126
|
test('anthropicToIR: a system turn folds into the IR system prompt', () => {
|
|
116
127
|
const ir = anthropicToIR({
|
|
117
128
|
model: 'claude-opus-4-6', max_tokens: 10,
|