thinking: the Strata server reads chat_template_kwargs, not a top-level enable_thinking (Off had no effect); plain output for read-only PowerShell noise
This commit is contained in:
1 parent
158a42d8b6
commit
daa45b1e37
4 files changed
+20
-11
No files matched your search
@@ -97,6 +97,12 @@ export function withPlain(raw) {
|
||||
* sentence says only what is known.
|
||||
*/
|
||||
export function outcomeText(tool, text) {
|
||||
if (tool === 'pwsh' || tool === 'bash') {
|
||||
// In the read-only modes PowerShell runs in Constrained Language Mode and complains about the Harness's own output-encoding line:
|
||||
// noise appended after a command that worked. It says nothing about the command, so it is not shown.
|
||||
text = text.replace(/\r?\n?\[stderr\]\r?\n(?:Cannot create type\. Only core types are supported in this language mode\.[\s\S]*?CannotCreateTypeConstrainedLanguage\s*)+$/, '');
|
||||
if (!text.trim()) text = '(no output)';
|
||||
}
|
||||
if ((tool === 'pwsh' || tool === 'bash') && /^\(no output\)$/.test(text.trim())) return 'The command finished without any error. It printed nothing, so there is nothing more to show.';
|
||||
return text;
|
||||
}
|
||||
|
||||
@@ -100,8 +100,8 @@ export function localOutputBudget(context) {
|
||||
}
|
||||
|
||||
/**
|
||||
* The thinking levels the chat's Reasoning menu offers, as wire values for a local Strata model. `off` sends enable_thinking false;
|
||||
* the rest send enable_thinking true plus the effort (the server reads both; "Max" is the highest effort it has).
|
||||
* The thinking levels the chat's Reasoning menu offers, as wire values for a local Strata model. `off` sends
|
||||
* chat_template_kwargs.enable_thinking false; the rest send it true plus reasoning_effort (the server maps high and max to its top level).
|
||||
*/
|
||||
export const LOCAL_EFFORTS = Object.freeze({ off: null, low: 'low', medium: 'medium', high: 'high', max: 'high' });
|
||||
/** The menu's words to the Harness's level names. */
|
||||
@@ -140,8 +140,9 @@ export function buildProfile({ local = [], connections = [], gate = true }) {
|
||||
api: 'openai-completions',
|
||||
baseURL: inst.baseUrl,
|
||||
apiKeyEnv: keyEnv,
|
||||
// `qwen` thinking format: enable_thinking true/false plus reasoning_effort, which the Strata server reads.
|
||||
compat: { supportsStore: false, thinkingFormat: 'qwen', supportsReasoningEffort: true },
|
||||
// The Strata server reads the thinking level from `chat_template_kwargs` (enable_thinking, reasoning_effort) or from a top-level
|
||||
// reasoning_effort; a top-level `enable_thinking` (pi-ai's `qwen` format) is ignored, so the model went on thinking with the menu on Off.
|
||||
compat: { supportsStore: false, thinkingFormat: 'chat-template', chatTemplateKwargs: { enable_thinking: { $var: 'thinking.enabled' }, reasoning_effort: { $var: 'thinking.effort', omitWhenOff: true } } },
|
||||
models: [{
|
||||
id: inst.modelId, name: inst.label || inst.modelId, contextWindow: context, maxTokens: localOutputBudget(context),
|
||||
input: inst.vision ? ['text', 'image'] : ['text'],
|
||||
|
||||
@@ -20,7 +20,7 @@ test('the generated profile names credentials, never carries them, and declares
|
||||
assert.equal(providers['strata-local'].models[0].contextWindow, 32768);
|
||||
assert.equal(providers['strata-local'].models[0].maxTokens, 28672, 'a local model may use nearly the whole window (it was 8192, which cut big answers off)');
|
||||
assert.equal(providers['strata-local'].models[0].reasoning, true);
|
||||
assert.equal(providers['strata-local'].compat.thinkingFormat, 'qwen');
|
||||
assert.equal(providers['strata-local'].compat.thinkingFormat, 'chat-template');
|
||||
assert.equal(providers['api-c0nn-1234-ab'].models[1].contextWindow, ASSUMED_API_CONTEXT, 'an unknown API window is a stated assumption, not a catalog default');
|
||||
assert.equal(entries.find(e => e.id === 'agent-default-model').config.provider, 'strata-local', 'local stays the default');
|
||||
assert.equal(entries.find(e => e.id === 'session-title-llm').disabled, true);
|
||||
|
||||
@@ -233,16 +233,18 @@ test('the output budget is not the old 8192, and the Reasoning menu reaches the
|
||||
await bridge.runTurn({ chatId, message: 'SCRIPT:echo hi', workspacePath: ws, mode: 'bypass', thinking, onFrame: () => {} });
|
||||
return worker.requests.find(r => r.toolNames.length).params;
|
||||
};
|
||||
const ctk = p => p.chat_template_kwargs ?? {};
|
||||
const off = await ask('think-off', 'Off');
|
||||
assert.equal(off.enable_thinking, false);
|
||||
assert.equal(ctk(off).enable_thinking, false); assert.equal(ctk(off).reasoning_effort, undefined);
|
||||
assert.equal(off.enable_thinking, undefined, 'a top-level enable_thinking is the field the Strata server ignores');
|
||||
assert.ok(off.max_completion_tokens > 40000, `budget ${off.max_completion_tokens} (the window minus the prompt, never the old 8192)`);
|
||||
const high = await ask('think-high', 'High');
|
||||
assert.equal(high.enable_thinking, true); assert.equal(high.reasoning_effort, 'high');
|
||||
assert.equal(ctk(high).enable_thinking, true); assert.equal(ctk(high).reasoning_effort, 'high');
|
||||
const low = await ask('think-low', 'Low');
|
||||
assert.equal(low.enable_thinking, true); assert.equal(low.reasoning_effort, 'low');
|
||||
assert.equal(ctk(low).enable_thinking, true); assert.equal(ctk(low).reasoning_effort, 'low');
|
||||
const max = await ask('think-max', 'Max');
|
||||
assert.equal(max.enable_thinking, true); assert.equal(max.reasoning_effort, 'high');
|
||||
assert.equal(ctk(max).enable_thinking, true); assert.equal(ctk(max).reasoning_effort, 'high');
|
||||
// the same chat switching its level between turns
|
||||
assert.equal((await ask('think-off', 'High')).enable_thinking, true);
|
||||
assert.equal((await ask('think-off', 'Off')).enable_thinking, false);
|
||||
assert.equal(ctk(await ask('think-off', 'High')).enable_thinking, true);
|
||||
assert.equal(ctk(await ask('think-off', 'Off')).enable_thinking, false);
|
||||
});
|
||||
Reference in new issue
Block a user