Enable automatic web search by default; improve toggle behavior and search planning.
This commit is contained in:
@@ -5,6 +5,7 @@ import test from "node:test";
|
||||
import assert from "node:assert/strict";
|
||||
import {createServer} from "node:http";
|
||||
import {createApp} from "../src/app.js";
|
||||
import {decideWebSearch} from "../src/services/webSearchService.js";
|
||||
|
||||
// Controlled protocol fixtures, not claims about real-world events or statistics.
|
||||
const lifespan = {title: "Life expectancy estimates 2026", url: "https://health.example/2026", content: "The 2026 life expectancy estimate in this test dataset is 74 years."};
|
||||
@@ -44,6 +45,10 @@ test("explicit/date searches ground the actual Ollama stream before any generati
|
||||
eventLoopLagMonitorEnabled: false, structuredRequestLoggingEnabled: false, slowRequestLoggingEnabled: false
|
||||
}, modelOverrides: {fetch: async (_url, options) => {
|
||||
const body = JSON.parse(options.body);
|
||||
if (body.format?.properties?.search) {
|
||||
const {message} = JSON.parse(body.messages.at(-1).content);
|
||||
return new Response(JSON.stringify({message: {content: JSON.stringify({search: decideWebSearch(message).shouldSearch, query: message})}, done: true}));
|
||||
}
|
||||
modelRequests.push(body);
|
||||
if (expectedSearch) assert.equal(retrieved, true, "Search must finish before Ollama starts");
|
||||
const chunks = [
|
||||
|
||||
Reference in New Issue
Block a user