()
| 433 | |
| 434 | #[test] |
| 435 | fn assemble_caps_items_per_source() { |
| 436 | let assembler = ContextAssembler::new(ContextBudget { |
| 437 | max_items: 10, |
| 438 | max_tokens: 100, |
| 439 | }) |
| 440 | .with_source_policy(ContextSourcePolicy { |
| 441 | max_items_per_source: Some(2), |
| 442 | max_tokens_per_source: None, |
| 443 | }); |
| 444 | let assembly = assembler.assemble(&[result( |
| 445 | "test", |
| 446 | vec![ |
| 447 | ContextItem::new("a", ContextType::Resource, "a") |
| 448 | .with_source("file://a") |
| 449 | .with_relevance(0.9) |
| 450 | .with_token_count(1), |
| 451 | ContextItem::new("b", ContextType::Resource, "b") |
| 452 | .with_source("file://b") |
| 453 | .with_relevance(0.8) |
| 454 | .with_token_count(1), |
| 455 | ContextItem::new("c", ContextType::Resource, "c") |
| 456 | .with_source("file://c") |
| 457 | .with_relevance(0.7) |
| 458 | .with_token_count(1), |
| 459 | ], |
| 460 | )]); |
| 461 | |
| 462 | assert_eq!(assembly.items.len(), 2); |
| 463 | assert_eq!(assembly.items[0].id, "a"); |
| 464 | assert_eq!(assembly.items[1].id, "b"); |
| 465 | assert!(assembly.truncated); |
| 466 | } |
| 467 | |
| 468 | #[test] |
| 469 | fn assemble_caps_tokens_per_source_but_keeps_other_sources() { |
nothing calls this directly
no test coverage detected