Assistant answers general questions and stays silent for overheard talk ("Ignored." is not said); stt prompt setting sent as the transcription prompt
Docs / docs (push) Successful in 39s
Playwright Tests / test-playwright (1, 2) (push) Successful in 4m26s
Playwright Tests / test-playwright (2, 2) (push) Successful in 2m25s
pre-commit / pre-commit (push) Successful in 3m24s
Test Backend / test-backend (3.12) (push) Successful in 6m3s
Test Backend / test-backend (3.14) (push) Successful in 5m41s
Compose Smoke Test / test-compose (push) Successful in 35s
Playwright Tests / merge-reports (push) Successful in 1m20s
Docs / docs (push) Successful in 39s
Playwright Tests / test-playwright (1, 2) (push) Successful in 4m26s
Playwright Tests / test-playwright (2, 2) (push) Successful in 2m25s
pre-commit / pre-commit (push) Successful in 3m24s
Test Backend / test-backend (3.12) (push) Successful in 6m3s
Test Backend / test-backend (3.14) (push) Successful in 5m41s
Compose Smoke Test / test-compose (push) Successful in 35s
Playwright Tests / merge-reports (push) Successful in 1m20s
This commit is contained in:
@@ -9,7 +9,7 @@ offered. Every other input is read as context ("outside_temperature: 7.5").
|
||||
An answer goes out on ``reply`` a sentence at a time while the model writes
|
||||
it, so a ``tts`` node speaks the first before the last is written. A change is
|
||||
confirmed from the values set ("Kitchen light off."), without asking the model
|
||||
a second time.
|
||||
a second time. Talk the panel overheard, such as a TV, gets no answer.
|
||||
"""
|
||||
|
||||
from __future__ import annotations
|
||||
@@ -47,6 +47,10 @@ LISTENING = "listening"
|
||||
UNAVAILABLE = "The assistant isn't available right now."
|
||||
#: Said when the model ends a turn without a word or a change.
|
||||
CANT = "Sorry, I can't do that."
|
||||
#: The model's whole answer to talk not meant for the panel, which is not said.
|
||||
#: Asked to answer with nothing instead, Gemma writes tokens nobody sees until
|
||||
#: the length limit.
|
||||
IGNORED = "Ignored."
|
||||
|
||||
#: A server that is not there is given up on after a few seconds, while a
|
||||
#: model that has to be loaded first takes about ten.
|
||||
@@ -60,14 +64,18 @@ _SCHEMAS: dict[DType, dict[str, str]] = {
|
||||
DType.STR: {"type": "string"},
|
||||
}
|
||||
|
||||
_SYSTEM = """You are the voice of a home: someone spoke to a panel on the wall, \
|
||||
_SYSTEM = f"""You are the voice of a home: someone spoke to a panel on the wall, \
|
||||
and you answer out loud.
|
||||
|
||||
- To change something, call its tool without a word: the change is confirmed \
|
||||
for you. The tools are all you can change.
|
||||
- If no tool can do what was asked, or you did not understand it, say so in a \
|
||||
few words, such as "Sorry, I can't do that."
|
||||
- Answer questions from the readings below.
|
||||
- To change something in the home, call its tool without a word: the change \
|
||||
is confirmed for you. The tools are all you can change.
|
||||
- If a change was asked for that no tool can make, say so in a few words, such \
|
||||
as "Sorry, I can't do that."
|
||||
- Answer questions about the home from the readings below, and other questions \
|
||||
from what you know.
|
||||
- The panel also hears talk that is not meant for it, such as a TV or people \
|
||||
talking to each other. If the words are neither a request nor a question for \
|
||||
you, answer only "{IGNORED}"
|
||||
- Speak plainly: one or two short sentences, no lists, no markdown, no emoji.
|
||||
"""
|
||||
|
||||
@@ -308,7 +316,8 @@ class AssistantNode(Node):
|
||||
async def say(text: str) -> None:
|
||||
nonlocal said
|
||||
said = True
|
||||
await asyncio.to_thread(self._say, text)
|
||||
if text.rstrip(".") != IGNORED.rstrip("."):
|
||||
await asyncio.to_thread(self._say, text)
|
||||
|
||||
if config is None:
|
||||
await say(UNAVAILABLE)
|
||||
|
||||
Reference in New Issue
Block a user