Expand auto-search to tech products, movies, series, comparisons
New pattern categories: - Tech products: iPhone/Galaxy/Pixel/iPad + version numbers, specs, release dates, "neuestes Handy", Apple Vision Pro, Meta Quest, etc. - Movies/series: Staffel/Season/Episode numbers, cast, ratings, neue Serie/neuer Film, IMDB, Rotten Tomatoes - Product comparisons: "vs" with model numbers, "lohnt sich" - Current leaders: Bundeskanzler, CEO, Präsident These are high-hallucination topics where the AI's training data is likely outdated — auto-search gives it fresh facts. 8 new tests (tech, movies, comparisons, leaders).
This commit is contained in:
parent
feb326fc40
commit
0744194c84
2 changed files with 83 additions and 8 deletions
|
|
@ -66,16 +66,59 @@ val chatModes = listOf(
|
||||||
)
|
)
|
||||||
|
|
||||||
private val SEARCH_PATTERNS = listOf(
|
private val SEARCH_PATTERNS = listOf(
|
||||||
"such nach", "suche nach", "was ist aktuell", "aktuelle", "neueste",
|
// Explicit search intent
|
||||||
"wie ist das wetter", "wetter in", "was passiert gerade", "was ist heute",
|
"such nach", "suche nach", "recherchier", "google mal",
|
||||||
"aktuelle news", "nachrichten", "was kostet", "aktienkurs", "kurs von",
|
"search for", "look up", "find me", "google",
|
||||||
|
|
||||||
|
// Current events + news
|
||||||
|
"was ist aktuell", "aktuelle", "neueste", "neuester", "neuestes",
|
||||||
|
"was passiert gerade", "was ist heute", "was gibt es neues",
|
||||||
|
"aktuelle news", "nachrichten", "breaking",
|
||||||
|
"what is happening", "latest news", "current events", "breaking news",
|
||||||
|
|
||||||
|
// Weather + time + location
|
||||||
|
"wie ist das wetter", "wetter in", "wie spät", "uhrzeit in",
|
||||||
|
"weather in", "weather today", "time in",
|
||||||
|
|
||||||
|
// Prices + stocks + finance
|
||||||
|
"was kostet", "aktienkurs", "kurs von", "preis von", "preisvergleich",
|
||||||
|
"stock price", "how much is", "price of",
|
||||||
|
|
||||||
|
// Sports + results
|
||||||
"wer hat gewonnen", "ergebnis von", "stand von", "tabelle von",
|
"wer hat gewonnen", "ergebnis von", "stand von", "tabelle von",
|
||||||
"öffnungszeiten", "wie spät", "uhrzeit in", "einwohner von",
|
"who won", "score of", "results of",
|
||||||
"search for", "look up", "find me", "what is happening",
|
|
||||||
"latest news", "current events", "weather in", "weather today",
|
// Facts + stats
|
||||||
"stock price", "who won", "what happened", "how much is",
|
"öffnungszeiten", "einwohner von", "hauptstadt von",
|
||||||
|
"opening hours", "population of", "capital of",
|
||||||
|
|
||||||
|
// Tech products — hallucination-prone: specs, release dates, prices change
|
||||||
|
"iphone \\d", "galaxy s\\d", "pixel \\d", "ipad \\d",
|
||||||
|
"apple vision", "meta quest", "playstation \\d", "xbox",
|
||||||
|
"neues iphone", "neues samsung", "neues pixel", "neues ipad",
|
||||||
|
"neuestes handy", "neuestes smartphone", "neuestes tablet",
|
||||||
|
"specs von", "technische daten", "release.?date", "erscheinungsdatum",
|
||||||
|
"wann kommt .* raus", "wann erscheint",
|
||||||
|
"latest iphone", "latest samsung", "latest pixel",
|
||||||
|
"newest phone", "newest tablet", "release date",
|
||||||
|
"when does .* come out", "when is .* releasing",
|
||||||
|
|
||||||
|
// Movies + series — cast, seasons, ratings change constantly
|
||||||
|
"staffel \\d", "season \\d", "episode \\d", "folge \\d",
|
||||||
|
"neue staffel", "neue serie", "neuer film",
|
||||||
|
"wann kommt staffel", "wann kommt die .* staffel",
|
||||||
|
"besetzung von", "cast von", "schauspieler in",
|
||||||
|
"imdb", "rotten tomatoes", "bewertung von",
|
||||||
|
"new season", "new episode", "new movie",
|
||||||
|
"cast of", "actors in", "rating of", "reviews of",
|
||||||
|
|
||||||
|
// Comparisons where freshness matters (product-specific)
|
||||||
|
"vergleich.*\\d{4}", "vs\\.?\\s\\w+\\s?\\d", "lohnt sich",
|
||||||
|
"compared to", "vs \\w+ \\d", "worth buying",
|
||||||
|
|
||||||
|
// When/who questions about current state
|
||||||
"when did", "when was", "who is the current", "what are the latest",
|
"when did", "when was", "who is the current", "what are the latest",
|
||||||
"score of", "results of", "opening hours", "population of",
|
"wer ist.*präsident", "wer ist.*kanzler", "wer ist.*ceo",
|
||||||
).map { Regex(it, RegexOption.IGNORE_CASE) }
|
).map { Regex(it, RegexOption.IGNORE_CASE) }
|
||||||
|
|
||||||
fun detectSearchQuery(text: String): Boolean {
|
fun detectSearchQuery(text: String): Boolean {
|
||||||
|
|
|
||||||
|
|
@ -27,6 +27,38 @@ class DetectSearchTest {
|
||||||
assertTrue(detectSearchQuery("Look up population of Germany"))
|
assertTrue(detectSearchQuery("Look up population of Germany"))
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
|
fun detectsTechProducts() {
|
||||||
|
assertTrue(detectSearchQuery("Was kostet das iPhone 16 Pro?"))
|
||||||
|
assertTrue(detectSearchQuery("Specs von Galaxy S25 Ultra"))
|
||||||
|
assertTrue(detectSearchQuery("Wann kommt das neue iPad raus?"))
|
||||||
|
assertTrue(detectSearchQuery("Apple Vision Pro technische Daten"))
|
||||||
|
assertTrue(detectSearchQuery("Latest iPhone release date"))
|
||||||
|
assertTrue(detectSearchQuery("Neuestes Samsung Handy 2026"))
|
||||||
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
|
fun detectsMoviesAndSeries() {
|
||||||
|
assertTrue(detectSearchQuery("Wann kommt Staffel 3 von Squid Game?"))
|
||||||
|
assertTrue(detectSearchQuery("Cast von The Last of Us Season 2"))
|
||||||
|
assertTrue(detectSearchQuery("Neue Serie auf Netflix"))
|
||||||
|
assertTrue(detectSearchQuery("Bewertung von Oppenheimer"))
|
||||||
|
assertTrue(detectSearchQuery("Rating of Dune Part 2"))
|
||||||
|
assertTrue(detectSearchQuery("Besetzung von Wednesday Staffel 2"))
|
||||||
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
|
fun detectsComparisons() {
|
||||||
|
assertTrue(detectSearchQuery("iPhone 16 vs Galaxy S25"))
|
||||||
|
assertTrue(detectSearchQuery("Lohnt sich die PS5 Pro?"))
|
||||||
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
|
fun detectsCurrentLeaders() {
|
||||||
|
assertTrue(detectSearchQuery("Wer ist aktuell Bundeskanzler?"))
|
||||||
|
assertTrue(detectSearchQuery("Who is the current CEO of OpenAI?"))
|
||||||
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
fun doesNotTriggerOnNormalPrompts() {
|
fun doesNotTriggerOnNormalPrompts() {
|
||||||
assertFalse(detectSearchQuery("Erkläre mir Quantencomputing"))
|
assertFalse(detectSearchQuery("Erkläre mir Quantencomputing"))
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue