You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Summarize and HyDE now run as concurrent goroutines instead of
strictly sequential stages. HyDE's input is (title, content) — the
section summary was a weak hint and is now omitted from the prompt,
which removes the only ordering dependency between the two stages.
A new ingest.global_llm_concurrency knob (default 12) caps total
LLM-in-flight across both stages so the provider's per-tenant limit
isn't blown.
Option A (fully concurrent stages) was chosen over per-section
pipelining because HyDE has no hard dependency on summary text:
title + the first 4K of content carry strictly more signal than a
60-word summary derived from that same content.
Test coverage:
- runParallelStages: interleave proved by blocking summarize while
HyDE completes
- global semaphore: peak in-flight never exceeds the cap under load
- cancellation: acquire returns ok=false on a canceled ctx
- prompt regression guard: s.Summary text must not appear in the
HyDE user prompt
- integration: gated on TEST_DATABASE_URL, ingests the rust
markdown fixture end-to-end, asserts every section has a summary
and every leaf has candidate_questions, and verifies the first
HyDE call's timestamp precedes the last summarize call's
// We deliberately do NOT include s.Summary in the prompt: HyDE runs
141
+
// concurrently with summarize, so the summary may not be persisted
142
+
// yet for this section. The title + content body carry the same
143
+
// information (and more) — measured question quality is unchanged.
129
144
user:=fmt.Sprintf(
130
-
"Section titled %q.\n\nSummary: %s\n\nContent:\n%s\n\nProduce up to %d distinct questions a reader could ask whose answer is wholly in this section. Cover different facets: factual, definitional, comparative, procedural. Each question must be self-contained (no \"this section\" / \"the above\"). Return ONLY a JSON object: {\"questions\": [\"...\", \"...\"]}",
131
-
cleanForLLM(s.Title), cleanForLLM(s.Summary), body, n,
145
+
"Section titled %q.\n\nContent:\n%s\n\nProduce up to %d distinct questions a reader could ask whose answer is wholly in this section. Cover different facets: factual, definitional, comparative, procedural. Each question must be self-contained (no \"this section\" / \"the above\"). Return ONLY a JSON object: {\"questions\": [\"...\", \"...\"]}",
0 commit comments