Route natural knowledge overview questions to Pegasus inventory

This commit is contained in:
Mark Gregory
2026-11-17 12:10:32 +00:00
parent 1f373d0ece
commit 71972cd843
2 changed files with 9 additions and 1 deletions
+8
View File
@@ -426,6 +426,7 @@ enum KnowledgeInventory {
static let toolName = "list_knowledge_sources"
static func matches(_ prompt: String) -> Bool {
if asksWhatIsInside(prompt) { return true }
let words = Set(prompt.lowercased().split { !$0.isLetter })
let inventory = !words.isDisjoint(with: ["list", "show", "browse", "what", "which", "summarize", "categorize"])
let subjects = !words.isDisjoint(with: ["topics", "documents", "files", "sources", "contents", "indexed", "categories", "overview", "summaries"])
@@ -433,10 +434,17 @@ enum KnowledgeInventory {
}
static func wantsTopics(_ prompt: String) -> Bool {
if asksWhatIsInside(prompt) { return true }
let words = Set(prompt.lowercased().split { !$0.isLetter })
return !words.isDisjoint(with: ["topics", "categories", "overview", "summaries"])
}
private static func asksWhatIsInside(_ prompt: String) -> Bool {
let normalized = prompt.lowercased().split { !$0.isLetter }.joined(separator: " ")
return normalized.range(of: #"^(?:what is|what s) (?:in|inside) (?:(?:our|my|the) )?knowledge base$"#,
options: .regularExpression) != nil
}
static func topicOverview(_ sources: [String]) -> String {
let categories: [(String, String, Set<String>)] = [
("Development standards", "Standards, guidelines, conventions, and policies.", ["standards", "guidelines", "conventions", "policies"]),