mirror of
https://github.com/MBombeck/HealthLog.git
synced 2026-11-13 06:32:03 +00:00
fix(ai): keep a cut answer from a model never seen reasoning
A reply that ran into the token ceiling with unlabelled text was read as reasoning the server did not separate whenever the ceiling held room for reasoning, which is every call that carries a level, Off included. A model that does not reason at all (llama3.1) lost its own truncated answer: the call failed as reasoning_only, the briefing never reached its JSON-shape retry, the Coach named the wrong error, the failure counted toward the bench, and the client learned to ask with "none" for an hour. Such text is now reasoning only once the endpoint and model have shown that they reason: a reasoning field or a think tag in an earlier reply, or a lesson that says so (knownReasoner). A sighting on a request that asked to reason speaks only for requests that ask too. Otherwise the text is the answer, cut off, with finishReason "length". A lone closing </think> now splits a reply only where the chat templates put it, at the start of a line, or anywhere once the model is known to reason. An ordinary answer that mentions the tag in a sentence stays whole. Two expectations encoded the old rule and move: the Coach loop case whose first reply is unlabelled template-opened text from a model never seen reasoning, and the Local case that read a never-seen model's cut text as a thought. The streamed think-block splitting moved into local-reasoning.ts. Refs #1276
This commit is contained in:
1 parent
6e4d26c0ce
commit
b90980f2a2
13 files changed
+527
-118
No files matched your search
@@ -1,7 +1,7 @@
|
||||
{
|
||||
"$comment": "Production functions over 200 lines, keyed \"file :: name\", and their length. Maintained by src/__tests__/source-size-ratchet.test.ts.",
|
||||
"count": 351,
|
||||
"total": 113581,
|
||||
"total": 113530,
|
||||
"entries": {
|
||||
"app/achievements/page.tsx :: AchievementsPage": 206,
|
||||
"app/api/admin/backups/upload/route.ts :: apiHandler(arg)": 314,
|
||||
@@ -254,8 +254,8 @@
|
||||
"lib/ai/coach/turn/pipeline.ts :: runTurn": 274,
|
||||
"lib/ai/coach/turn/reply-guards.ts :: guardReply": 331,
|
||||
"lib/ai/codex-client.ts :: parseResponse": 302,
|
||||
"lib/ai/local-client.ts :: generateCompletionStream": 263,
|
||||
"lib/ai/openai-client.ts :: generateCompletion": 276,
|
||||
"lib/ai/local-client.ts :: generateCompletionStream": 222,
|
||||
"lib/ai/openai-client.ts :: generateCompletion": 266,
|
||||
"lib/analytics/bp-in-target-fast-path.ts :: computeFromRollups": 203,
|
||||
"lib/analytics/compliance/display.ts :: calculateCompliance": 212,
|
||||
"lib/analytics/correlations-fast-path.ts :: computeCorrelationHypothesesFastPath": 256,
|
||||
|
||||
Reference in new issue
Block a user