惯性聚合 高效追踪和阅读你感兴趣的博客、新闻、科技资讯
阅读原文 在惯性聚合中打开

推荐订阅源

Last Week in AI
Last Week in AI
阮一峰的网络日志
阮一峰的网络日志
P
Proofpoint News Feed
让小产品的独立变现更简单 - ezindie.com
让小产品的独立变现更简单 - ezindie.com
MongoDB | Blog
MongoDB | Blog
云风的 BLOG
云风的 BLOG
OSCHINA 社区最新新闻
OSCHINA 社区最新新闻
J
Java Code Geeks
WordPress大学
WordPress大学
T
The Blog of Author Tim Ferriss
V
Visual Studio Blog
小众软件
小众软件
Microsoft Azure Blog
Microsoft Azure Blog
博客园_首页
IT之家
IT之家
Vercel News
Vercel News
C
Check Point Blog
Google DeepMind News
Google DeepMind News
月光博客
月光博客
D
DataBreaches.Net
酷 壳 – CoolShell
酷 壳 – CoolShell
美团技术团队
Y
Y Combinator Blog
Hugging Face - Blog
Hugging Face - Blog

Recent Commits to openclaw:main

test: merge chat side-result checks · openclaw/openclaw@ddd2c2a test: merge cron history checks · openclaw/openclaw@f7eb746 test: merge responsive navigation shell checks · openclaw/openclaw@c2e4b47 docs(changelog): add codex oauth fixes · openclaw/openclaw@628e6cd test: merge navigation routing cases · openclaw/openclaw@5d8cecb Tests: mock channel registry bundled fallback · openclaw/openclaw@2b08233 Secrets: avoid broad web search discovery for single plugin config · openclaw/openclaw@a464f59 test: merge config view browser checks · openclaw/openclaw@20cf511 fix(status): align oauth health with runtime · openclaw/openclaw@eed7116 feat: add macOS screen snapshots for monitor preview (#67954) thanks … · openclaw/openclaw@f377db1 fix: report shared auth scopes in hello-ok (#67810) thanks @BunsDev · openclaw/openclaw@0b6c39b Auto-reply: avoid eager bundled route fallback · openclaw/openclaw@3ea1bf4 Tests: narrow session binding contract setup · openclaw/openclaw@54e4e16 fix(macOS): enable undo/redo in webchat composer text input (#34962) · openclaw/openclaw@00951dc Tests: speed up channel setup promotion · openclaw/openclaw@82b529a Docs: refresh agent instructions · openclaw/openclaw@5775fe2 fix(auth): serialize OAuth refresh across agents to fix #26322 (#67876) · openclaw/openclaw@8e79080 test: allow ollama public surface boundary test · openclaw/openclaw@7d4f1a6 Docs: add test performance guardrails · openclaw/openclaw@89706d3 Tests: restore context-engine usage proof · openclaw/openclaw@e4c4f95 Tests: slim context engine runtime coverage · openclaw/openclaw@74c198f ci: retry failed custom checkouts · openclaw/openclaw@0ee5baf test: trim duplicate provider auth onboarding cases · openclaw/openclaw@1ffc02e matrix: fix sessions_spawn --thread subagent session spawning (#67643) · openclaw/openclaw@1ce2596 test: reduce auth choice fixture churn · openclaw/openclaw@857b9cd test: mock health status config boundaries · openclaw/openclaw@9d5ab4a test: mock onboard config io boundary · openclaw/openclaw@299694d test: mock legacy state plugin boundaries · openclaw/openclaw@2713089 test: mock channel install boundaries · openclaw/openclaw@b945248 test: mock doctor preview channel boundaries · openclaw/openclaw@b1a3ad4
fix(ollama): normalize greedy top_p (#87049) · openclaw/o...
vincentkoc · 2026-05-27 · via Recent Commits to openclaw:main

@@ -2319,6 +2319,117 @@ describe("createOllamaStreamFn", () => {

23192319

);

23202320

});

232123212322+

it("sets top_p=1 for native Ollama greedy sampling requests", async () => {

2323+

await withMockNdjsonFetch(

2324+

[

2325+

'{"model":"m","created_at":"t","message":{"role":"assistant","content":"ok"},"done":false}',

2326+

'{"model":"m","created_at":"t","message":{"role":"assistant","content":""},"done":true,"prompt_eval_count":1,"eval_count":1}',

2327+

],

2328+

async (fetchMock) => {

2329+

const stream = await createOllamaTestStream({

2330+

baseUrl: "http://ollama-host:11434",

2331+

model: {

2332+

params: {

2333+

num_ctx: 4096,

2334+

top_p: 0.9,

2335+

thinking: false,

2336+

},

2337+

},

2338+

options: { temperature: 0 },

2339+

});

2340+2341+

const events = await collectStreamEvents(stream);

2342+

expect(events.at(-1)?.type).toBe("done");

2343+2344+

const requestInit = getGuardedFetchCall(fetchMock).init ?? {};

2345+

if (typeof requestInit.body !== "string") {

2346+

throw new Error("Expected string request body");

2347+

}

2348+

const requestBody = JSON.parse(requestInit.body) as {

2349+

options: {

2350+

temperature?: number;

2351+

top_p?: number;

2352+

};

2353+

};

2354+

expect(requestBody.options.temperature).toBe(0);

2355+

expect(requestBody.options.top_p).toBe(1);

2356+

},

2357+

);

2358+

});

2359+2360+

it("sets top_p=1 for native Ollama greedy requests without configured top_p", async () => {

2361+

await withMockNdjsonFetch(

2362+

[

2363+

'{"model":"m","created_at":"t","message":{"role":"assistant","content":"ok"},"done":false}',

2364+

'{"model":"m","created_at":"t","message":{"role":"assistant","content":""},"done":true,"prompt_eval_count":1,"eval_count":1}',

2365+

],

2366+

async (fetchMock) => {

2367+

const stream = await createOllamaTestStream({

2368+

baseUrl: "http://ollama-host:11434",

2369+

model: {

2370+

params: {

2371+

num_ctx: 4096,

2372+

thinking: false,

2373+

},

2374+

},

2375+

options: { temperature: 0 },

2376+

});

2377+2378+

const events = await collectStreamEvents(stream);

2379+

expect(events.at(-1)?.type).toBe("done");

2380+2381+

const requestInit = getGuardedFetchCall(fetchMock).init ?? {};

2382+

if (typeof requestInit.body !== "string") {

2383+

throw new Error("Expected string request body");

2384+

}

2385+

const requestBody = JSON.parse(requestInit.body) as {

2386+

options: {

2387+

temperature?: number;

2388+

top_p?: number;

2389+

};

2390+

};

2391+

expect(requestBody.options.temperature).toBe(0);

2392+

expect(requestBody.options.top_p).toBe(1);

2393+

},

2394+

);

2395+

});

2396+2397+

it("preserves configured top_p for native Ollama non-greedy sampling requests", async () => {

2398+

await withMockNdjsonFetch(

2399+

[

2400+

'{"model":"m","created_at":"t","message":{"role":"assistant","content":"ok"},"done":false}',

2401+

'{"model":"m","created_at":"t","message":{"role":"assistant","content":""},"done":true,"prompt_eval_count":1,"eval_count":1}',

2402+

],

2403+

async (fetchMock) => {

2404+

const stream = await createOllamaTestStream({

2405+

baseUrl: "http://ollama-host:11434",

2406+

model: {

2407+

params: {

2408+

top_p: 0.9,

2409+

},

2410+

},

2411+

options: { temperature: 0.2 },

2412+

});

2413+2414+

const events = await collectStreamEvents(stream);

2415+

expect(events.at(-1)?.type).toBe("done");

2416+2417+

const requestInit = getGuardedFetchCall(fetchMock).init ?? {};

2418+

if (typeof requestInit.body !== "string") {

2419+

throw new Error("Expected string request body");

2420+

}

2421+

const requestBody = JSON.parse(requestInit.body) as {

2422+

options: {

2423+

temperature?: number;

2424+

top_p?: number;

2425+

};

2426+

};

2427+

expect(requestBody.options.temperature).toBe(0.2);

2428+

expect(requestBody.options.top_p).toBe(0.9);

2429+

},

2430+

);

2431+

});

2432+23222433

it("omits num_ctx when the model has no params.num_ctx and no catalog window", async () => {

23232434

await withMockNdjsonFetch(

23242435

[