Files
Sybil-2/server/tests/quick-question.test.ts
T

28 lines
1.0 KiB
TypeScript
Raw Normal View History

2026-08-27 19:30:37 -07:00
import assert from "node:assert/strict";
import test from "node:test";
import {
buildQuickQuestionMultiplexRequest,
QUICK_QUESTION_SYSTEM_PROMPT,
} from "../src/llm/quick-question.js";
test("quick question requests receive the server-owned one-shot system prompt", () => {
const request = buildQuickQuestionMultiplexRequest({
provider: "openai",
model: "gpt-4.1-mini",
question: "How do I reset my password?",
enabledTools: ["web_search"],
userLocation: "Los Angeles, CA",
});
assert.equal(request.persist, false);
assert.equal(request.chatId, undefined);
assert.deepEqual(request.messages, [
{ role: "system", content: QUICK_QUESTION_SYSTEM_PROMPT },
{ role: "user", content: "How do I reset my password?" },
]);
assert.deepEqual(request.enabledTools, ["web_search"]);
assert.equal(request.userLocation, "Los Angeles, CA");
assert.match(QUICK_QUESTION_SYSTEM_PROMPT, /succinct, direct, self-contained answer/i);
assert.match(QUICK_QUESTION_SYSTEM_PROMPT, /do not ask follow-up questions/i);
});