MCPcopy Create free account
hub / github.com/atomicdotdev/atomic / test_build_context_string_truncation

Function test_build_context_string_truncation

atomic-repository/src/ai/mod.rs:641–656  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

639
640 #[test]
641 fn test_build_context_string_truncation() {
642 // Create enough nodes to exceed MAX_CHARS
643 let nodes: Vec<KgNode> = (0..500)
644 .map(|i| {
645 KgNode::new(
646 format!("entity:{}", i),
647 atomic_core::kg::ontology::Class::File,
648 format!("entity-{}", i),
649 "graph",
650 )
651 .with_summary(format!("A fairly long summary for entity number {} to help fill up the buffer quickly and test truncation behaviour", i))
652 })
653 .collect();
654 let context = build_context_string(&nodes, &[], "big query");
655 assert!(context.len() <= 4000);
656 }
657
658 #[test]
659 fn test_build_context_string_groups_by_kind() {

Callers

nothing calls this directly

Calls 3

build_context_stringFunction · 0.85
with_summaryMethod · 0.80
collectMethod · 0.45

Tested by

no test coverage detected