aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorDanilo M. <danix@danix.xyz>2026-09-26 13:44:24 +0200
committerDanilo M. <danix@danix.xyz>2026-09-26 13:44:24 +0200
commite372786e5d3c34133ebe18d7df8e1f9dac8329ca (patch)
treef5426a3dc193c0505e0e19d31fc07adb6864e53d
parentf5948fc5a6ec7ca91c6f454ca119a453a0ecb1a8 (diff)
downloaddesktop-assistant-e372786e5d3c34133ebe18d7df8e1f9dac8329ca.tar.gz
desktop-assistant-e372786e5d3c34133ebe18d7df8e1f9dac8329ca.zip
Stamp the time on each question, ask for digits, add a temperature key
With the clock only in the system prompt, "what time is it?" asked again an hour later copied the old answer from history. The current question now carries the date and time too; history stays unstamped, because stamping every message made the model drop tool arguments (the finance account filter went from 6/6 to 0/6). Gemma garbles numbers it spells out in Italian ("trent settler"), 3 in 10 time answers. The default system prompt asks for digits, which Kokoro reads correctly: 20/20 clean. temperature in config.toml is sent with every request; unset keeps the llama-server preset's, which other clients share. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
-rw-r--r--AGENTS.md18
-rw-r--r--assistant.py13
-rw-r--r--examples/config.toml1
3 files changed, 30 insertions, 2 deletions
diff --git a/AGENTS.md b/AGENTS.md
index 0cd301e..c04754c 100644
--- a/AGENTS.md
+++ b/AGENTS.md
@@ -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"