dejadb_context/
presets.rs1use super::policy::{FormatPolicy, MetadataLevel, Ordering, OutputFormat};
8
9impl FormatPolicy {
10 pub fn claude() -> Self {
13 Self::new(OutputFormat::Sml)
14 .metadata(MetadataLevel::Minimal)
15 .ordering(Ordering::ByRelevance)
16 .group_by_type()
17 }
18
19 pub fn gpt4() -> Self {
22 Self::new(OutputFormat::Markdown)
23 .metadata(MetadataLevel::Minimal)
24 .ordering(Ordering::ByRelevance)
25 }
26
27 pub fn gemini() -> Self {
30 Self::gpt4()
31 }
32
33 pub fn local_small() -> Self {
36 Self::new(OutputFormat::PlainText)
37 .metadata(MetadataLevel::None)
38 .ordering(Ordering::ByRelevance)
39 }
40
41 pub fn json_api() -> Self {
44 Self::new(OutputFormat::Json)
45 .metadata(MetadataLevel::Full)
46 .ordering(Ordering::ByRelevance)
47 }
48}
49
50#[cfg(test)]
51mod tests {
52 use super::*;
53
54 #[test]
55 fn test_claude_preset() {
56 let p = FormatPolicy::claude();
57 assert_eq!(p.format, OutputFormat::Sml);
58 assert_eq!(p.metadata, MetadataLevel::Minimal);
59 assert_eq!(p.ordering, Ordering::ByRelevance);
60 assert!(p.sections.group_by_type);
61 assert!(p.token_budget.is_none());
62 }
63
64 #[test]
65 fn test_gpt4_preset() {
66 let p = FormatPolicy::gpt4();
67 assert_eq!(p.format, OutputFormat::Markdown);
68 assert_eq!(p.metadata, MetadataLevel::Minimal);
69 assert!(!p.sections.group_by_type);
70 }
71
72 #[test]
73 fn test_gemini_matches_gpt4() {
74 let g = FormatPolicy::gemini();
75 let gpt = FormatPolicy::gpt4();
76 assert_eq!(g.format, gpt.format);
77 assert_eq!(g.metadata, gpt.metadata);
78 assert_eq!(g.ordering, gpt.ordering);
79 }
80
81 #[test]
82 fn test_local_small_preset() {
83 let p = FormatPolicy::local_small();
84 assert_eq!(p.format, OutputFormat::PlainText);
85 assert_eq!(p.metadata, MetadataLevel::None);
86 }
87
88 #[test]
89 fn test_json_api_preset() {
90 let p = FormatPolicy::json_api();
91 assert_eq!(p.format, OutputFormat::Json);
92 assert_eq!(p.metadata, MetadataLevel::Full);
93 }
94
95 #[test]
96 fn test_preset_with_budget_override() {
97 let p = FormatPolicy::claude().token_budget(4096);
98 assert_eq!(p.format, OutputFormat::Sml);
99 assert_eq!(p.token_budget, Some(4096));
100 }
101}