Skip to content

Commit a3a3340

Browse files
committed
fix(voice): the dictation cleanup prompt now asks for the JSON its parser requires
The dictation cleanup prompt ended with "Return only the cleaned transcript", but every reply path decodes a JSON object with a single transcription key. Providers with native structured output (Claude, Codex) never hit the gap, and Muse appends the schema itself, but providers that parse the reply as text (Prime, Droid) get prose back and fail every cleanup with "returned invalid structured output", so the raw transcript is inserted instead. The prompt now ends with "Return only the cleaned transcript as a JSON object with key: transcription", the same embedded ask every other text generation prompt carries (subject/body, title/body, stops). The reply parsers and the native structured output paths are unchanged. Proof: the prompt builder test fails on the old sentence and passes on the new one, and a live before/after through Prime on GLM-5.3, the provider that failed tonight, returned prose before and {"transcription": ...} after. The voice-cleanup eval needs a Codex CLI this machine does not have, so it did not run. Claude Opus 5.5 in Prime Agent.
1 parent 6577c6b commit a3a3340

2 files changed

Lines changed: 7 additions & 1 deletion

File tree

‎apps/server/src/textGeneration/TranscriptionPostProcessing.test.ts‎

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,4 +12,10 @@ describe("buildTranscriptionPostProcessingPrompt", () => {
1212
expect(cued).toContain('Correction cue: "so\\"rry".');
1313
expect(cued.indexOf("Correction cue")).toBeLessThan(cued.indexOf("<transcript>"));
1414
});
15+
16+
it("asks for the JSON object the reply parser requires", () => {
17+
const draft = { text: "Make it 42.", selection: { start: 11, end: 11 } };
18+
const prompt = buildTranscriptionPostProcessingPrompt("Clean.", "sorry 24", draft);
19+
expect(prompt).toContain("JSON object with key: transcription");
20+
});
1521
});

‎apps/server/src/textGeneration/TranscriptionPostProcessing.ts‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ export function buildTranscriptionPostProcessingPrompt(
2929
${transcript}
3030
</transcript>
3131
32-
${placement} Use the composer draft and insertion position to resolve ambiguity and correct likely recognition errors in the transcript. The draft can clarify the topic, references, terminology, and how the new speech fits with nearby text. Prefer an interpretation supported by the draft when the speech plausibly matches it. Do not invent content, change clear speech, or include existing composer text in the result. Return only the cleaned transcript.
32+
${placement} Use the composer draft and insertion position to resolve ambiguity and correct likely recognition errors in the transcript. The draft can clarify the topic, references, terminology, and how the new speech fits with nearby text. Prefer an interpretation supported by the draft when the speech plausibly matches it. Do not invent content, change clear speech, or include existing composer text in the result. Return only the cleaned transcript as a JSON object with key: transcription.
3333
<composer_before>
3434
${draft.text.slice(0, cursor)}
3535
</composer_before>${selectionBlock}

0 commit comments

Comments
 (0)