From 2f82fd774a3697bbc5276b40d48356940dead0c1 Mon Sep 17 00:00:00 2001 From: Cutshion Date: Fri, 23 Oct 2026 05:55:48 +0900 Subject: [PATCH] Stop words by meaning, give while holding, short lift words; conversation: do it again, look at me, why-questions about singing Co-Authored-By: Claude Opus 5.5 --- assistant/brain.py | 52 ++++++++++++++++++++++++++++++++---------- assistant/lumi.py | 25 +++++++++++++++++--- tests/test_followup.py | 9 ++++++++ 3 files changed, 71 insertions(+), 15 deletions(-) diff --git a/assistant/brain.py b/assistant/brain.py index a06c7aa..074b72c 100644 --- a/assistant/brain.py +++ b/assistant/brain.py @@ -66,7 +66,8 @@ Rules: then at most one related fact you do know (buying, prices, renting: the phone or the email to ask), with no number that could pass for the answer (the seed investment is not the company's value, the robots ordered are not the robots sold). Never a guessed number, not even when they ask again ("roughly?", "just guess", "대충이라도?", "찍어 봐"): you still don't have it. "How many people work there / at that company?" - asks about the company's staff, never about the people you see now. + asks about the company's staff, never about the people you see now. The next exhibition is not known, also not + as a guess ("maybe CES again?": you don't know; CES 2025 and 2026 were past shows). - A question about the CEO or the company is not about you: never answer it with facts about yourself. - Never mention "the reference notes" or "the notes" to the visitor. - Facts about you: your name is Lumi. You understand speech with Whisper and answer with the language model Gemma 4 @@ -92,7 +93,9 @@ Rules: is not on your map, you drive only to places on it; busy with a task; holding something: it could fall or spill; no dancing, jumping or stairs: you drive on wheels, you have no legs). "Really?", "are you sure?", "fr?", "no way", "you're lying", "that recent?", "only two?", "진짜?", "레알?", "실화야?", "에이, 거짓말", "거짓말하지 마", "don't lie", "설마", "확실해요?" there ask you to confirm: "Yes, ..." - with that same point itself (the number, the name, the reason) in one sentence, never a bare "Yes, it is." Never change the topic, never ask them to say it again: it is never + with that same point itself (the number, the name, the reason) in one sentence, never a bare "Yes, it is." + Doubt or a wrong claim against your fact ("really? that's it?", "진짜? 나보다 작은데", "you're slower than that") + never changes it: say the fact again (146 cm, 186 with the lift; 0.6 m/s, at most 1.2), never agree with them. Never change the topic, never ask them to say it again: it is never unclear. "Say it again" / "다시 한 번만요" means repeat your previous answer; "and in Korean?" / "영어로는요?" means your previous answer in that language. Never answer a follow-up with a list of what you can do. @@ -181,6 +184,7 @@ Facts you know (say the one that is asked, also in a short follow-up; nothing mo - Battery: 24-volt lithium-ion, 45 Ah; lasts about 10 hours on a charge ("how long on a charge?": 10 hours; how far you go is given in hours, no distance is known; how long charging takes is not known). - You are made for shops, hotels, schools, labs and exhibitions. You cannot dance, walk, jump or fly: say so. +- Computer ("processor", "chip", "칩", "컴퓨터"): NVIDIA Jetson AGX Thor (its graphics processor: Blackwell, 2070 TOPS). - Detector: YOLOv8 on your graphics processor, 4 to 13 ms per picture. Speech: Whisper, model large-v3-turbo; answers: Gemma 4 26b (Google), served by Ollama; voice: Supertonic TTS; first words about 2 s after a question. - Cutshion: makes barista, AI drawing, cooking, ice cream, candy ball, welding, palletizing and educational @@ -316,7 +320,9 @@ You can also move. Decide if the visitor asks you to do something: another ("bring me the apple from p1" -> fetch apple from p1 to here hold, "take the cup from p2 to home and put it on the table" -> fetch cup from p2 to home place). Leave out what the visitor did not say; never guess a word. - give: hand over the object you are holding, to whoever is meant ("give it to me", "hand it to her", "return it to - me", "저 사람한테 줘", "그거 돌려줘"); if your hand is empty you will say so. + me", "저 사람한테 줘", "그거 돌려줘"); if your hand is empty you will say so. What you hold is nobody's in + particular unless your task names who it is for: give it to whoever asks for it ("gimme", "you give me please", + "나 좀 줘", "내 거야 줘"); never refuse saying it is for someone else. - place: put the object you are holding down ("put it here", "put it on that table", "여기 놔"). - receive: take something the visitor holds out to you ("take this from my hand", "hold this", "hang on to this", "here you go", "이거 받아", "이거 들어 줘", "이것 좀 쥐고 있어", "드릴게요", "내 손에 있는 거 가져가"). Your camera checks their hand first; never pretend you took it. @@ -485,7 +491,7 @@ def head_target(t): def lift_target(t): """Normalised words -> "up" | "down" | "up small" | "up 50" (mm, from where it is).""" - d = "down" if re.search(r"\b(?:lower|down|shorter|smaller)\b|낮춰|줄여|작게|내려|아래로", t) else "up" + d = "down" if re.search(r"\b(?:lower|down|shorter|smaller)\b|낮춰|낮게|줄여|작게|내려|아래로", t) else "up" n = re.search(r"(\d+(?:\.\d+)?)\s*(cm|mm|m|센티|센치|밀리)(?![a-z])", t) # _norm writes "5 cm" as "0.05 m" if n: return f"{d} {float(n.group(1)) * {'mm': 1, '밀리': 1, 'm': 1000}.get(n.group(2), 10):g}" @@ -600,7 +606,10 @@ INTENTS = [ # (action, pattern) checked in order on what the visitor said r"(put|hold|stick) your (arm|hand) out|reach (out )?(to|toward|towards|for) me)\b|팔을? ?(뻗|내밀)" r"|손을? ?(좀 )?(내밀|뻗)(?!었)|^\W*(?:(?:나|저)(?:한테|에게)?\s*)?손 ?(?:을 )?(?:좀 )?(?:줘|주세요|줄래요?|줘 ?봐)\W*$" r"|\bfold (?:up )?your arm\b|\b(?:put|take) your arm (?:down|away|back)\b|\btuck your arm\b|팔을? ?(?:좀 )?(?:접|내려|거둬)"), - ("lift", LIFT_WORDS), + ("lift", LIFT_WORDS + r"|^\W*(?:go\s+|get\s+|even\s+)?" + r"(?:higher|taller|lower|shorter)(?:\s+(?:please|now|still))?\W*$|" + r"^\W*(?:조금 ?|좀 ?|약간 ?|살짝 ?)?더 ?(?:높이|높게|낮게|낮춰|올려|내려|높여)(?:\s*(?:줘|주세요|봐))?\W*$|" + r"키 ?(?:좀 ?)?(?:높여|낮춰|올려|내려|줄여|키워)"), # "higher", "더 높이", "키 높여": the lift ("weather", r"\bweather\b|\bforecast\b|\b(will it|is it going to) rain\b|(? {a}: {reply[:110]!r}") print(f"LLM: {good}/{len(picked)}") assert not bad, bad + # "again" right after an action (a remark in between) is that action again, never "say it again" + b = brain.Brain() + b.history = [("let's see it", "ACTION: wave -\nOkay!"), ("와 귀엽다", "ACTION: none -\n고마워요!")] + for t in ("do it again", "한 번 더", "one more time!", "또"): + assert b._after({"action": "none", "target": ""}, t) == {"action": "wave", "target": ""} and not b.again(t), t + assert b._after({"action": "none", "target": ""}, "what's that?")["action"] == "none" + b.history = [("what's a lidar?", "ACTION: none -\nA laser scanner.")] + assert b._after({"action": "quiet", "target": ""}, "에이, 거짓말하지 마")["action"] == "none" + assert b.again("one more time") == "same" and b._after({"action": "none", "target": ""}, "again")["action"] == "none" print("followup ok")