From 0fac5aad1f5640bb9d4eff9841cd0dcb884a3579 Mon Sep 17 00:00:00 2001 From: Nate Date: Thu, 7 Nov 2024 15:13:23 -0800 Subject: [PATCH] predicted completions for Edit and Apply --- core/edit/streamDiffLines.ts | 18 ++++++++++-------- extensions/vscode/package-lock.json | 2 +- 2 files changed, 11 insertions(+), 9 deletions(-) diff --git a/core/edit/streamDiffLines.ts b/core/edit/streamDiffLines.ts index dbab5841c..48466d0d3 100644 --- a/core/edit/streamDiffLines.ts +++ b/core/edit/streamDiffLines.ts @@ -8,12 +8,7 @@ import { } from "../autocomplete/streamTransforms/lineStream.js"; import { streamDiff } from "../diff/streamDiff.js"; import { streamLines } from "../diff/util.js"; -import { - ChatMessage, - DiffLine, - ILLM, - LLMFullCompletionOptions, -} from "../index.js"; +import { ChatMessage, DiffLine, ILLM, Prediction } from "../index.js"; import { gptEditPrompt } from "../llm/templates/edit.js"; import { Telemetry } from "../util/posthog.js"; @@ -94,10 +89,17 @@ export async function* streamDiffLines( ); const inept = modelIsInept(llm.model); + const prediction: Prediction = { + type: "content", + content: highlighted, + }; + const completion = typeof prompt === "string" - ? llm.streamComplete(prompt, { raw: true }) - : llm.streamChat(prompt); + ? llm.streamComplete(prompt, { raw: true, prediction }) + : llm.streamChat(prompt, { + prediction, + }); let lines = streamLines(completion); diff --git a/extensions/vscode/package-lock.json b/extensions/vscode/package-lock.json index 3baee50b0..466cd705e 100644 --- a/extensions/vscode/package-lock.json +++ b/extensions/vscode/package-lock.json @@ -12599,4 +12599,4 @@ } } } -} \ No newline at end of file +}