MCPcopy Create free account
hub / github.com/AI45Lab/Code / description_confidence

Function description_confidence

core/src/agent/auto_delegation.rs:371–414  ·  view source on GitHub ↗
(description: &str, prompt: &str)

Source from the content-addressed store, hash-verified

369}
370
371fn description_confidence(description: &str, prompt: &str) -> f32 {
372 let shared_terms = significant_terms(description)
373 .into_iter()
374 .filter(|term| prompt.contains(term))
375 .count();
376 let base: f32 = match shared_terms {
377 0 => 0.0,
378 1 => 0.62,
379 2 => 0.74,
380 _ => 0.80,
381 };
382
383 let proactive_match = description.contains("proactive")
384 && contains_any(
385 prompt,
386 &[
387 "change",
388 "changed",
389 "changes",
390 "documentation",
391 "docs",
392 "fix",
393 "implement",
394 "test",
395 "review",
396 "verify",
397 "修改",
398 "变更",
399 "修复",
400 "实现",
401 "测试",
402 "审查",
403 "验证",
404 ],
405 );
406
407 if proactive_match {
408 (base.max(0.74) + 0.16_f32).min(0.9)
409 } else if base > 0.0 {
410 base
411 } else {
412 0.0
413 }
414}
415
416fn significant_terms(text: &str) -> Vec<&str> {
417 text.split(|ch: char| !ch.is_alphanumeric() && ch != '_')

Callers 1

score_agent_for_promptFunction · 0.85

Calls 3

significant_termsFunction · 0.85
containsMethod · 0.80
contains_anyFunction · 0.70

Tested by

no test coverage detected