feat(gate): drop reasoning field from selection (~1.5s) #90
@@ -95,11 +95,11 @@ export class LlmPromptSelector {
|
|||||||
): Promise<LlmSelectionResult> {
|
): Promise<LlmSelectionResult> {
|
||||||
const { getSystemPromptFn, signal, serverInfer } = opts;
|
const { getSystemPromptFn, signal, serverInfer } = opts;
|
||||||
|
|
||||||
// Keep the answer SHORT: latency is proportional to output length (a
|
// Keep the answer as SHORT as possible: latency is proportional to output
|
||||||
// no-think model runs ~10-13 tok/s), and a verbose reasoning field pushes a
|
// length (a no-think model runs ~10-18 tok/s). Even an "<=8 words" reasoning
|
||||||
// selection past the gate's responsiveness budget. Ask for compact JSON with
|
// got ignored (models write a full sentence → ~7s). Drop the reasoning field
|
||||||
// a <=8-word reasoning — ~2s vs ~9s for a prose reasoning.
|
// entirely — the gate only needs the names → just {selectedNames} → ~1-2s.
|
||||||
const DEFAULT_SYSTEM_PROMPT = `You are a context selection assistant. Given a developer's task keywords and available project prompts, select the relevant ones. Return ONLY compact JSON: {"selectedNames":[...],"reasoning":"<=8 words"}. No prose outside the JSON. Priority 10 prompts must always be included.`;
|
const DEFAULT_SYSTEM_PROMPT = `You are a context selection assistant. Given a developer's task keywords and available project prompts, select the relevant ones. Return ONLY this JSON and nothing else: {"selectedNames":[...]}. No reasoning, no prose, no explanation. Priority 10 prompts must always be included.`;
|
||||||
const systemPrompt = getSystemPromptFn
|
const systemPrompt = getSystemPromptFn
|
||||||
? await getSystemPromptFn('llm-gate-context-selector', DEFAULT_SYSTEM_PROMPT)
|
? await getSystemPromptFn('llm-gate-context-selector', DEFAULT_SYSTEM_PROMPT)
|
||||||
: DEFAULT_SYSTEM_PROMPT;
|
: DEFAULT_SYSTEM_PROMPT;
|
||||||
@@ -109,7 +109,7 @@ export class LlmPromptSelector {
|
|||||||
Available prompts:
|
Available prompts:
|
||||||
${promptIndex.map((p) => `- ${p.name} (priority: ${p.priority}): ${p.summary ?? 'No summary'}${p.chapters?.length ? `\n Chapters: ${p.chapters.join(', ')}` : ''}`).join('\n')}
|
${promptIndex.map((p) => `- ${p.name} (priority: ${p.priority}): ${p.summary ?? 'No summary'}${p.chapters?.length ? `\n Chapters: ${p.chapters.join(', ')}` : ''}`).join('\n')}
|
||||||
|
|
||||||
Select the relevant prompts. Return JSON: { "selectedNames": [...], "reasoning": "..." }`;
|
Select the relevant prompts. Return ONLY: {"selectedNames":[...]}`;
|
||||||
|
|
||||||
const messages: ChatMessage[] = [
|
const messages: ChatMessage[] = [
|
||||||
{ role: 'system', content: systemPrompt },
|
{ role: 'system', content: systemPrompt },
|
||||||
|
|||||||
Reference in New Issue
Block a user