Faster replies: TTS on the GPU, LLM prompt cache kept warm
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
@@ -203,7 +203,7 @@ for word, val in OBJ_KO[:5]:
|
||||
for t in ["take the cup, go to p3 and give it to Mina", "pick up the bottle, turn around and give it to me",
|
||||
"go to p2, wait 10 seconds and come back", "컵 집어서 p3로 가서 줘", "pick up the apple and hand it to me",
|
||||
"take the cup and put it on the chair", "사과 집어서 나한테 줘"]:
|
||||
add("mission", t, "mission | action:fetch")
|
||||
add("mission", t, "mission | action:fetch | refuse" if "bottle" in t else "mission | action:fetch") # the bottle: why not
|
||||
|
||||
# ---------- status ----------
|
||||
for t in ["what are you holding?", "what's in your hand?", "where are you going?", "what are you doing?", "뭐 하고 있어?",
|
||||
|
||||
@@ -0,0 +1,275 @@
|
||||
"""Second command set (2026-10-21 night): every ability in wordings the first set (tests/command_cases.py) does not
|
||||
have: polite / casual / 반말 / 존댓말, indirect ("could you maybe ...", "I'd like you to ...", "~해 줄래?", "~할 수 있어?"),
|
||||
negation ("don't go to the stage", "가지 마"), conditions ("when I say go ..."), corrections inside the sentence
|
||||
("go to start, no, end", "컵 집어, 아니 병"), fillers, code-mixing, the conference map's marker names (start, end, init,
|
||||
final, middle, table_front, booth_2, stage) and whisper's slips. Same notation as tests/command_cases.py; every case
|
||||
carries the map it is said on ("markers"). The intent names start with "new:" so the report keeps both sets apart.
|
||||
Forbidden motions are what "wrong" counts: any motion that is not one of the expected alternatives.
|
||||
"""
|
||||
import random
|
||||
|
||||
R = random.Random(21)
|
||||
CONF = ["home", "start", "end", "init", "final", "middle", "table_front", "stage", "booth_2", "dock2"]
|
||||
CASES = []
|
||||
|
||||
|
||||
def add(intent, text, expect, state="idle", before=None):
|
||||
lang = "ko" if any("가" <= ch <= "힣" for ch in text) else "en"
|
||||
CASES.append({"intent": "new:" + intent, "text": text, "lang": lang, "state": state, "before": before,
|
||||
"expect": expect, "markers": CONF})
|
||||
|
||||
|
||||
def ro(word):
|
||||
"""The Korean 'to' particle after a word: 스테이지로, 이닛으로, 테이블 프론트로."""
|
||||
c = word[-1]
|
||||
if not "가" <= c <= "힣":
|
||||
return word + "로"
|
||||
final = (ord(c) - 0xAC00) % 28
|
||||
return word + ("으로" if final and final != 8 else "로")
|
||||
|
||||
|
||||
def each(intent, templates, fills, expect, state="idle", before=None):
|
||||
for tpl in templates:
|
||||
for word, val in fills:
|
||||
add(intent, tpl.format(o=word, ro=ro(word) if word else ""), expect.format(o=val), state, before)
|
||||
|
||||
|
||||
PLACES_EN = [("the stage", "stage"), ("booth two", "booth_2"), ("table front", "table_front"), ("the start", "start"),
|
||||
("the end", "end"), ("init", "init"), ("the final point", "final"), ("the middle", "middle")]
|
||||
PLACES_KO = [("스테이지", "stage"), ("부스 투", "booth_2"), ("테이블 프론트", "table_front"), ("스타트", "start"),
|
||||
("엔드", "end"), ("미들", "middle"), ("파이널", "final"), ("이닛", "init")]
|
||||
PAIRS_EN = [("the start", "the end", "end"), ("the stage", "booth two", "booth_2"), ("the middle", "table front", "table_front"),
|
||||
("booth two", "the stage", "stage"), ("init", "the final point", "final")]
|
||||
PAIRS_KO = [("스타트", "엔드", "end"), ("스테이지", "부스 투", "booth_2"), ("미들", "테이블 프론트", "table_front"),
|
||||
("부스 투", "스테이지", "stage"), ("이닛", "파이널", "final")]
|
||||
|
||||
# ---------- go to a marker ----------
|
||||
each("go", ["go to {o}", "could you maybe go to {o}?", "I'd like you to go to {o}", "head over to {o}, please",
|
||||
"please make your way to {o}", "can you drive to {o}", "let's go to {o}", "navigate to {o}",
|
||||
"off you go to {o}", "proceed to {o}", "um, go to, uh, {o}", "Lumi, would you go to {o} for me?",
|
||||
"why don't you go to {o}", "I want you to go to {o} now"], PLACES_EN, "action:go_to {o} | mission")
|
||||
each("go", ["{ro} 가", "{ro} 가 줘", "{ro} 가 줄래?", "{ro} 가 주실래요?", "{ro} 이동해 주세요", "{o}까지 가 줘", "{o} 가",
|
||||
"{o} 쪽으로 가 봐", "{ro} 가 주시겠어요?", "{ro} 가십시오", "{ro} 가 줄 수 있어요?", "루미야, {ro} 좀 가 줘",
|
||||
"음 {ro} 가 줘요"], PLACES_KO, "action:go_to {o} | mission")
|
||||
each("go", ["go to {o} 해 줘", "{o}로 go"], [("stage", "stage"), ("booth 2", "booth_2")], "action:go_to {o} | mission | talk")
|
||||
# not a drive now: negation, a question about the place, a condition for later
|
||||
each("go_not", ["don't go to {o}", "please don't go to {o}", "you don't need to go to {o}", "never go to {o} alone",
|
||||
"how far is {o}?", "where is {o}?", "have you been to {o} today?", "how long does it take to go to {o}?",
|
||||
"is {o} on your map?", "when I say go, go to {o}", "after the talk ends, go to {o}",
|
||||
"I'm going to {o}", "my friend is at {o}"], PLACES_EN[:5], "talk | ask | stop | end")
|
||||
each("go_not", ["{ro} 가지 마", "{ro} 가지 마세요", "{o}에는 가지 마", "{o} 어디예요?", "{o}까지 얼마나 걸려요?",
|
||||
"{o}에 가 봤어?", "제가 {o}에 갈게요", "내가 가라고 하면 {ro} 가", "제 친구가 {o}에 있어요"],
|
||||
PLACES_KO[:5], "talk | ask | stop | end") # "제가 스테이지에 갈게요": may be a goodbye
|
||||
# corrections inside the sentence: the last place said; the first one is never driven to
|
||||
for a, b, v in PAIRS_EN:
|
||||
for tpl in ["go to {a}, no, {b}", "go to {a}, sorry, I mean {b}", "go to {a}, actually, {b}", "go to {a}, wait, no, {b}",
|
||||
"go to {a}. No wait, go to {b}", "go to {a}, oops, {b}", "drive to {a}, I mean {b}, please"]:
|
||||
add("correct", tpl.format(a=a, b=b), f"action:go_to {v} | mission")
|
||||
for a, b, v in PAIRS_KO:
|
||||
for tpl in ["{ra} 가, 아니 {rb}", "{ra} 가, 아니 {rb} 가 줘", "{ra} 가 줘. 아 아니, {rb}", "{ra}, 아니다 {rb} 가 줘"]:
|
||||
add("correct", tpl.format(ra=ro(a), rb=ro(b)), f"action:go_to {v} | mission")
|
||||
for t in ["go to the stage, never mind", "go to the stage, no, forget it", "go to booth two, actually never mind",
|
||||
"come here, never mind", "turn left, no, never mind", "pick up the cup, no, forget it",
|
||||
"스테이지로 가, 아니 됐어", "이리 와, 아니야 됐어", "왼쪽으로 돌아, 아니 됐어요", "컵 집어, 아니 취소"]:
|
||||
add("correct", t, "talk")
|
||||
for t, want in [("move forward 1 meter, no, 2 meters", "action:move forward 2"),
|
||||
("move back 50 centimeters, sorry, 30 centimeters", "action:move back 0.3"),
|
||||
("go back 1 meter, no, forward", "action:move forward 1"),
|
||||
("turn left, no, right", "action:turn right"), ("turn left, I mean right", "action:turn right"),
|
||||
("turn right 45 degrees, no, 30", "action:turn right 30"),
|
||||
("look left, no, right", "action:look right"), ("look up, sorry, down", "action:look down"),
|
||||
("pick up the cup, no, the bottle", "action:pick bottle | mission"),
|
||||
("grab the apple, I mean the banana", "action:pick banana | mission"),
|
||||
("pick up the cup, no, the red one", "action:pick red cup | mission"),
|
||||
("go to the stage, no, pick up the cup", "action:pick cup | mission"),
|
||||
("go to the stage, no, the kitchen", "ask | talk"), ("go to the stage, no, dance", "ask | talk"),
|
||||
("앞으로 1미터, 아니 2미터 가", "action:move forward 2"), ("뒤로 1미터, 아니 50센티만 가 줘", "action:move back 0.5"),
|
||||
("왼쪽으로 돌아, 아니 오른쪽", "action:turn right"), ("왼쪽 봐, 아니 오른쪽", "action:look right"),
|
||||
("컵 집어, 아니 병", "action:pick bottle | mission"), ("사과 집어 줘, 아니 바나나", "action:pick banana | mission"),
|
||||
("go to 스테이지, 아니 부스 투", "action:go_to booth_2 | mission")]:
|
||||
add("correct", t, want)
|
||||
|
||||
# ---------- come, come back, follow ----------
|
||||
for t in ["come here", "come over here, please", "could you come here for a sec?", "come to me", "come closer",
|
||||
"get over here", "come this way", "Lumi, I need you over here, come here", "can you come over to me?",
|
||||
"이리 와", "이리 와 줄래?", "이쪽으로 와 주세요", "가까이 와", "여기로 와 봐", "나한테 와", "저한테 와 주실래요?",
|
||||
"루미야 이리 와 줘", "come here 해 줘"]:
|
||||
add("come", t, "action:come")
|
||||
for t in ["don't come here", "please don't come closer", "오지 마", "가까이 오지 마세요", "I'll come to you", "can I come closer?",
|
||||
"come here often?", "제가 갈게요"]:
|
||||
add("come_not", t, "talk | stop | action:move back | end")
|
||||
for t in ["come back", "come back please", "return to where you were", "go back to your spot", "could you go back where you were?",
|
||||
"come back to where you started", "돌아와", "다시 돌아와 줘", "원래 자리로 돌아가", "아까 있던 데로 돌아가 줘",
|
||||
"제자리로 돌아와 주세요"]:
|
||||
add("come_back", t, "action:come_back | mission")
|
||||
for t in ["I'll come back later", "come back tomorrow", "she will come back soon", "나중에 다시 올게요", "내일 다시 와"]:
|
||||
add("come_back_not", t, "talk | end")
|
||||
for t in ["follow me", "follow me please", "can you follow me?", "come with me", "walk with me", "keep following me",
|
||||
"come along", "Lumi, follow me to the booth", "따라와", "따라와 줄래?", "나 따라와", "저 따라오세요", "같이 가자",
|
||||
"저랑 같이 가요", "follow me 해 줘"]:
|
||||
add("follow", t, "action:follow")
|
||||
for t in ["don't follow me", "따라오지 마", "follow me on instagram", "did you follow what I said?", "I follow you on youtube",
|
||||
"do you follow me?", "제 말 따라와요?"]:
|
||||
add("follow_not", t, "talk | stop")
|
||||
add("follow_not", "stop following me", "stop")
|
||||
add("follow_not", "그만 따라와", "stop")
|
||||
|
||||
# ---------- short moves, turns ----------
|
||||
for t, want in [("move forward 1 meter", "action:move forward 1"), ("could you go forward half a meter?", "action:move forward 0.5"),
|
||||
("back up 30 centimeters please", "action:move back 0.3"), ("I'd like you to move back 1 meter", "action:move back 1"),
|
||||
("scoot back a little", "action:move back"), ("move 2 meters ahead", "action:move forward 2"),
|
||||
("go left 1 meter", "action:move left 1"), ("move to the right 50 cm", "action:move right 0.5"),
|
||||
("앞으로 1미터 가 줘", "action:move forward 1"), ("뒤로 50센티만 가", "action:move back 0.5"),
|
||||
("왼쪽으로 1미터 이동해 줄래요?", "action:move left 1"), ("뒤로 좀 물러나 주세요", "action:move back"),
|
||||
("앞으로 조금만 와", "action:move forward"), ("한 걸음 앞으로", "action:move forward 0.5"),
|
||||
("move back 20 cm, no, 10 cm", "action:move back 0.1"),
|
||||
("move back", "action:move back"), ("move forward 4 meters", "refuse"), ("앞으로 10미터 가", "refuse"),
|
||||
("move back twenty", "ask")]:
|
||||
add("move", t, want)
|
||||
for t, want in [("turn left", "action:turn left 90"), ("turn to the right please", "action:turn right 90"),
|
||||
("turn around", "action:turn around"), ("could you turn left 30 degrees?", "action:turn left 30"),
|
||||
("turn right 45 degrees", "action:turn right 45"), ("왼쪽으로 돌아", "action:turn left 90"),
|
||||
("오른쪽으로 돌아 줘", "action:turn right 90"), ("뒤로 돌아", "action:turn around"),
|
||||
("왼쪽으로 45도 돌아 주세요", "action:turn left 45"), ("한 바퀴 돌아 봐", "action:turn around"),
|
||||
("turn left 하고", "action:turn left | talk")]:
|
||||
add("turn", t, want)
|
||||
for t in ["don't turn", "돌지 마", "turn off the light", "turn up the volume", "it's your turn", "turn the page"]:
|
||||
add("turn_not", t, "talk | stop")
|
||||
TURNED = ("turn left", "ACTION: turn left 90")
|
||||
for t, want in [("again", "action:turn left 90"), ("한 번 더", "action:turn left 90"), ("one more time", "action:turn left 90"),
|
||||
("a bit more", "action:turn left 15"), ("조금 더", "action:turn left 15")]:
|
||||
add("again", t, want, before=TURNED)
|
||||
MOVED = ("move forward 1 meter", "ACTION: move forward 1")
|
||||
for t, want in [("again", "action:move forward 1"), ("do it again", "action:move forward 1"), ("same again please", "action:move forward 1"),
|
||||
("한 번 더", "action:move forward 1"), ("10센티 더", "action:move forward 0.1")]:
|
||||
add("again", t, want, before=MOVED)
|
||||
for t in ["again", "do that again", "한 번 더 해 줘"]:
|
||||
add("again", t, "ask") # nothing before it: "more of what?"
|
||||
|
||||
# ---------- look, lift ----------
|
||||
for t, want in [("look left", "action:look left"), ("look to your right", "action:look right"), ("look up", "action:look up"),
|
||||
("look down at the table", "action:look down"), ("look at me", "action:look me"),
|
||||
("could you look at me please?", "action:look me"), ("look straight ahead", "action:look center"),
|
||||
("turn your head left", "action:look left"), ("look behind you", "action:look"),
|
||||
("왼쪽 봐", "action:look left"), ("위를 봐", "action:look up"), ("나 봐", "action:look me"),
|
||||
("고개 숙여", "action:look down"), ("정면 봐 줘", "action:look center"), ("고개 오른쪽으로 돌려 줄래?", "action:look right"),
|
||||
("look away", "action:look away"), ("stop staring at me", "action:look away"),
|
||||
("look up the weather", "weather | search | talk"), ("look at that!", "talk | action:look"),
|
||||
("I'm looking for the toilet", "talk"), ("look what I have", "talk | seeing | action:look")]:
|
||||
add("look", t, want)
|
||||
for t, want in [("raise yourself", "action:lift up"), ("lift yourself up a bit", "action:lift up"),
|
||||
("lower yourself", "action:lift down"), ("could you get a little lower?", "action:lift down | talk"),
|
||||
("키 좀 높여 줘", "action:lift up"), ("몸 좀 낮춰", "action:lift down"), ("몸 5센티만 올려", "action:lift up"),
|
||||
("lift the cup", "action:pick cup | mission"), ("lift my spirits", "talk")]:
|
||||
add("lift", t, want)
|
||||
|
||||
# ---------- wave, bye-bye ----------
|
||||
for t in ["wave", "wave at them", "wave your hand", "wave hello", "give them a wave", "can you wave?", "wave to the camera",
|
||||
"say hi with your hand", "손 흔들어", "손 흔들어 줄래?", "손 인사 해 줘", "손 좀 흔들어 주세요", "애들한테 손 흔들어 줘",
|
||||
"wave 해 줘", "손 wave 해 봐"]:
|
||||
add("wave", t, "action:wave")
|
||||
for t in ["do you know how to wave?", "손 흔들 줄 알아?", "I saw you wave yesterday", "the wave was nice", "shake hands with me",
|
||||
"a new wave of visitors is coming"]:
|
||||
add("wave_not", t, "talk")
|
||||
for t in ["bye bye", "bye-bye!", "바이바이", "빠이빠이", "잘 가", "okay, bye!", "see you, Lumi"]:
|
||||
add("bye", t, "end")
|
||||
|
||||
# ---------- pick, put, give, receive, the hand ----------
|
||||
for t, want in [("would you mind picking up the cup?", "action:pick cup | mission"),
|
||||
("I'd like you to grab the bottle", "action:pick bottle | mission"),
|
||||
("could you maybe take the apple?", "action:pick apple | mission"),
|
||||
("pick the banana up for me, would you?", "action:pick banana | mission"),
|
||||
("go ahead and pick up the red cup", "action:pick red cup | mission"),
|
||||
("컵 좀 집어 줄래?", "action:pick cup | mission"), ("사과 좀 들어 줄 수 있어요?", "action:pick apple | mission"),
|
||||
("빨간 컵 잡아 주세요", "action:pick red cup | mission"), ("병 좀 집어 줘요", "action:pick bottle | mission"),
|
||||
("pick up the 컵", "action:pick cup | mission"), ("cup 집어", "action:pick cup | mission"),
|
||||
("don't pick up the cup", "talk"), ("컵 집지 마", "talk"), ("can you pick up a cup?", "talk"),
|
||||
("how do you pick up cups?", "talk"), ("I picked up a cup today", "talk")]:
|
||||
add("pick", t, want)
|
||||
for t, want in [("put it down please", "place"), ("set it down", "place"), ("place it on the table", "place"),
|
||||
("테이블에 내려놔 줘", "place"), ("여기 내려놓아 주세요", "place"), ("put it down, no, give it to me", "give"),
|
||||
("hand it over", "give"), ("give it to me please", "give"), ("I'll take it", "give"), ("can I have it?", "give"),
|
||||
("이리 줘", "give"), ("저 주세요", "give"), ("그거 저한테 건네 주실래요?", "give"),
|
||||
("don't drop it", "talk"), ("떨어뜨리지 마", "talk"), ("open your hand", "refuse")]:
|
||||
add("held", t, want, state="holding")
|
||||
for t, want in [("here, take this", "receive"), ("can you hold this for me?", "receive"), ("이거 받아 줄래요?", "receive"),
|
||||
("이거 좀 들고 있어 줘", "receive"), ("I have a cup for you, take it", "receive cup"),
|
||||
("open your hand", "action:arm open"), ("open the gripper please", "action:arm open"), ("손 펴 줘", "action:arm open"),
|
||||
("close your fingers", "action:arm close"), ("손 오므려", "action:arm close"), ("don't open your hand", "talk"),
|
||||
("give it to me", "empty_hand | talk"), ("put it down", "empty_hand | talk")]:
|
||||
add("hand", t, want)
|
||||
|
||||
# ---------- fetch, missions on this map ----------
|
||||
for t in ["bring me the cup from the stage", "get the bottle from booth two", "could you fetch the apple from table front?",
|
||||
"go to the stage and bring me the apple", "스테이지에서 컵 가져와", "부스 투에서 사과 가져다 줘",
|
||||
"엔드에 있는 병 가져와 줄래?", "fetch the banana from the end for me"]:
|
||||
add("fetch", t, "action:fetch | mission | refuse") # a bottle or banana: the reason why not
|
||||
for t in ["take the cup to booth two and come back", "go to the stage, wait 10 seconds, then come back",
|
||||
"스테이지 갔다 와", "부스 투 다녀와 줄래?", "먼저 스테이지 가서 컵 가져오고 그다음 여기로 와서 줘",
|
||||
"go to start, then middle, then end", "pick up the cup, go to the end and give it to Sarah"]:
|
||||
add("mission", t, "mission | action:fetch")
|
||||
for t in ["go to the stage and wave", "go to the stage and follow me", "pick up the cup and lift yourself up",
|
||||
"go to booth two and look left", "스테이지 가서 손 흔들어"]:
|
||||
add("mission_part", t, "talk | ask") # a part that is no task step: asked, never half done
|
||||
|
||||
# ---------- stop, speed ----------
|
||||
for t in ["stop", "stop it", "stop right now", "halt", "freeze", "stop, stop!", "wait, stop", "Lumi stop", "멈춰", "그만", "정지",
|
||||
"스톱", "멈춰 주세요", "거기 서", "stop 해"]:
|
||||
add("stop", t, "stop")
|
||||
for t in ["how do I stop you?", "where is your stop button?", "멈추는 방법이 뭐예요?"]:
|
||||
add("stop_not", t, "talk")
|
||||
add("stop_not", "bus stop", "talk | stop") # a stop is never a harmful motion
|
||||
add("stop_not", "don't stop talking", "talk | stop")
|
||||
for t, want in [("go faster", "speed faster"), ("speed up a little", "speed faster"), ("can you go quicker?", "speed faster"),
|
||||
("slow down", "speed slower"), ("not so fast please", "speed slower"), ("더 빨리 가", "speed faster"),
|
||||
("천천히 가 줘", "speed slower"), ("속도 좀 줄여 주세요", "speed slower"), ("you're too fast", "speed slower"),
|
||||
("speak slower", "talk"), ("천천히 말해 줘", "talk"), ("you speak too fast", "talk")]:
|
||||
add("speed", t, want)
|
||||
# ---------- every Korean speech level, slang and whisper's spellings (second round) ----------
|
||||
for t, want, st in [
|
||||
("스테이지로 가십시오", "action:go_to stage", "idle"), ("스테이지로 가시겠어요?", "action:go_to stage", "idle"),
|
||||
("스테이지로 가 줄 수 있니?", "action:go_to stage", "idle"), ("스테이지로 좀 가 봐요", "action:go_to stage", "idle"),
|
||||
("스테이지로 가자", "action:go_to stage", "idle"), ("스테이지로 가 볼까?", "action:go_to stage | talk", "idle"),
|
||||
("스테이지로 가면 안 돼?", "action:go_to stage | talk", "idle"), ("스테이지로 가야 해", "action:go_to stage", "idle"),
|
||||
("스테이지로 가 줬으면 좋겠어", "action:go_to stage", "idle"), ("스테이지 가 주라", "action:go_to stage", "idle"),
|
||||
("스테이지로 가 주시면 감사하겠습니다", "action:go_to stage | talk | end", "idle"),
|
||||
("이리 오세요", "action:come", "idle"), ("이리 와 주시겠어요?", "action:come", "idle"), ("이리 좀 와 볼래?", "action:come", "idle"),
|
||||
("여기로 와 주실 수 있나요?", "action:come", "idle"), ("따라오세요", "action:follow", "idle"),
|
||||
("따라와 주시겠어요?", "action:follow", "idle"), ("저를 따라와 주세요", "action:follow", "idle"),
|
||||
("앞으로 오십 센티 가 주세요", "action:move forward 0.5", "idle"), ("뒤로 조금만 물러나 주실래요?", "action:move back", "idle"),
|
||||
("왼쪽으로 돌아 주십시오", "action:turn left", "idle"), ("고개를 왼쪽으로 돌려 주세요", "action:look left", "idle"),
|
||||
("위를 봐 주실래요?", "action:look up", "idle"), ("손을 흔들어 주시겠어요?", "action:wave", "idle"),
|
||||
("손 좀 흔들어 줄 수 있어?", "action:wave", "idle"), ("컵을 집어 주시겠습니까?", "action:pick cup | mission", "idle"),
|
||||
("컵 좀 집어 주실 수 있나요?", "action:pick cup | mission", "idle"), ("그 컵 좀 집어 줘 봐", "action:pick cup | mission", "idle"),
|
||||
("멈춰 주세요", "stop", "idle"), ("그만하세요", "stop", "idle"), ("천천히 가 주세요", "speed slower", "idle"),
|
||||
("좀 더 빨리 가 줄래요?", "speed faster", "idle"),
|
||||
("그거 저 주세요", "give", "holding"), ("테이블에 놓아 주시겠어요?", "place", "holding"), ("저한테 주실래요?", "give", "holding"),
|
||||
("gimme a wave", "action:wave", "idle"), ("yo come here", "action:come", "idle"), ("c'mon follow me", "action:follow", "idle"),
|
||||
("go 2 the stage", "action:go_to stage", "idle"), ("goto the stage", "action:go_to stage", "idle"),
|
||||
("go too the stage", "action:go_to stage", "idle"), ("go to the stag", "action:go_to stage", "idle"),
|
||||
("go to stage pls", "action:go_to stage", "idle"), ("plz come here", "action:come", "idle"), ("come hear", "action:come", "idle"),
|
||||
("move forward a metre and a half", "action:move forward 1.5", "idle"), ("turn lefft", "action:turn left | talk | ask", "idle"),
|
||||
("look write", "action:look right | talk | ask", "idle"), ("lemme see you wave", "action:wave | talk | end", "idle")]:
|
||||
add("levels", t, want, st)
|
||||
for t, want in [("go ahead to the stage", "action:go_to stage"), ("you may go to booth two", "action:go_to booth_2"),
|
||||
("feel free to go to the stage", "action:go_to stage"), ("time to go to the stage", "action:go_to stage"),
|
||||
("I was wondering if you could go to the stage", "action:go_to stage"),
|
||||
("would it be possible for you to go to the stage?", "action:go_to stage | talk"),
|
||||
("is it okay if you go to the stage?", "action:go_to stage | talk"), ("mind going to the stage?", "action:go_to stage | talk"),
|
||||
("stop and come back", "stop"), ("wait, don't go there", "talk | stop"), ("no no no, stop", "stop"),
|
||||
("스테이지 가서 거기서 기다려", "mission"), ("거기 서!", "stop"), ("거기 서", "stop"),
|
||||
("look at the stage", "talk | ask | action:look"), ("face the stage", "talk | ask | action:look | action:turn")]:
|
||||
add("levels", t, want)
|
||||
# "can you ...?" asks it done (owner, 2026-10-20); "do you know how / can you X people" asks whether it can
|
||||
for t, want in [("can you raise yourself?", "action:lift up"), ("could you get a bit taller", "action:lift up"),
|
||||
("can you look to the left?", "action:look left"), ("could you turn around please", "action:turn around"),
|
||||
("can you move back a little?", "action:move back"), ("can you stop?", "stop"), ("멈출 수 있어?", "stop"),
|
||||
("Lumi, could you stop please?", "stop"), ("can you close your hand?", "action:arm close"),
|
||||
("왼쪽으로 돌아 줄 수 있어요?", "action:turn left"), ("이리 와 줄 수 있어요?", "action:come"),
|
||||
("turn left, would you?", "action:turn left"), ("turn around for me, will you?", "action:turn around"),
|
||||
("do you know how to follow people?", "talk"), ("can you follow people?", "talk | action:follow"),
|
||||
("do you turn left?", "talk"), ("can you stop talking?", "talk | action:quiet"),
|
||||
("can you pick that up?", "talk | ask"), ("how about turning left", "talk | action:turn left"),
|
||||
("would you mind looking at me?", "talk | action:look me")]:
|
||||
add("levels", t, want)
|
||||
R.shuffle(CASES) # the report lists them by intent; the order only spreads the LLM's load
|
||||
+32
-8
@@ -5,8 +5,9 @@
|
||||
.venv/bin/python tests/command_check.py --cached # the LLM's answers from the last --llm run where the text is
|
||||
# the same (fast, after a rule change)
|
||||
.venv/bin/python tests/command_check.py receive # only this intent
|
||||
.venv/bin/python tests/command_check.py --new # only the second set (tests/command_cases2.py); --old the first
|
||||
|
||||
-> logs/command_check.md / .json. The order is lumi.answer()'s with nothing running and the hand empty ("idle") or
|
||||
-> logs/command_check.md / .json (rules only: logs/command_check_rules.*). The order is lumi.answer()'s with nothing running and the hand empty ("idle") or
|
||||
holding something ("holding"): stop, what the cameras see (seeing.answer), status, the hand (brain.hand_request), mission, goodbye / closing words, song,
|
||||
keyword rules, then the LLM's action line acted on as lumi.answer() does. Nothing moves; the LLM is only asked.
|
||||
"""
|
||||
@@ -19,15 +20,20 @@ import time
|
||||
|
||||
from assistant import brain, driving, lumi, seeing
|
||||
from audio import sing
|
||||
from tests.command_cases import CASES
|
||||
from tests.command_cases import CASES as CASES1
|
||||
from tests.command_cases2 import CASES as CASES2 # 2026-10-21 night: new wordings, the conference map
|
||||
from tests.conversation_check import NOW, markers
|
||||
|
||||
ROOT = pathlib.Path(__file__).resolve().parents[1]
|
||||
OUT = ROOT / "logs" / "command_check"
|
||||
HOLDING_NOW = "I'm holding a cup and waiting for what to do with it."
|
||||
NO_MOTION = {"seeing", "talk", "unclear", "status", "empty_hand", "refuse", "search", "weather", "llm?", "ask", "speed"}
|
||||
QUICK = {"go_to", "come", "quiet", "weather", "search", "move", "turn", "arm", "pick", "put", "move_object", "fetch",
|
||||
"look", "lift", "wave"} # lumi.quick_command
|
||||
QUICK = {"go_to", "come", "follow", "come_back", "quiet", "weather", "search", "move", "turn", "arm", "pick", "put",
|
||||
"move_object", "fetch", "look", "lift", "wave"} # lumi.quick_command
|
||||
|
||||
|
||||
class NoLLM(Exception):
|
||||
"""A rules-only run reached the mission reader's LLM pass."""
|
||||
|
||||
|
||||
def seen(text):
|
||||
@@ -46,10 +52,15 @@ def rules(text, state, marks, b):
|
||||
holding = state == "holding"
|
||||
if lumi.FOREIGN_SCRIPT.search(text):
|
||||
return "unclear"
|
||||
fixed = brain.self_correct(text, marks) # "go to start, no, end"
|
||||
if not fixed:
|
||||
return "ask" if fixed is None else "talk"
|
||||
text = fixed
|
||||
t = brain._norm(text) # lumi.drive_words: speed, "again", how far?, too far
|
||||
drive = driving.read(t, driving.last_command(b.history), driving.talking(b.history))
|
||||
if drive and (drive[0] != "move" or drive != driving.read(t, None, True)):
|
||||
return {"speed": lambda d: f"speed {'faster' if d[1] > 0 else 'slower'}", "move": lambda d: f"action:move {d[1]}",
|
||||
"turn": lambda d: f"action:turn {d[1]}",
|
||||
"refuse": lambda d: "refuse", "ask": lambda d: "ask"}[drive[0]](drive)
|
||||
if lumi.NAME_ONLY.match(text):
|
||||
return "talk"
|
||||
@@ -70,7 +81,8 @@ def rules(text, state, marks, b):
|
||||
"refuse": lambda h: "refuse", "ask": lambda h: "talk"}[hand[0]](hand).strip()
|
||||
read = lumi.read_mission(text, marks)
|
||||
if read:
|
||||
return "talk" if read[1] else "mission"
|
||||
from assistant import steps # lumi.mission_request: refused before anything moves
|
||||
return "talk" if read[1] else "refuse" if steps.check(read[0], holding, marks) else "mission"
|
||||
if lumi.talk_fate(text) == "end":
|
||||
return "end"
|
||||
if lumi.talk_fate(text) == "wait":
|
||||
@@ -86,6 +98,7 @@ def rules(text, state, marks, b):
|
||||
def llm(text, state, marks, b):
|
||||
"""(route, action line, first sentence) from the real model, acted on like lumi.answer()."""
|
||||
brain.FORCED_LANG["lang"] = "ko" if brain.HANGUL.search(text) else "en"
|
||||
text = brain.self_correct(text, marks) or text
|
||||
gen = b.respond_stream(text, marks, now=HOLDING_NOW if state == "holding" else NOW)
|
||||
head = next(gen)
|
||||
first = next(gen, "") or ""
|
||||
@@ -136,20 +149,31 @@ def ok(expect, got):
|
||||
|
||||
|
||||
def main(args):
|
||||
global OUT
|
||||
marks = markers()
|
||||
use_llm, cached = "--llm" in args, "--cached" in args
|
||||
cases = CASES2 if "--new" in args else CASES1 if "--old" in args else CASES1 + CASES2
|
||||
only = [a for a in args if not a.startswith("-")]
|
||||
old = {}
|
||||
if cached and OUT.with_suffix(".json").exists():
|
||||
old = {(r["text"], r["state"], str(r["before"])): r for r in json.loads(OUT.with_suffix(".json").read_text())
|
||||
if r.get("raw")}
|
||||
if not use_llm and not cached:
|
||||
OUT = OUT.with_name("command_check_rules") # a rules-only run keeps the last LLM run's report
|
||||
if not use_llm: # a mission's LLM pass (lumi.read_mission) only with --llm
|
||||
from assistant import steps
|
||||
steps._ollama = lambda *a: (_ for _ in ()).throw(NoLLM())
|
||||
rows, t0 = [], time.time()
|
||||
for i, c in enumerate(c for c in CASES if not only or c["intent"] in only):
|
||||
for i, c in enumerate(c for c in cases if not only or c["intent"] in only):
|
||||
b = brain.Brain()
|
||||
if c["before"]:
|
||||
b.history.append(tuple(c["before"]))
|
||||
brain.FORCED_LANG["lang"] = c["lang"] if c["lang"] in ("en", "ko") else "ko"
|
||||
got, raw, first = rules(c["text"], c["state"], marks, b), "", ""
|
||||
mk = c.get("markers") or marks
|
||||
try:
|
||||
got, raw, first = rules(c["text"], c["state"], mk, b), "", ""
|
||||
except NoLLM:
|
||||
got, raw, first = "llm?", "", ""
|
||||
if got is None:
|
||||
key = (c["text"], c["state"], str(c["before"]))
|
||||
if key in old:
|
||||
@@ -158,7 +182,7 @@ def main(args):
|
||||
got = act(a, tgt, first, c["state"])
|
||||
elif use_llm:
|
||||
try:
|
||||
got, raw, first = llm(c["text"], c["state"], marks, b)
|
||||
got, raw, first = llm(c["text"], c["state"], mk, b)
|
||||
except Exception as e: # noqa: BLE001 - a crash is a failure of that case
|
||||
got, raw = "error", repr(e)
|
||||
else:
|
||||
|
||||
@@ -0,0 +1,197 @@
|
||||
"""Missions (docs/17), seventh round (2026-10-21 night): three or four steps said in one breath, English, Korean and
|
||||
mixed, on the conference map (CONF: start, end, init, final, middle, table_front, stage, booth_2, home, dock2), with
|
||||
then / and / after that / 그리고 / 다음에 / -고 / -서, fillers ("먼저", "그다음", "I'd like you to"), waits, named
|
||||
people, "갔다 와" / "다녀와". Same notation as tests/test_steps.py; "?" = some words must stay unread (nothing runs).
|
||||
|
||||
FIXED: said with a correction inside ("go to start, no, end, then come back"): brain.self_correct first, then read.
|
||||
READ_BACK: the sentence Lumi says before starting (steps.describe), English and Korean.
|
||||
"""
|
||||
CONF = ["home", "start", "end", "init", "final", "middle", "table_front", "stage", "booth_2", "dock2"]
|
||||
|
||||
CASES = {
|
||||
# ---- the owner's examples, on this map ----
|
||||
"take the cup, go to booth two, give it to James and come back": "pick cup | go booth_2 | give James | go here",
|
||||
"먼저 스테이지 가서 컵 가져오고 그다음 여기로 와서 줘": "go stage | pick cup | go here | give",
|
||||
"take the cup, go to the stage, give it to the person there and come back here": "pick cup | go stage | give | go here",
|
||||
# ---- English: then / and / after that ----
|
||||
"pick up the cup, then go to the end, then give it to Sarah": "pick cup | go end | give Sarah",
|
||||
"grab the apple and take it to table front and put it on the table": "pick apple | go table_front | place dining table",
|
||||
"go to booth two, pick up the cup, and bring it back to me": "go booth_2 | pick cup | go here | give",
|
||||
"go to the stage, wait 10 seconds, then come back": "go stage | wait 10 | go here",
|
||||
"go to start, after that go to middle, after that go to end": "go start | go middle | go end",
|
||||
"first go to start, then go to the middle, and finally come back here": "go start | go middle | go here",
|
||||
"go to the stage and wait there for 2 minutes, then go to booth two and come back": "go stage | wait 120 | go booth_2 | go here",
|
||||
"take the cup to the stage, put it on the table and come back": "pick cup | go stage | place dining table | go here",
|
||||
"could you take the cup to the stage and then come back here please": "pick cup | go stage | go here",
|
||||
"I'd like you to take the cup, go to the end and hand it to Sarah": "pick cup | go end | give Sarah",
|
||||
"I want you to go to the stage, say hello everyone, and come back": "go stage | say hello everyone | go here",
|
||||
"go to init, turn around and come back": "go init | turn 180 | go here",
|
||||
"turn left, go forward one meter, turn right and go forward half a meter": "turn 90 | move forward 1 | turn -90 | move forward 0.5",
|
||||
"go forward 1 meter then turn around then go forward 1 meter": "move forward 1 | turn 180 | move forward 1",
|
||||
"go to booth 2, wait until someone gives you a cup, then bring it here": "go booth_2 | receive cup wait | go here",
|
||||
"go to the stage and do what they tell you": "go stage | wait order",
|
||||
"go to table front, ask them for the cup, then bring it to the stage": "go table_front | receive cup | go stage",
|
||||
"take the cup from start to end and give it to Mr. Kim": "go start | pick cup | go end | give Mr. Kim",
|
||||
"pick up the red cup, go to the final point, and hold it": "pick red cup | go final | hold",
|
||||
"go to the middle, then booth two, then the stage": "go middle | go booth_2 | go stage",
|
||||
"go to start, middle and end": "go start | go middle | go end",
|
||||
"go to the stage, after 30 seconds go to end": "go stage | wait 30 | go end",
|
||||
"wait 5 seconds then go to the stage and come back": "wait 5 | go stage | go here",
|
||||
"bring the cup to James at the stage": "pick cup | go stage | give James",
|
||||
"take this cup to Anna, she is at booth two": "go booth_2 | give Anna",
|
||||
"go to the end and stay there": "go end | wait",
|
||||
"go to the stage, wait there, then go home": "go stage | wait | go home",
|
||||
"Lumi, go to start and then come back, thanks": "go start | go here",
|
||||
"um, take the cup, uh, go to the stage and give it to them": "pick cup | go stage | give",
|
||||
"please go to the stage, after that come back and give it to me": "go stage | go here | give",
|
||||
"go to the stage, then come back and turn left": "go stage | go here | turn 90",
|
||||
"go to the stage once you're there say welcome and then come back": "go stage | say welcome | go here",
|
||||
"go to booth 2 and tell them the demo starts at 3, then go to the stage": "go booth_2 | say the demo starts at 3 | go stage",
|
||||
"take the cup and bring it to one of start, middle or end": "pick cup | go start,middle,end",
|
||||
"head to table front, then make your way to the stage and come back": "go table_front | go stage | go here",
|
||||
"navigate to the stage and then return here": "go stage | go here",
|
||||
# ---- Korean: -고 / -서 / 그리고 / 다음에, every speech level ----
|
||||
"스테이지 가서 컵 가져오고 여기로 와": "go stage | pick cup | go here",
|
||||
"컵 집고 스테이지로 가서 제임스한테 줘": "pick cup | go stage | give 제임스",
|
||||
"컵 가지고 스테이지 가서 김 대리님께 드려": "pick cup | go stage | give 김 대리님",
|
||||
"스타트로 가서 10초 기다렸다가 엔드로 가": "go start | wait 10 | go end",
|
||||
"부스 투에서 병 집어서 테이블 프론트로 가져가": "go booth_2 | pick bottle | go table_front",
|
||||
"스테이지 가서 안녕하세요라고 말하고 돌아와": "go stage | say 안녕하세요 | go here",
|
||||
"스테이지 갔다 와": "go stage | go here",
|
||||
"부스 투 다녀와 줄래?": "go booth_2 | go here",
|
||||
"스테이지 갔다가 엔드로 가 줘": "go stage | go end",
|
||||
"앞으로 1미터 가고 왼쪽으로 돌고 다시 1미터 가": "move forward 1 | turn 90 | move forward 1",
|
||||
"먼저 미들로 가고 그다음 엔드로 가 주세요": "go middle | go end",
|
||||
"스타트로 가고 그리고 미들로 가고 마지막으로 엔드로 가": "go start | go middle | go end",
|
||||
"컵 들고 스테이지로 가서 테이블에 놔 줘": "pick cup | go stage | place dining table",
|
||||
"컵 잡고 엔드로 가서 사라한테 주고 돌아와": "pick cup | go end | give 사라 | go here",
|
||||
"부스 투에 가서 누가 컵 주면 받아서 여기로 가져와": "go booth_2 | receive cup wait | go here",
|
||||
"스테이지에 가서 2분 기다리고 돌아오세요": "go stage | wait 120 | go here",
|
||||
"엔드로 가서 거기서 기다려": "go end | wait",
|
||||
"스테이지 가서 거기 있는 사람이 시키는 거 해": "go stage | wait order",
|
||||
"테이블 프론트에 가서 컵 받아서 스테이지로 가져가": "go table_front | receive cup | go stage",
|
||||
"스타트 갔다가 다시 돌아와 줄래요?": "go start | go here",
|
||||
"컵을 집어서 파이널로 가 주시고 거기 계신 분께 드리세요": "pick cup | go final | give",
|
||||
"사과 들고 미들로 가서 들고 있어": "pick apple | go middle | hold",
|
||||
"뒤로 돌아서 앞으로 2미터 가고 오른쪽으로 돌아": "turn 180 | move forward 2 | turn -90",
|
||||
"5초 있다가 스테이지로 가": "wait 5 | go stage",
|
||||
"스테이지로 가서 이 분 기다렸다가 돌아와": "go stage | wait 120 | go here",
|
||||
"이닛으로 가서 뒤로 돌고 와": "go init | turn 180 | go here",
|
||||
# ---- mixed ----
|
||||
"take the cup 하고 스테이지로 가서 줘": "pick cup | go stage | give",
|
||||
"스테이지 가서 pick up the cup 하고 돌아와": "go stage | pick cup | go here",
|
||||
"go to 스테이지, wait 10 seconds, 그리고 돌아와": "go stage | wait 10 | go here",
|
||||
"컵 take해서 booth 2로 가져가": "pick cup | go booth_2",
|
||||
"go to 부스 투 and then come back": "go booth_2 | go here",
|
||||
# ---- must not run: unread or not on the map ----
|
||||
"go to the stage and wave": "?",
|
||||
"go to the stage and follow me": "?",
|
||||
"pick up the cup and lift yourself up": "?",
|
||||
"go to booth two and look left": "?",
|
||||
"go to the stage and dance": "?",
|
||||
"go to the kitchen, then come back": "?",
|
||||
"take the cup to p3 and come back": "?", # p3 is not on this map
|
||||
"go to booth, then come back": "?", # which booth? never guessed
|
||||
"go to the stage for a while and come back": "?", # how long? never guessed
|
||||
"스테이지 가서 춤추고 와": "?",
|
||||
"부엌에 가서 컵 가져와": "?",
|
||||
"go to the stage and give it to him": "?", # nothing in the hand before: refused by check
|
||||
}
|
||||
|
||||
# second round: Korean "-고 나서" / "-ㄴ 다음에", a gift with the object in between, no commas (whisper), ordinals,
|
||||
# "after you get to ...", "hang around", "wait for my call", "come right back"
|
||||
CASES.update({
|
||||
"스테이지에 가고 나서 엔드로 가": "go stage | go end",
|
||||
"스테이지에 간 다음에 엔드로 가 줘": "go stage | go end",
|
||||
"컵을 집은 다음에 스테이지로 가": "pick cup | go stage",
|
||||
"컵 집고 나서 스테이지로 가져가": "pick cup | go stage",
|
||||
"스테이지에 갔다가 부스 투로 가서 컵 받아 와": "go stage | go booth_2 | receive cup | go here",
|
||||
"스테이지로 가서 10초만 기다렸다가 돌아와": "go stage | wait 10 | go here",
|
||||
"스테이지 가서 잠깐 기다렸다가 와": "go stage | wait 10 | go here",
|
||||
"스테이지까지 가서 사라 씨한테 컵 전해 줘": "go stage | give 사라",
|
||||
"엔드로 가서 거기 있는 분한테 이거 드리고 와": "go end | give | go here",
|
||||
"부스 투에 있는 제임스한테 이 컵 갖다줘": "pick cup | go booth_2 | give 제임스",
|
||||
"go to the stage then wait ten secs then come back": "go stage | wait 10 | go here",
|
||||
"go to the stage, hang around for 10 seconds, then come back": "go stage | wait 10 | go here",
|
||||
"go to start, then to middle, then back here": "go start | go middle | go here",
|
||||
"take the cup over to booth two and come right back": "pick cup | go booth_2 | go here",
|
||||
"bring the cup over to the stage and leave it on the table": "pick cup | go stage | place dining table",
|
||||
"go grab the cup, bring it to the stage": "pick cup | go stage",
|
||||
"go to the stage and get me the cup": "go stage | pick cup | go here | give",
|
||||
"after you get to the stage, wait 5 seconds and come back": "go stage | wait 5 | go here",
|
||||
"when you get to the stage, say hello": "go stage | say hello",
|
||||
"go to stage wait 10 seconds come back": "go stage | wait 10 | go here",
|
||||
"first take the cup, second go to the stage, third give it to Sarah": "pick cup | go stage | give Sarah",
|
||||
"take the cup and go to booth two, then wait there until someone takes it": "pick cup | go booth_2 | give",
|
||||
"go to the stage and give the cup to whoever is there": "go stage | give",
|
||||
"go to the stage and hand the cup to the first person you see": "go stage | give",
|
||||
"go to booth two and wait for my call": "go booth_2 | wait",
|
||||
"booth 2 가서 컵 가져오고 스테이지로 가": "go booth_2 | pick cup | go stage",
|
||||
"go to 엔드 and 컵 가져와": "go end | pick cup | go here",
|
||||
})
|
||||
|
||||
# third round: "not booth two", a message to a named person, people and places in any order
|
||||
CASES.update({
|
||||
"take the cup to the stage, not booth two": "pick cup | go stage",
|
||||
"스테이지 말고 부스 투로 가서 컵 줘": "go booth_2 | pick cup | go here | give",
|
||||
"go to the stage and tell Sarah the meeting is at 3": "go stage | say the meeting is at 3",
|
||||
"go to Sarah at the stage and give her the cup": "go stage | give Sarah",
|
||||
"Sarah is at booth two, bring her the cup": "pick cup | go booth_2 | give Sarah",
|
||||
"사라는 부스 투에 있어, 컵 갖다줘": "pick cup | go booth_2 | give 사라",
|
||||
"컵을 사라한테 갖다 줘, 사라는 부스 투에 있어": "pick cup | go booth_2 | give 사라",
|
||||
"go to the stage, and if nobody is there, come back": "?", # no conditions in a task: asked
|
||||
"go to the stage, wait a few minutes, then come back": "?", # how long? never guessed
|
||||
"스테이지 가서 몇 분 기다렸다가 와": "?",
|
||||
"go to the stage, wait 30 seconds, go to booth two, wait 30 seconds, then come back":
|
||||
"go stage | wait 30 | go booth_2 | wait 30 | go here",
|
||||
"can you go to booth 2 and ask for a cup and bring it to me": "go booth_2 | receive cup | go here | give",
|
||||
"turn around, take the cup and give it to me": "turn 180 | pick cup | give",
|
||||
"take the cup and put it on the chair at the stage": "pick cup | go stage | place chair",
|
||||
})
|
||||
|
||||
# fourth round: 하십시오체 / 해요체 with -시- ("가셔서", "받으시고", "기다리신 후에"), "거기서 기다려" (no stop),
|
||||
# "who is at", "from the table there", "at the stage"
|
||||
CASES.update({
|
||||
"컵을 들고 스테이지로 가신 다음에 테이블에 올려 주세요": "pick cup | go stage | place dining table",
|
||||
"스테이지에 가셔서 10초 기다리신 후에 돌아오세요": "go stage | wait 10 | go here",
|
||||
"부스 투에 가셔서 컵을 받으시고 여기로 가져와 주십시오": "go booth_2 | receive cup | go here",
|
||||
"먼저 컵을 집으시고 엔드로 가셔서 사라 씨께 드리세요": "pick cup | go end | give 사라",
|
||||
"스테이지로 가서 컵 가져오고, 그 다음에 부스 투로 가서 제임스한테 줘": "go stage | pick cup | go booth_2 | give 제임스",
|
||||
"컵 집어서 스테이지로 가져가서 테이블에 놓고 돌아와": "pick cup | go stage | place dining table | go here",
|
||||
"스테이지 갔다가 부스 투 갔다가 돌아와": "go stage | go booth_2 | go here",
|
||||
"앞으로 1미터 갔다가 다시 돌아와": "move forward 1 | go here",
|
||||
"오른쪽으로 돌고 앞으로 50센티 가고 컵 집어": "turn -90 | move forward 0.5 | pick cup",
|
||||
"스테이지로 가서 30초 있다가 엔드로 가서 기다려": "go stage | wait 30 | go end | wait",
|
||||
"야 스테이지 가서 컵 좀 가져와 봐": "go stage | pick cup | go here",
|
||||
"스테이지 가서 거기서 기다려": "go stage | wait",
|
||||
"스테이지 가서 기다리다가 누가 컵 주면 받아서 와": "go stage | receive cup wait | go here",
|
||||
"go to the stage, take a cup from the table there and bring it to booth two": "go stage | pick cup | go booth_2",
|
||||
"go pick up the cup at the stage and bring it to me": "go stage | pick cup | go here | give",
|
||||
"take the cup and bring it to Sarah, who is at booth two": "pick cup | go booth_2 | give Sarah",
|
||||
"go to the stage and wait there until I tell you to come back": "go stage | wait",
|
||||
"go ahead to the stage and come back": "go stage | go here",
|
||||
"pick up the cup, go forward half a meter, turn right, go forward one meter and put it on the table":
|
||||
"pick cup | move forward 0.5 | turn -90 | move forward 1 | place dining table",
|
||||
})
|
||||
|
||||
# said with a correction inside: brain.self_correct reads it first (lumi.answer)
|
||||
FIXED = {
|
||||
"take the cup, go to start, no, end, and give it to James": "pick cup | go end | give james",
|
||||
"go to start, sorry, I mean the stage, then come back": "go stage | go here",
|
||||
"go to the stage, wait 10 seconds, no, 20 seconds, then come back": "go stage | wait 20 | go here",
|
||||
"컵 들고 스타트로 가, 아니 엔드로 가서 줘": "pick cup | go end | give",
|
||||
"pick up the cup, no, the apple, and bring it to the stage": "pick apple | go stage",
|
||||
}
|
||||
|
||||
# the read-back (steps.describe) for a few of them
|
||||
READ_BACK = {
|
||||
"pick cup | go booth_2 | give James | go here":
|
||||
("Take the cup, go to booth 2, hand it to James, then come back here.",
|
||||
"컵을 집고 booth 2 위치로 가고 James에게 건네주고 여기로 돌아올게요."),
|
||||
"go stage | pick cup | go here | give":
|
||||
("Go to stage, take the cup, come back here, then hand it over.",
|
||||
"stage 위치로 가고 컵을 집고 여기로 돌아오고 건네줄게요."),
|
||||
"go table_front | wait 30 | go home":
|
||||
("Go to table front, wait 30 seconds, then go to my dock.",
|
||||
"table front 위치로 가고 30초 기다리고 충전소로 갈게요."),
|
||||
}
|
||||
@@ -151,4 +151,11 @@ for m, v in ((0.01, "-0.050"), (0.3, "-0.120")):
|
||||
assert vel == {v}, (m, vel)
|
||||
fetch.speed_factor = 1.0
|
||||
fetch.agv.request, skills.moved = real_request, real_moved
|
||||
# "again" / "a bit more" right after a turn (2026-10-21)
|
||||
_turn = driving.last_command([("turn left", "ACTION: turn left 90")])
|
||||
assert _turn == ("turn", "left 90"), _turn
|
||||
for _t, _want in {"again": ("turn", "left 90"), "한 번 더": ("turn", "left 90"), "one more time": ("turn", "left 90"),
|
||||
"a bit more": ("turn", "left 15"), "조금 더": ("turn", "left 15")}.items():
|
||||
assert driving.read(brain._norm(_t), _turn) == _want, (_t, driving.read(brain._norm(_t), _turn))
|
||||
assert driving.read("a bit more", ("turn", "around 180")) == ("ask", "")
|
||||
print("driving: all self-checks passed")
|
||||
|
||||
@@ -0,0 +1,78 @@
|
||||
"""Self-check of commands of several steps said by voice, the way lumi.answer() takes them (docs/17 §2, §6): the
|
||||
correction inside the sentence (brain.self_correct), lumi.read_mission (a mission, the plain fetch, or asked again:
|
||||
a part that is no task step is never done half), the read-back sentence, and the Greeter-only rule (a mission that
|
||||
drives is refused with one line, one that stays in place runs). Fake robot; the mission reader's LLM pass faked
|
||||
(it reads nothing):
|
||||
python tests/test_mission_route.py"""
|
||||
import types
|
||||
|
||||
from assistant import brain, lumi, steps
|
||||
from tasks import fetch
|
||||
from tests import steps_cases7 as c7
|
||||
|
||||
M = c7.CONF
|
||||
|
||||
|
||||
def forbid(*a, **k):
|
||||
raise AssertionError("a test reached the robot")
|
||||
|
||||
|
||||
refusal = lumi.skills.refusal # a table of what the fingers can't take, no robot
|
||||
for mod in (lumi.agv, lumi.head, lumi.arm, lumi.gripper, lumi.motion, lumi.skills): # nothing may reach the robot
|
||||
for name in dir(mod):
|
||||
if not name.startswith("_") and callable(getattr(mod, name)) and not isinstance(getattr(mod, name), type):
|
||||
setattr(mod, name, forbid)
|
||||
lumi.skills.refusal = refusal
|
||||
steps._ollama = lambda messages, fmt: {"language": "English"} if fmt == "json" else {"steps": [{"do": "unknown"}]}
|
||||
lumi.log = fetch.log = lambda *a: None
|
||||
|
||||
# ---------- every mission of the conference set: read whole, or the plain fetch; "?": asked, nothing moves ----------
|
||||
bad = []
|
||||
for text, want in list(c7.CASES.items()) + list(c7.FIXED.items()):
|
||||
t = brain.self_correct(text, M)
|
||||
read = lumi.read_mission(t, M)
|
||||
rule = brain.intent(t, M)
|
||||
if want == "?":
|
||||
asked = read is not None and read[1]
|
||||
refused = read is not None and not read[1] and steps.check(read[0], False, M)
|
||||
if not (asked or refused or read is None and (rule is None or rule[0] == "fetch")):
|
||||
bad.append((text, read, rule))
|
||||
elif not (read and not read[1] or read is None and rule and rule[0] == "fetch"):
|
||||
bad.append((text, read, rule))
|
||||
assert not bad, bad
|
||||
|
||||
# ---------- the corrections said by voice ----------
|
||||
FIX = {"go to start, no, end": "go to end", "스타트로 가, 아니 엔드로": "end로 가", "turn left, I mean right": "turn right",
|
||||
"앞으로 1미터, 아니 2미터 가": "앞으로 2 m 가", "컵 집어, 아니 병": "병 집어", "go to the stage, never mind": "",
|
||||
"스테이지로 가, 아니 됐어": "", "go to the stage, no, the kitchen": None, "I like apples, no, I love them": None,
|
||||
"go to the stage, no rush": None, "no, go to the end": None}
|
||||
for text, want in FIX.items():
|
||||
got = brain.self_correct(text, M)
|
||||
assert got == (text if want is None and text in ("I like apples, no, I love them", "go to the stage, no rush",
|
||||
"no, go to the end") else want), (text, got)
|
||||
|
||||
# ---------- Greeter only: a mission that drives is refused, one in place runs ----------
|
||||
said, started = [], []
|
||||
L = lumi.Lumi.__new__(lumi.Lumi)
|
||||
L.lang, L.markers, L.current = "en", M, None
|
||||
L.brain = types.SimpleNamespace(history=[])
|
||||
L.keep_listening = lambda: None
|
||||
L.fetch_say = lambda en, ko=None: said.append(en)
|
||||
L.fetch_status = lambda: None
|
||||
L.modes = types.SimpleNamespace(greeter=True, patrol=False, drive=True, wave=True)
|
||||
fetch.check_hand = lambda: False
|
||||
lumi.fetch_dialog = types.SimpleNamespace(run_steps=lambda s, hear, say, describe, start: started.append(s) or "started")
|
||||
for text in ("take the cup, go to booth two, give it to James and come back", "스테이지 갔다 와",
|
||||
"go to the stage, wait 10 seconds, then come back"):
|
||||
said.clear(), started.clear()
|
||||
assert L.mission_request(text) and said == [lumi.BASE_OFF_SAY[0]] and not started, (text, said, started)
|
||||
for text in ("pick up the cup and give it to me", "컵 집어서 나한테 줘"):
|
||||
said.clear(), started.clear()
|
||||
assert L.mission_request(text) and started and not said, (text, said, started)
|
||||
said.clear()
|
||||
assert L.mission_request("go to the stage and wave") and said and said[0].startswith("Sorry, I can't do that as part"), said
|
||||
L.modes.patrol = True
|
||||
said.clear(), started.clear()
|
||||
assert L.mission_request("take the cup, go to booth two, give it to James and come back") and started
|
||||
assert steps.describe(started[0]) == "Take the cup, go to booth 2, hand it to James, then come back here."
|
||||
print("mission route ok")
|
||||
+4
-1
@@ -22,4 +22,7 @@ assert llm_direct.render([{"role": "system", "content": "S"}, {"role": "user", "
|
||||
{"role": "assistant", "content": "A"}, {"role": "user", "content": "Q2"}]) == \
|
||||
("<|turn>system\nS<turn|>\n<|turn>user\nQ<turn|>\n<|turn>model\nA<turn|>\n<|turn>user\nQ2<turn|>\n"
|
||||
"<|turn>model\n<|channel>thought\n<channel|>")
|
||||
print(f"ok: {len(CUTS)} cuts, the prompt")
|
||||
# a prefill (system + turns) is the start of the next prompt, so the runner's cache holds it
|
||||
start = [{"role": "system", "content": "S"}, {"role": "user", "content": "Q"}, {"role": "assistant", "content": "A"}]
|
||||
assert llm_direct.render(start + [{"role": "user", "content": "Q2"}]).startswith(llm_direct.render(start, reply=False))
|
||||
print(f"ok: {len(CUTS)} cuts, the prompt, the prefill")
|
||||
|
||||
+27
-3
@@ -213,7 +213,7 @@ print("steps ok")
|
||||
fake = {}
|
||||
steps._ollama = lambda messages, fmt: fake["lang"] if fmt == "json" else fake["steps"]
|
||||
fake["lang"] = {"language": "English"}
|
||||
cmd = "grab the bottle and then kindly roll over to p4, after that put it onto the white table"
|
||||
cmd = "grab the bottle and then kindly zip over to p4, after that put it onto the white table"
|
||||
fake["steps"] = {"steps": [{"do": "pick", "object": "bottle"}, {"do": "go", "to": ["p4"]},
|
||||
{"do": "place", "on": {"name": "dining table", "colour": "white"}}]}
|
||||
got, unread, by = steps.read(cmd, M)
|
||||
@@ -251,8 +251,8 @@ assert llm_says("go to p1, then roll back 1.5 m and wiggle", [{"do": "go", "to":
|
||||
assert llm_says("kindly roll forward 1 m and then wiggle", [{"do": "move", "dir": "forward", "m": 1},
|
||||
{"do": "move", "dir": "forward", "m": 1}])[2] == "rules" # said once, driven twice
|
||||
assert llm_says("don't take the cup, just roll over to p1", [{"do": "go", "to": ["p1"]}])[2] == "rules"
|
||||
assert llm_says("take the cup and then roll over to p1", [{"do": "go", "to": ["p1"]}])[2] == "rules" # pick left out
|
||||
got = llm_says("take the cup and then roll over to p1", [{"do": "pick", "object": "cup"}, {"do": "go", "to": ["p1"]}])
|
||||
assert llm_says("take the cup and then zip over to p1", [{"do": "go", "to": ["p1"]}])[2] == "rules" # pick left out
|
||||
got = llm_says("take the cup and then zip over to p1", [{"do": "pick", "object": "cup"}, {"do": "go", "to": ["p1"]}])
|
||||
assert got[2] == "llm" and got[0] == S("pick cup | go p1"), got
|
||||
|
||||
# ---- lists: only "or" / one of / 중 is a choice; "and" is both, in turn ----
|
||||
@@ -293,3 +293,27 @@ assert llm_says("go to p2, then chill there and wiggle", [{"do": "go", "to": ["p
|
||||
assert llm_says("go to p2, then chill there and do whatever the visitors tell you", [{"do": "go", "to": ["p2"]},
|
||||
{"do": "wait", "s": None, "until": "instruction"}])[0] == S("go p2 | wait order")
|
||||
print("steps wait ok")
|
||||
|
||||
# ---- three or four steps in one breath on the conference map (tests/steps_cases7.py) ----
|
||||
from assistant import brain
|
||||
from tests import steps_cases7 as c7
|
||||
failed = []
|
||||
for text, want in list(c7.CASES.items()) + [(brain.self_correct(t, c7.CONF), w) for t, w in c7.FIXED.items()]:
|
||||
got, unread = steps.rules(text, c7.CONF)
|
||||
if want == "?":
|
||||
ok = bool(unread) or bool(steps.check(got, False, c7.CONF))
|
||||
else:
|
||||
ok = not unread and got == [short(x.strip()) for x in want.split(" | ")]
|
||||
if not ok:
|
||||
failed.append(text)
|
||||
print(f"FAIL {text!r}\n want {want}\n got {got}\n unread {unread}")
|
||||
for want, (en, ko) in c7.READ_BACK.items():
|
||||
s_ = [short(x.strip()) for x in want.split(" | ")]
|
||||
for lang, said in (("en", en), ("ko", ko)):
|
||||
if steps.describe(s_, lang) != said:
|
||||
failed.append(want)
|
||||
print(f"FAIL read-back {lang} {want!r}\n want {said}\n got {steps.describe(s_, lang)}")
|
||||
print(f"{len(c7.CASES) + len(c7.FIXED) - sum(1 for f in failed if f in c7.CASES or f in c7.FIXED.values())}/"
|
||||
f"{len(c7.CASES) + len(c7.FIXED)} read right on the conference map")
|
||||
assert not failed
|
||||
print("steps conference ok")
|
||||
|
||||
Reference in New Issue
Block a user