fix(decision-ollama): use Ollama's native JSON mode without thinking
CI (SIAX Cloud) / integration (push) Skipped
CI (SIAX Cloud) / sonar (push) Skipped
CI (SIAX Cloud) / sonar (pull_request) Skipped
masterplan-lock / check (pull_request) Successful in 5s
Security Scan (SIAX Cloud) / security (push) Successful in 14s
CI (SIAX Cloud) / security (push) Successful in 17s
masterplan-lock / check (push) Successful in 17s
CI (SIAX Cloud) / security (pull_request) Successful in 20s
Security Scan (SIAX Cloud) / security (pull_request) Successful in 21s
CI (SIAX Cloud) / integration (pull_request) Successful in 54s
CI (SIAX Cloud) / quality (push) Successful in 1m24s
CI (SIAX Cloud) / quality (pull_request) Successful in 1m29s

The 9B model spent its whole 4000-token budget on reasoning and came back
model_incomplete. Call /api/chat with format=json, think=false and num_predict,
and read prompt_eval_count/eval_count/done_reason. Structured extraction no
longer needs chain-of-thought.
This commit is contained in:
2026-11-02 17:51:09 +01:00
parent ce2d8b58ea
commit 8b571cf2f4
2 changed files with 44 additions and 22 deletions
@@ -55,14 +55,21 @@ describe('decision server Ollama gateway', () => {
expect(() => assertTrustedDecisionOllamaUrl('http://user:pass@100.96.133.104:11434')).toThrow();
});
it('maps an OpenAI-compatible Ollama response into the INF0 receipt', async () => {
const c = client(async () =>
Response.json({
it('maps a native Ollama chat response into the INF0 receipt', async () => {
const c = client(async (url, init) => {
expect(String(url)).toMatch(/\/api\/chat$/);
const body = JSON.parse(String(init?.body));
expect(body.format).toBe('json');
expect(body.think).toBe(false);
return Response.json({
model: 'hermes-qwen3.5:9b',
choices: [{ message: { content: '{"value":{}}' }, finish_reason: 'stop' }],
usage: { prompt_tokens: 12, completion_tokens: 8, total_tokens: 20 },
}),
);
message: { role: 'assistant', content: '{"value":{}}' },
done: true,
done_reason: 'stop',
prompt_eval_count: 12,
eval_count: 8,
});
});
await expect(
c.complete({ context, admission, policy, reservation: undefined, inputTokens: 12, messages }),
).resolves.toMatchObject({
@@ -77,8 +84,11 @@ describe('decision server Ollama gateway', () => {
const c = client(async () =>
Response.json({
model: 'hermes-qwen3.5:9b',
choices: [{ message: { content: 'x' }, finish_reason: 'stop' }],
usage: { prompt_tokens: 1, completion_tokens: 1, total_tokens: 99 },
message: { role: 'assistant', content: 'x' },
done: true,
done_reason: 'stop',
prompt_eval_count: 1,
eval_count: 5000,
}),
);
await expect(