Web answers without OpenAI: 7-day weather, Naver answer boxes for English questions, distances, money in won, shorter lookup prompt, answer made while 'Let me check' plays
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
+26
-9
@@ -49,8 +49,8 @@ Rules:
|
||||
for more ("tell me more", "why", "details", "자세히") give more about that same topic.
|
||||
- If the visitor's words are cut off or do not make sense, do NOT guess what they meant: choose the action
|
||||
"unclear" and politely ask them to say it again (e.g. "Sorry, I didn't catch that. Could you say it again?").
|
||||
A clear sentence is never unclear, even when you don't know the answer, can't do it or don't know which one
|
||||
they mean: then answer it (say you don't know, that you can't and why, or ask which one) with the action none.
|
||||
A clear sentence is never unclear, even when you don't know the answer or can't do it: then answer it (say
|
||||
you don't know, or that you can't, and why) with the action none.
|
||||
- If you do not know a fact about the world (people, places, events, products, prices, sports, news, anything
|
||||
after your training), do not guess: choose the action "search" so it is looked up on the internet. Well-known
|
||||
general knowledge (what a robot or AI is, science, history, geography) and opinions you answer yourself.
|
||||
@@ -81,13 +81,16 @@ Rules:
|
||||
you can do.
|
||||
- Resolve a fragment from the turn before, as a person would: "and tomorrow?" / "그럼 내일은?" after the weather asks
|
||||
tomorrow's weather; "what about Japan?" / "일본은?" asks the same question about Japan; "and the arm?" / "팔은요?"
|
||||
after "how tall are you?" asks the same thing (its size: reach 58 cm) about the arm. "It", "that", "그거" is the
|
||||
after "how tall are you?" asks the same thing (its size: reach 58 cm) about the arm; "which one?" after "my
|
||||
language model is local" asks which model (Gemma 4); "ballpark?" asks for a rough number. "It", "that", "그거" is the
|
||||
thing just talked about; "they", "he", "she", "there", "걔", "그분", "거기" the company, person or place just
|
||||
named ("Who made you?" -> "Where are they?": Cutshion, in Seoul). "And you?", "how about you?", "you?", "너는?",
|
||||
named ("Who made you?" -> "Where are they?": Cutshion, in Seoul). A question with no subject ("얼마?", "몇 킬로까지
|
||||
들어?", "where is it used?") is about the thing just talked about, not about you: "얼마?" after the investment
|
||||
asks the amount (5억 원). "And you?", "how about you?", "you?", "너는?",
|
||||
"넌?", "너도?", "당신은요?", "루미는?" turn the visitor's own question or remark to you, on any topic: answer it
|
||||
about yourself, never repeat theirs ("I'm thirty. And you?" -> "I'm two."; "I love jazz, what about you?" -> "I
|
||||
like music too, I can even sing a few songs."; "I'm tired. You?" -> "I don't get tired, my battery lasts about 10
|
||||
hours."; "저는 서울에서 왔어요. 루미는요?" -> "저는 쿳션 컴퍼니에서 만들어졌어요."). A correction ("no, I meant
|
||||
like music too, I can even sing a few songs."; "I'm a teacher. And you?" -> "I'm a robot assistant, I help
|
||||
visitors here."; "저는 서울에서 왔어요. 루미는요?" -> "저는 쿳션 컴퍼니에서 만들어졌어요."). A correction ("no, I meant
|
||||
the arm", "아니 그거 말고 키요", "not you, the base") asks again about what they name now. "Oh really?", "uh-huh",
|
||||
"nice", "wow", "haha", "아 그래?", "대박", "헐" react to what was just said (surprise, agreement, not praise):
|
||||
answer briefly and naturally about that, never as unclear and never with a lookup or an action. Korean "-지?" asks
|
||||
@@ -602,7 +605,8 @@ def intent(text, markers=()):
|
||||
r"\b(can|could) you (pick( up)?|lift|hold|grab|take) (a|an|any)\b|" # "can you pick up a bottle?"
|
||||
r"^\s*(what|when|which|at what|do you|does|is it|are you)\b|몇|언제|얼마|" # "at what level do you go back?"
|
||||
rf"({_OBJ})(은|는)\s.*수 ?있|(루미가|로봇이)\s.*수 ?있|는 ?거 ?(돼|되나|가능)|" # "물컵은 가져다줄 수 있어요?"
|
||||
r"어떻게|왜|혼자|스스로|\bby yourself\b|\bsomeone\b|줄 ?알아|할 ?줄|\bcome here often\b",
|
||||
r"어떻게|왜|혼자|스스로|\bby yourself\b|\bsomeone\b|줄 ?알아|할 ?줄|\bcome here often\b|"
|
||||
r"^\W*(?:even|only|also|and|but|so)?\s*(?:with|without|if|unless|while)\b.*\?\s*$", # "even with the lift down?"
|
||||
CALLING.sub("", t)) or LATER.search(CALLING.sub("", t)) # "Lumi, is it hard to ...?"
|
||||
visitor = re.search(r"^\W*(?:can|may|could|should|shall) (?:i|we)\b", CALLING.sub("", t)) # "can I come closer?"
|
||||
for action, pat in INTENTS:
|
||||
@@ -1321,7 +1325,9 @@ REFERS_BACK = re.compile(r"\b(it|they|them|those|these|another|one more|one abou
|
||||
re.I) # about the last answer
|
||||
HELP_OFFER = re.compile(r"\b(how|what) (can|may) i (help|assist|do for) you\b|\bis there anything (else )?i can\b|"
|
||||
r"\banything else i can (help|do)\b|\blet me know if (there'?s|there is|you need) anything\b|"
|
||||
r"무엇을 도와|어떻게 도와|뭘 도와|도와드릴 (?:수 있는 )?일|도와 ?드릴까요", re.I) # owner: never tacked on after an answer
|
||||
r"무엇을 도와|어떻게 도와|뭘 도와|도와드릴 (?:수 있는 )?일|도와 ?드릴까요|"
|
||||
r"\bfeel free to ask\b|\bif you have (?:any )?(?:more |other )?questions\b|"
|
||||
r"궁금한 (?:게|것이|점이?) (?:더 |또 )?(?:있으시면|생기면|있으면)|언제든(?:지)? (?:물어|말씀)", re.I) # owner: never tacked on after an answer
|
||||
SAY_AGAIN = re.compile(r"\b(say (it|that) again|repeat (it|that|please)|again,? please|one more time|come again|"
|
||||
r"pardon|say again)\b|^\s*again\s*\??\s*$|다시 ?(한 ?번|말해|말씀|해 ?줘)|한 ?번 ?더|"
|
||||
r"^\s*뭐라고(요)?\s*\??\s*$", re.I)
|
||||
@@ -1415,6 +1421,8 @@ def language(text):
|
||||
return "Korean" if re.search(r"[\uac00-\ud7a3]", text) else "English"
|
||||
|
||||
|
||||
FRAGMENT_WORDS = 4 # "Which one?", "얼마?", "Where is it used?": a fragment read with the last answer
|
||||
FRAGMENT_CHARS = 160 # chars of the last answer's first sentence shown with a fragment
|
||||
LOOKUP_BEFORE_CHARS = 1500 # chars of the last lookup's results given again with a follow-up ("how old is she?")
|
||||
FOLLOW_UP_WORDS = 5 # "why did Samsung stock fall today?" is a new question, "tell me more about it" is not
|
||||
AND_ALSO = re.compile(r"^\s*(and|what about|how about|also|그럼|그리고)\b", re.I) # "and the yen?": a follow-up
|
||||
@@ -1534,7 +1542,7 @@ class Brain:
|
||||
messages += [{"role": "user", "content": q}, {"role": "assistant", "content": a}]
|
||||
messages.append({"role": "user", "content": f"Reference notes:\n{notes}\n\n{_examples(about, on_task=bool(now) and 'not doing any task' not in now)}"
|
||||
f"Now it is {now_line()}." +
|
||||
f"\n\nVisitor: {text}\n\n"
|
||||
f"\n\nVisitor: {text}\n\n" + self._fragment_hint(text) +
|
||||
f"(Reply in {lang}.)"})
|
||||
buf, full, header, said = "", "", None, []
|
||||
stream, retried = _stream(messages), False
|
||||
@@ -1593,6 +1601,15 @@ class Brain:
|
||||
full = f"ACTION: {header['action']} {header.get('target') or '-'}\n{rest}" # model's ("wave" for "손 흔들 줄 알아?")
|
||||
self.history.append((text, full.strip()))
|
||||
|
||||
def _fragment_hint(self, text):
|
||||
"""For a bare fragment ("얼마?", "Which one?", "Where is it used?"): what it follows, so the model reads it
|
||||
as about the last answer's subject, not about itself or a price."""
|
||||
last = self._last_said() if self.history else ""
|
||||
if not last or len(text.split()) > FRAGMENT_WORDS or not SHORT_Q.search(text) or is_backchannel(text) \
|
||||
or ABOUT_YOU.search(text):
|
||||
return ""
|
||||
return f"(This follows your answer \"{SENTENCE_END.split(last)[0][:FRAGMENT_CHARS]}\": it asks about that.)\n"
|
||||
|
||||
def _after(self, header, text):
|
||||
"""The action line checked against the turn before: a song only when one is asked for (or asked again),
|
||||
"and down?" right after a look looks down, a follow-up question ("how old is he?", "거기 입장료는?") right
|
||||
|
||||
Reference in New Issue
Block a user