diff options
| -rw-r--r-- | AGENTS.md | 18 | ||||
| -rw-r--r-- | assistant.py | 13 | ||||
| -rw-r--r-- | examples/config.toml | 1 |
3 files changed, 30 insertions, 2 deletions
@@ -325,6 +325,24 @@ distance, a person, next appointment twice). calendar with a 2025 start date, then recovered by calling `now` (three rounds, 4.0 s). With the date and time in the system prompt every turn: one round, 2.0 s. +- **Stale time from history** (2026-09-26). "Che ore sono?" asked 50 + minutes after the same question got the old time back, no tool call: + the old answer in history won over the system prompt's clock. Measured + on the live model, 6 runs each (time right / account filter set on a + "spent from Mediolanum this month?" after three unrelated turns): + clock in the system prompt only 4/6, 6/6; plus the same stamp + `[Saturday 26 September 2026, 13:27]` on the current question only 6/6, + 6/6 (**chosen**); every history message stamped 6/6, **0/6**, it then + called finance without `account` and said nothing matched. The stamp + is not echoed in answers. +- **Gemma garbles numbers it spells out** ("tredici e trent settler", + "trentusetzen", "duemiladistante"): 3 of 10 time answers at the preset's + temperature 1.0, with or without the stamp. Temperature 0.6 gave 0/10 + but kept spelling. The default system prompt now asks for digits: + 20/20 "Sono le 13:37.", finance filter still 5/6. Kokoro's espeak + reads Italian digits right (13:37, 26 settembre 2026, 6549,67 euro). + English decimals come out split ("six thousand ... forty nine. sixty + seven"): the phonemizer takes the point as a full stop. - **It gets weekdays wrong from dates** ("mercoledi 29" for a Tuesday). `agenda.py` prints the weekday itself; right since. - It searches for general knowledge too (a question about a well-known diff --git a/assistant.py b/assistant.py index 8ccc6ff..bf6049a 100644 --- a/assistant.py +++ b/assistant.py @@ -51,10 +51,12 @@ DEFAULTS = { "system": ("You are a voice assistant. Your replies are spoken aloud, so answer " "briefly in plain sentences: no markdown, no lists, no emoji. " "Reply in the language the user speaks, Italian or English. " + "Write numbers, times and dates in digits, never spelled out. " "Facts about the user's computer, devices, accounts, mail, calendar " "or money come only from a tool: call one, and if none can tell, " "say you do not know. Never guess them."), "tool_rounds": 3, + "temperature": None, # None: the llama-server preset's "whisper": {"model": "/data/voice-models/whisper/ggml-large-v3-turbo-q5_0.bin", "device": 0, "port": 8182}, "kokoro": {"model": "/data/voice-models/kokoro/kokoro-v1.0.onnx", @@ -374,6 +376,8 @@ def ask(messages, calls, tools=None): "chat_template_kwargs": {"enable_thinking": False}} if tools: body["tools"] = tools + if CFG["temperature"] is not None: + body["temperature"] = CFG["temperature"] req = urllib.request.Request(CFG["llm"] + "/chat/completions", json.dumps(body).encode(), {"Content-Type": "application/json"}) with urllib.request.urlopen(req) as r: @@ -542,8 +546,13 @@ def reply(history, q, mine): question = {"role": "user", "content": text} # ponytail: last 20 messages, summarise if long sessions need memory # The model has no clock: without the date it makes one up for tools. - now = time.strftime("It is %A %d %B %Y, %H:%M.") - msgs = [{"role": "system", "content": f"{CFG['system']} {now}"}] + history[-20:] + [question] + # Also stamped on the question itself, which history does not keep: with + # the time only in the system prompt, "what time is it?" asked again an + # hour later copied the old answer from history. Stamping every message + # in history fixed that but lost tool arguments (account filter 0/6). + now = time.strftime("%A %d %B %Y, %H:%M") + msgs = ([{"role": "system", "content": f"{CFG['system']} It is {now}."}] + history[-20:] + + [{"role": "user", "content": f"[{now}] {text}"}]) t, said, voice, announced = time.perf_counter(), [], lang, False def say(s): diff --git a/examples/config.toml b/examples/config.toml index b0d2b49..19e1e8b 100644 --- a/examples/config.toml +++ b/examples/config.toml @@ -7,6 +7,7 @@ # llm = "http://localhost:8181/v1" # llama-server, OpenAI API # system = "You are a voice assistant. ..." # tool_rounds = 3 # tool round trips per question +# temperature = 0.6 # per request; unset = the model preset's # [whisper] # model = "/data/voice-models/whisper/ggml-large-v3-turbo-q5_0.bin" |
