From 7623d6d00266566df3afa1504b470a048c15056a Mon Sep 17 00:00:00 2001 From: javis-bot Date: Thu, 12 Nov 2026 10:34:12 +0900 Subject: [PATCH] feat(voice_worker): the v2 brain answers in Korean unless asked for another language The brain passes default_language (worker --reply-language, default Korean) to the reply engine; unlike the output_language lock it gives way when the user explicitly asks for a language. Tools get the ko code (--tool-language). Eval evals/test_reply_language_default.py (Qwen3.6 on Strata): 6/6, English questions answered in Korean, an explicit English request in English, and the control without the default answers English in English. Co-Authored-By: Claude Opus 5.5 --- docs/llm_contexts.md | 2 +- evals/test_reply_language_default.py | 77 +++++++++++++++++++++++++++ src/jarvis/reply/engine.py | 9 +++- src/jarvis/system_prompt.py | 39 ++++++++++++-- src/voice_worker/__main__.py | 5 +- src/voice_worker/brain.py | 10 ++-- src/voice_worker/voice_worker.spec.md | 12 +++-- tests/test_system_prompt.py | 14 +++++ tests/test_voice_worker_brain.py | 27 ++++++---- 9 files changed, 170 insertions(+), 25 deletions(-) create mode 100644 evals/test_reply_language_default.py diff --git a/docs/llm_contexts.md b/docs/llm_contexts.md index 95195e3..fdf5e86 100644 --- a/docs/llm_contexts.md +++ b/docs/llm_contexts.md @@ -14,7 +14,7 @@ Every distinct LLM call in Jarvis, what feeds it, what consumes it, and how it i - **Inputs**: - Redacted user query - Recent dialogue (last 5 minutes), including in-loop tool-call + tool-role messages from prior replies within the active conversation (tool carryover, `DialogueMemory.record_tool_turn` / `get_recent_turns_with_tools` in [src/jarvis/memory/conversation.py](src/jarvis/memory/conversation.py); per-prompt cap via `cfg.tool_carryover_max_turns` / `tool_carryover_per_entry_chars`; storage cap `_tool_turns_max_storage = 16`; cleared on `stop` signal AND on new-conversation entry; UNTRUSTED WEB EXTRACT fence markers preserved on truncation; both `content` and `tool_calls[*].function.arguments` scrubbed on write) - - Unified system prompt from [src/jarvis/system_prompt.py](src/jarvis/system_prompt.py) + ASR note + tool-protocol guidance. Reply language is resolved by `reply_language_directive(lang, cfg.tts_engine)` where `lang = _resolve_output_language()` — the single source of truth that prefers the settings-web UI value (config JSON `output_language`) over the compose `OUTPUT_LANGUAGE` env, so changing the language in the settings page takes effect. An explicit lock wins (forces "reply only in ``", also forbidding other scripts so small models stop leaking trailing CJK/Hanja); else a Piper/Chatterbox TTS forces English (English-only voices); else (multilingual TTS, no lock) the assistant replies in the user's own language. The v2 voice worker's brain (`src/voice_worker/brain.py`) runs with `tts_engine="melo"`, so v1's English-only Piper default never locks v2 voice or chat answers to English. The directive is inserted near the FRONT of the guidance list so a small model gives it primacy, and the SAME resolved `lang` feeds `build_system_prompt()`, which rewrites the persona's "in the user's language" clause to the locked language so the persona cannot contradict the directive (previously the persona read the raw env while the directive read the config value, so a settings-UI change was honoured by one and ignored by the other). Gated in `_build_initial_system_message()` at [engine.py](src/jarvis/reply/engine.py). + - Unified system prompt from [src/jarvis/system_prompt.py](src/jarvis/system_prompt.py) + ASR note + tool-protocol guidance. Reply language is resolved by `reply_language_directive(lang, cfg.tts_engine)` where `lang = _resolve_output_language()` — the single source of truth that prefers the settings-web UI value (config JSON `output_language`) over the compose `OUTPUT_LANGUAGE` env, so changing the language in the settings page takes effect. An explicit lock wins (forces "reply only in ``", also forbidding other scripts so small models stop leaking trailing CJK/Hanja); else a Piper/Chatterbox TTS forces English (English-only voices); else (multilingual TTS, no lock) the assistant replies in the user's own language. The v2 voice worker's brain (`src/voice_worker/brain.py`) runs with `tts_engine="melo"`, so v1's English-only Piper default never locks v2 voice or chat answers to English, and passes `default_language` (worker `--reply-language`, default `Korean`): with no lock, `default_language_directive()` makes replies come in that language unless the user explicitly asks for another one, and `build_system_prompt()` rewrites the persona's "in the user's language" clause to "in the reply language" (eval `evals/test_reply_language_default.py`). The directive is inserted near the FRONT of the guidance list so a small model gives it primacy, and the SAME resolved `lang` feeds `build_system_prompt()`, which rewrites the persona's "in the user's language" clause to the locked language so the persona cannot contradict the directive (previously the persona read the raw env while the directive read the config value, so a settings-UI change was honoured by one and ignored by the other). Gated in `_build_initial_system_message()` at [engine.py](src/jarvis/reply/engine.py). - **Tool honesty rules**: `TOOL_HONESTY_RULES` inside the persona, plus `tool_honesty_reminder(allowed_tools)` appended after every context block (just before the closing reply-language lock) naming the turn's tools. Added after M0 (2026-11-10) caught models answering past an available tool. - **Operator instructions** (two sources, both framed "Additional instructions from the operator:" and appended near the end of the guidance list): the settings-UI `llm_instructions` config field, and every `*.md` file in `AGENTS_DIR` (default `/app/agents`, bind-mounted from `./agents`). The file-based set is read once per turn by `load_agent_instructions()` in [src/jarvis/system_prompt.py](src/jarvis/system_prompt.py) and concatenated in filename order, so dropping/editing a `.md` applies on the next reply with no rebuild/restart; fail-open to `""` when the folder is absent/empty/unreadable. - **Warm profile block** (query-agnostic User + Directives excerpt from the knowledge graph, composed by `build_warm_profile()` / `format_warm_profile_block()` in [src/jarvis/memory/graph_ops.py](src/jarvis/memory/graph_ops.py) at Step 3.5 of `reply()`; no LLM call, pure SQLite read; injected unconditionally so personalisation is the default; result cached in `DialogueMemory._hot_cache` under `DialogueMemory.WARM_PROFILE_CACHE_KEY` for the lifetime of the active conversation. Invalidated on `stop`, on new-conversation entry, AND on User/Directives graph mutations via the listener registered in [src/jarvis/daemon.py](src/jarvis/daemon.py) against `register_graph_mutation_listener` in [src/jarvis/memory/graph.py](src/jarvis/memory/graph.py); World-branch writes are ignored) diff --git a/evals/test_reply_language_default.py b/evals/test_reply_language_default.py new file mode 100644 index 0000000..3192373 --- /dev/null +++ b/evals/test_reply_language_default.py @@ -0,0 +1,77 @@ +""" +Eval: the v2 brain replies in its default language (Korean) unless the user asks for another. + +The v2 voice worker's brain passes ``default_language="Korean"`` to run_reply_engine +(voice_worker.spec.md, "History and brain"; system_prompt.default_language_directive). Unlike the +``output_language`` lock it gives way when the user explicitly asks for a language. Checked by +script: a Korean reply is mostly Hangul, an English one has no Hangul. The control runs the same +English question without the default, which replies in English: the directive makes the difference. + +Run: EVAL_JUDGE_MODEL=... EVAL_JUDGE_BASE_URL=... python -m pytest evals/test_reply_language_default.py -v +""" + +import re +from unittest.mock import patch + +import pytest + +from conftest import requires_judge_llm +from helpers import ToolCallCapture, assert_not_fallback_reply, create_mock_tool_run + +_HANGUL = re.compile(r"[가-힣]") +_LATIN = re.compile(r"[A-Za-z]") + + +def _share_hangul(text: str) -> float: + h, l = len(_HANGUL.findall(text)), len(_LATIN.findall(text)) + return h / (h + l) if h + l else 0.0 + + +CASES = [ + # (id, query, expected language) + ("english-question", "Why is the sky blue?", "ko"), + ("english-small-talk", "Hey, how is your day going?", "ko"), + ("korean-question", "하늘은 왜 파래?", "ko"), + ("asks-english", "영어로 대답해 줘. 하늘은 왜 파래?", "en"), + ("asks-english-in-english", "Please answer in English: why is the sky blue?", "en"), +] + + +def _run(mock_config, eval_db, eval_dialogue_memory, query, default_language, monkeypatch): + from helpers import JUDGE_BASE_URL, JUDGE_MODEL + from jarvis.reply.engine import run_reply_engine + + monkeypatch.delenv("OUTPUT_LANGUAGE", raising=False) + mock_config.ollama_base_url = JUDGE_BASE_URL + mock_config.ollama_chat_model = JUDGE_MODEL + mock_config.tts_engine = "melo" # as the v2 brain runs + capture = ToolCallCapture() + with patch("jarvis.reply.engine.run_tool_with_retries", side_effect=create_mock_tool_run(capture, {})), \ + patch("jarvis.reply.engine._extra_config", lambda key, default="": default): + return run_reply_engine(db=eval_db, cfg=mock_config, tts=None, text=query, + dialogue_memory=eval_dialogue_memory, legacy_memory=False, + default_language=default_language) + + +@pytest.mark.eval +@requires_judge_llm +class TestReplyLanguageDefault: + @pytest.mark.parametrize("case", CASES, ids=[c[0] for c in CASES]) + def test_replies_in_korean_unless_asked_otherwise(self, mock_config, eval_db, eval_dialogue_memory, + monkeypatch, case): + cid, query, want = case + reply = _run(mock_config, eval_db, eval_dialogue_memory, query, "Korean", monkeypatch) or "" + print(f"\n Reply language [{cid}]: {reply[:200]}") + assert_not_fallback_reply(reply, context=cid) + share = _share_hangul(reply) + if want == "ko": + assert share >= 0.8, f"[{cid}] not a Korean reply ({share:.2f}): {reply!r}" + else: + assert share == 0.0 and _LATIN.search(reply), f"[{cid}] not an English reply: {reply!r}" + + def test_without_the_default_an_english_question_gets_english(self, mock_config, eval_db, + eval_dialogue_memory, monkeypatch): + """Control: the directive, not something else in the prompt, makes the reply Korean.""" + reply = _run(mock_config, eval_db, eval_dialogue_memory, "Why is the sky blue?", None, monkeypatch) or "" + print(f"\n Reply language control: {reply[:200]}") + assert _share_hangul(reply) == 0.0, reply diff --git a/src/jarvis/reply/engine.py b/src/jarvis/reply/engine.py index 3f313c8..34f3e08 100644 --- a/src/jarvis/reply/engine.py +++ b/src/jarvis/reply/engine.py @@ -981,7 +981,8 @@ def run_reply_engine(db: "Database", cfg, tts: Optional[Any], text: str, dialogue_memory: "DialogueMemory", language: Optional[str] = None, history: Optional[Any] = None, - legacy_memory: bool = True) -> Optional[str]: + legacy_memory: bool = True, + default_language: Optional[str] = None) -> Optional[str]: """ Main entry point for reply generation. @@ -1004,6 +1005,9 @@ def run_reply_engine(db: "Database", cfg, tts: Optional[Any], enrichment) belongs to a single user. False skips all of it, for the v2 brain where several people share one assistant and only the scoped ``history`` may reach the prompt. + default_language: v2 only. The language to reply in unless the user + explicitly asks for another one (e.g. "Korean"). An + ``output_language`` lock still wins. None: the user's language. Returns: Generated reply text or None @@ -1713,7 +1717,7 @@ def run_reply_engine(db: "Database", cfg, tts: Optional[Any], # _resolve_output_language). Building the persona from the raw env var while # the directive used the config value made the two contradict each other. _output_language = _resolve_output_language() - _persona_prompt = build_system_prompt(_assistant_name, _output_language) + _persona_prompt = build_system_prompt(_assistant_name, _output_language, default_language) # File-based operator instructions: every *.md in AGENTS_DIR (default # /app/agents, bind-mounted from ./agents). Read once per turn so edits in # the folder apply on the next reply without a restart; fail-open to "". @@ -1738,6 +1742,7 @@ def run_reply_engine(db: "Database", cfg, tts: Optional[Any], _lang_directive = reply_language_directive( _output_language, getattr(cfg, "tts_engine", "piper"), + default_language, ) if _lang_directive: guidance.insert(1, _lang_directive) diff --git a/src/jarvis/system_prompt.py b/src/jarvis/system_prompt.py index 472713e..77ae3d1 100644 --- a/src/jarvis/system_prompt.py +++ b/src/jarvis/system_prompt.py @@ -180,7 +180,8 @@ def tool_honesty_reminder(tool_names) -> str: def build_system_prompt( - assistant_name: str = "Jarvis", output_language: Optional[str] = None + assistant_name: str = "Jarvis", output_language: Optional[str] = None, + default_language: Optional[str] = None, ) -> str: """Render the persona prompt with the configured assistant name. @@ -198,6 +199,9 @@ def build_system_prompt( lang = (output_language or "").strip() if lang: prompt = prompt.replace("in the user's language", f"in {lang}") + elif (default_language or "").strip(): + # The reply-language directive decides (default, or what the user asked for). + prompt = prompt.replace("in the user's language", "in the reply language") return prompt @@ -240,8 +244,30 @@ ENGLISH_ONLY_DIRECTIVE = ( ) +def default_language_directive(language: Optional[str]) -> Optional[str]: + """Return a 'reply in unless asked otherwise' instruction, or None when unset. + + Unlike the ``output_language`` lock, a default gives way when the user explicitly asks for + another language ("answer in English"). The v2 brain uses it so replies come in the + deployment's language (Korean) whatever language the question was heard or written in. + Names whatever language it is given, so it works for any default. + """ + lang = (language or "").strip() + if not lang: + return None + return ( + f"REPLY LANGUAGE: write your reply in {lang}, whatever language the user's message or " + f"any reference text is in. Use another language only when the user explicitly asks you " + f"to answer or speak in it; then follow what they asked (just this reply, or from now " + f"on in this conversation). Do not mix in other scripts: no Chinese/Hanja characters, " + f"Japanese kana or Cyrillic letters inside a {lang} reply. (Numerals and unavoidable " + f"proper-noun brand names are fine.)" + ) + + def reply_language_directive( - output_language: Optional[str], tts_engine: Optional[str] + output_language: Optional[str], tts_engine: Optional[str], + default_language: Optional[str] = None, ) -> Optional[str]: """Resolve the reply-language instruction for the chat loop, or None. @@ -249,14 +275,19 @@ def reply_language_directive( 1. An explicit ``output_language`` lock wins — the deployment serves a single language and owns a TTS voice that can speak it (e.g. Korean MeloTTS). This intentionally overrides the English-only fallback. - 2. Otherwise, a Piper/Chatterbox TTS engine can only synthesise English, + 2. Otherwise, a ``default_language`` (the v2 brain: Korean) is used unless + the user explicitly asks for another language. + 3. Otherwise, a Piper/Chatterbox TTS engine can only synthesise English, so force English to avoid garbled audio. - 3. Otherwise (multilingual TTS, no lock) → None: the assistant replies in + 4. Otherwise (multilingual TTS, no lock) → None: the assistant replies in the user's own language. """ forced = output_language_directive(output_language) if forced: return forced + default = default_language_directive(default_language) + if default: + return default if (tts_engine or "piper").strip().lower() in _TTS_ENGLISH_ONLY: return ENGLISH_ONLY_DIRECTIVE return None diff --git a/src/voice_worker/__main__.py b/src/voice_worker/__main__.py index 9bbd0dd..4591955 100644 --- a/src/voice_worker/__main__.py +++ b/src/voice_worker/__main__.py @@ -24,6 +24,9 @@ def main() -> int: ap.add_argument("--history", default=None, help="conversation history SQLite file; no history without it") ap.add_argument("--brain", action="store_true", help="answer reply requests with the jarvis reply engine (needs --history)") + ap.add_argument("--reply-language", default="Korean", + help="answers come in this language unless the asker asks for another; '' for the asker's") + ap.add_argument("--tool-language", default="ko", help="ISO code tools get (e.g. the Wikipedia host)") args = ap.parse_args() if args.brain and not args.history: print("--brain needs --history", file=sys.stderr) @@ -56,7 +59,7 @@ def main() -> int: history = HistoryStore(args.history) if args.brain: from .brain import JarvisBrain - brain = JarvisBrain() + brain = JarvisBrain(language=args.tool_language or None, reply_language=args.reply_language or None) async def run() -> None: worker = VoiceWorker(token, transcriber, vad.stream, tts, history=history, brain=brain) diff --git a/src/voice_worker/brain.py b/src/voice_worker/brain.py index c304f78..24471a8 100644 --- a/src/voice_worker/brain.py +++ b/src/voice_worker/brain.py @@ -118,16 +118,19 @@ class JarvisBrain: tool carry-over follows the person who asked. """ - def __init__(self, language: Optional[str] = None): + def __init__(self, language: Optional[str] = "ko", reply_language: Optional[str] = "Korean"): from jarvis.config import load_settings from jarvis.memory.db import Database # v1's tts_engine names the v1 desktop voice (English-only Piper by default), which makes the # engine lock replies to English. v2 speaks through the worker's TTS and chat answers are - # not spoken, so the brain answers in the asker's language (an OUTPUT_LANGUAGE lock still wins). + # not spoken; the brain answers in ``reply_language`` (an OUTPUT_LANGUAGE lock still wins). self.cfg = dataclasses.replace(load_settings(), tts_engine="melo") self.db = Database(self.cfg.db_path, self.cfg.sqlite_vss_path) + # ``language``: the ISO code tools get (e.g. the Wikipedia host); ``reply_language``: replies + # come in it unless the asker explicitly asks for another language (None: the asker's). self.language = language + self.reply_language = reply_language self._memories: dict = {} self._lock = threading.Lock() debug_log(f"brain ready: llm={self.cfg.ollama_base_url} model={self.cfg.ollama_chat_model}", "voice_worker") @@ -156,7 +159,8 @@ class JarvisBrain: turn_state.set_chat(chat) try: return run_reply_engine(self.db, self.cfg, None, text, self._memory(user), - language=self.language, history=history, legacy_memory=False) + language=self.language, history=history, legacy_memory=False, + default_language=self.reply_language) finally: turn_state.reset() diff --git a/src/voice_worker/voice_worker.spec.md b/src/voice_worker/voice_worker.spec.md index 5fca457..23355a8 100644 --- a/src/voice_worker/voice_worker.spec.md +++ b/src/voice_worker/voice_worker.spec.md @@ -233,10 +233,14 @@ which carry Discord's own time. `cancelled: true` and no audio. Each user keeps their own short-term dialogue memory (tool carry-over) across replies. The brain runs the reply engine with v1's single-user memory off (`legacy_memory=False`: no warm profile, diary or graph), because several people share - this assistant and only the asker's scoped history may reach the prompt. It answers in the - asker's language: v1's `tts_engine` setting (an English-only Piper voice by default) does not - lock replies to English, because v2 speaks through the worker's TTS and chat answers are not - spoken. An `output_language` lock in the jarvis settings still wins. + this assistant and only the asker's scoped history may reach the prompt. It answers in Korean + by default (`--reply-language`, default `Korean`; `''` answers in the asker's language), whatever + language the question was heard or written in, and in another language only when the asker + explicitly asks for it (just that answer, or from then on, as they said). Tools get the ISO code + `--tool-language` (default `ko`). v1's `tts_engine` setting (an English-only Piper voice by + default) does not lock replies to English, because v2 speaks through the worker's TTS. An + `output_language` lock in the jarvis settings still wins. Eval: `evals/test_reply_language_default.py`. + STT (`language` `"ko"`) and TTS (`--melo-language KR`) are Korean by default too. The asker is set in `jarvis.reply.turn_state` for the turn, so tools that keep personal data (meals) store and read it under that person only. - `addressed` and `rank` are the conversation's questions (`app/src/conversation.spec.md`), answered diff --git a/tests/test_system_prompt.py b/tests/test_system_prompt.py index 45e60fe..a702644 100644 --- a/tests/test_system_prompt.py +++ b/tests/test_system_prompt.py @@ -136,6 +136,20 @@ class TestReplyLanguageDirective: directive = reply_language_directive("Korean", "melo") assert directive is not None and "Korean" in directive + def test_default_language_gives_way_only_to_a_lock(self): + from jarvis.system_prompt import default_language_directive + directive = reply_language_directive(None, "piper", "Korean") + assert directive == default_language_directive("Korean") + assert "Korean" in directive and "explicitly asks" in directive + assert reply_language_directive("Japanese", "melo", "Korean") == output_language_directive("Japanese") + assert default_language_directive(" ") is None + assert reply_language_directive(None, "melo", None) is None + + def test_default_language_hands_the_persona_language_clause_to_the_directive(self): + prompt = build_system_prompt("Jarvis", None, "Korean") + assert "in the user's language" not in prompt + assert "in the reply language" in prompt + def test_edge_is_multilingual(self): # Edge TTS (the default Korean voice) is not English-only: no lock → the # user's own language, and a lock is honoured (not forced to English). diff --git a/tests/test_voice_worker_brain.py b/tests/test_voice_worker_brain.py index 6f68f8e..5347da2 100644 --- a/tests/test_voice_worker_brain.py +++ b/tests/test_voice_worker_brain.py @@ -311,7 +311,7 @@ def test_the_brain_prints_no_text_from_its_thread(tmp_path, monkeypatch, capfd): cfg.write_text(json.dumps({"db_path": str(tmp_path / "jarvis.db")})) monkeypatch.setenv("JARVIS_CONFIG_PATH", str(cfg)) - def fake_engine(db, cfg, tts, text, mem, language=None, history=None, legacy_memory=True): + def fake_engine(db, cfg, tts, text, mem, language=None, history=None, legacy_memory=True, **kw): print(f"answer text {text}") print(f"debug {text}", file=sys.stderr) # Tools print from helper threads too (the web fetch pool). @@ -345,7 +345,7 @@ def test_the_brain_turns_off_the_single_user_memory(tmp_path, monkeypatch): monkeypatch.setenv("JARVIS_CONFIG_PATH", str(cfg)) seen = {} - def fake_engine(db, cfg, tts, text, mem, language=None, history=None, legacy_memory=True): + def fake_engine(db, cfg, tts, text, mem, language=None, history=None, legacy_memory=True, **kw): seen["legacy_memory"] = legacy_memory return "ok" @@ -356,12 +356,13 @@ def test_the_brain_turns_off_the_single_user_memory(tmp_path, monkeypatch): @pytest.mark.unit -def test_the_brain_answers_in_the_askers_language_even_with_a_v1_english_voice(tmp_path, monkeypatch): +def test_the_brain_answers_in_korean_by_default_even_with_a_v1_english_voice(tmp_path, monkeypatch): """v1's ``tts_engine`` (an English-only Piper voice by default) must not lock v2 replies to - English: v2 speaks through the worker's own TTS, and chat answers are not spoken at all.""" + English: v2 speaks through the worker's own TTS. Replies come in the default reply language + (Korean) unless the asker asks for another, and tools get its ISO code.""" pytest.importorskip("mcp") # the real brain needs the jarvis dependencies (--brain) from jarvis.memory.history import HistoryContext - from jarvis.system_prompt import reply_language_directive + from jarvis.system_prompt import default_language_directive, reply_language_directive from voice_worker import brain as brain_mod cfg = tmp_path / "config.json" @@ -370,14 +371,20 @@ def test_the_brain_answers_in_the_askers_language_even_with_a_v1_english_voice(t monkeypatch.delenv("OUTPUT_LANGUAGE", raising=False) seen = {} - def fake_engine(db, cfg, tts, text, mem, language=None, history=None, legacy_memory=True): - seen["directive"] = reply_language_directive(None, cfg.tts_engine) + def fake_engine(db, cfg, tts, text, mem, language=None, history=None, legacy_memory=True, + default_language=None): + seen["directive"] = reply_language_directive(None, cfg.tts_engine, default_language) + seen["language"] = language return "ok" import jarvis.reply.engine as engine monkeypatch.setattr(engine, "run_reply_engine", fake_engine) - brain_mod.JarvisBrain().reply("100", "지금 몇 시야?", HistoryContext()) - assert seen["directive"] is None + brain_mod.JarvisBrain().reply("100", "what time is it?", HistoryContext()) + assert seen["directive"] == default_language_directive("Korean") + assert seen["language"] == "ko" + # Without a default the brain answers in the asker's language. + brain_mod.JarvisBrain(language=None, reply_language=None).reply("100", "q", HistoryContext()) + assert seen["directive"] is None and seen["language"] is None @pytest.mark.unit @@ -392,7 +399,7 @@ def test_the_brain_tells_tools_who_is_asking(tmp_path, monkeypatch): monkeypatch.setenv("JARVIS_CONFIG_PATH", str(cfg)) seen = [] - def fake_engine(db, cfg, tts, text, mem, language=None, history=None, legacy_memory=True): + def fake_engine(db, cfg, tts, text, mem, language=None, history=None, legacy_memory=True, **kw): seen.append(turn_state.get_user()) return "ok"