Coach: Regeln als cachebarer System-Prompt, Schema-erzwungenes JSON, halbierte Payload
Der Prompt ist gesplittet: die Regeln (byteidentisch pro Task) fahren als System-Message,
nur die Payload wechselt — ein llama.cpp/Ollama-Endpunkt trifft damit seinen KV-Prefix-Cache,
Anthropic cached den Block explizit (cache_control ephemeral). Die Payload selbst: kompaktes
JSON statt Einrueckung, volle Saetze nur fuer die letzten fuenf Sessions (aeltere als eine
Zeile pro Uebung; aggregates zaehlt Stalls ohnehin uebers ganze Fenster), Bibliothek als
{id,n,bp} und fuer Reviews auf 100 gedeckelt. ~14.600 Tokens pro Review vorher, ~5.900 jetzt
plus gecachter Prefix. Dazu: response_format json_schema (Fallback json_object, dann ohne,
wie gehabt), temperature 0 nur auf dem kompatiblen Endpunkt, Gemini/Anthropic bekommen die
Regeln ebenfalls als System-Teil. api 142, frontend 799, mcp 36 gruen.
This commit is contained in:
1 parent
20042356d1
commit
5116f8770d
17 files changed
+327
-34
No files matched your search
@@ -70,7 +70,7 @@ describe('the Coach on a phone with its own key', () => {
|
||||
expect(wire.calls[0].url).toBe('https://api.openai.com/v1/chat/completions')
|
||||
expect(wire.calls[0].init.headers.authorization).toBe('Bearer sk-test-1')
|
||||
expect(wire.calls[0].body.model).toBe('gpt-t')
|
||||
expect(wire.calls[0].body.messages[1].content).toContain('"userNote": "shoulder"')
|
||||
expect(wire.calls[0].body.messages[1].content).toContain('"userNote":"shoulder"')
|
||||
// …and the proposal applies with the ordinary engine.
|
||||
const marked = markStale(s.pending, S)
|
||||
expect(marked.changes[0].status).not.toBe('stale')
|
||||
@@ -120,7 +120,7 @@ describe('the Coach on a phone with its own key', () => {
|
||||
const first = (await loadCoachDevice()).handle
|
||||
expect(first).toHaveLength(16)
|
||||
const payload = wire.calls[0].body.messages[1].content
|
||||
expect(payload).toContain(`"profile": "${first}"`)
|
||||
expect(payload).toContain(`"profile":"${first}"`)
|
||||
expect(payload).not.toContain('Duarte')
|
||||
local._resetLocal(); await saveCoachDevice({ pending: null })
|
||||
await local.localReview(state()); await settle()
|
||||
@@ -163,7 +163,7 @@ describe('the Coach on a phone with its own key', () => {
|
||||
const s = await settle()
|
||||
expect(s.pending.kind).toBe('create')
|
||||
expect(s.pending.bundle.routines).toHaveLength(2)
|
||||
expect(wire.calls[0].body.messages[1].content).toContain('"daysPerWeek": 3')
|
||||
expect(wire.calls[0].body.messages[1].content).toContain('"daysPerWeek":3')
|
||||
|
||||
await local.localRefine(S, 'no lunges')
|
||||
const r = await settle()
|
||||
|
||||
Reference in new issue
Block a user