diff --git a/core/autocomplete/postprocessing/index.ts b/core/autocomplete/postprocessing/index.ts index bf0284cb29..3504a069dc 100644 --- a/core/autocomplete/postprocessing/index.ts +++ b/core/autocomplete/postprocessing/index.ts @@ -132,6 +132,14 @@ export function postprocessCompletion({ completion = "\n" + completion; } + if ( + (llm.model.includes("gemini") || llm.model.includes("gemma")) && + completion.endsWith("<|file_separator|>") + ) { + // "<|file_separator|>" is 18 characters long + completion = completion.slice(0, -18); + } + // If prefix ends with space and so does completion, then remove the space from completion if (prefix.endsWith(" ") && completion.startsWith(" ")) {