test(rag): add rag-v3 dispatch integration test + refresh stale rag-v2 docs (code-review)
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
@@ -11,8 +11,8 @@
|
||||
//! until the `max_context_tokens` budget is exhausted (estimated at
|
||||
//! ~4 chars / token, matching the kb-chunk convention).
|
||||
//! 4. Render the configured `prompt_template_version` prompt (system +
|
||||
//! user) verbatim per design — `rag-v1` legacy or `rag-v2` (default,
|
||||
//! fb-40) selected via `system_prompt_for`.
|
||||
//! user) verbatim per design — `rag-v3` (default), `rag-v1`/`rag-v2`
|
||||
//! legacy, selected via `system_prompt_for`.
|
||||
//! 5. Generate via `LanguageModel::generate_stream`. The token loop runs
|
||||
//! on the calling thread; `opts.stream_sink` (if any) emits
|
||||
//! `StreamEvent::RetrievalDone` once after retrieve+stale-stamp,
|
||||
|
||||
@@ -675,7 +675,7 @@ fn ask_with_multi_hop_false_keeps_single_pass_path() {
|
||||
assert_eq!(
|
||||
answer.prompt_template_version.0,
|
||||
// Single-pass stamps the config's prompt_template_version
|
||||
// (config default = "rag-v2"), NOT "rag-multi-hop-v1".
|
||||
// (config default = "rag-v3"), NOT "rag-multi-hop-v1".
|
||||
env.config.rag.prompt_template_version,
|
||||
"multi_hop=false must keep the config's prompt template (single-pass)"
|
||||
);
|
||||
|
||||
@@ -151,6 +151,29 @@ fn ask_with_rag_v2_uses_v2_system_prompt() {
|
||||
);
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn ask_with_rag_v3_uses_v3_system_prompt() {
|
||||
let (pipeline, captured, _env) = build_pipeline_with_template("rag-v3");
|
||||
let _ = pipeline.ask("hello", lexical_opts());
|
||||
let s = captured
|
||||
.lock()
|
||||
.unwrap()
|
||||
.clone()
|
||||
.expect("system prompt captured");
|
||||
assert!(
|
||||
s.contains("로컬 KB 위에서 동작"),
|
||||
"shared prefix expected, got: {s}"
|
||||
);
|
||||
assert!(
|
||||
s.contains("학습 지식"),
|
||||
"V3 must contain 학습 지식 rule, got: {s}"
|
||||
);
|
||||
assert!(
|
||||
s.contains("원본 질문"),
|
||||
"V3 must contain language-matching rule (v3-only), got: {s}"
|
||||
);
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn ask_with_unknown_template_returns_early_error() {
|
||||
let (pipeline, _captured, _env) = build_pipeline_with_template("rag-v99");
|
||||
|
||||
Reference in New Issue
Block a user