diff --git a/core/autocomplete/completionProvider.ts b/core/autocomplete/completionProvider.ts index 1cd43bf4f..f4f92ea41 100644 --- a/core/autocomplete/completionProvider.ts +++ b/core/autocomplete/completionProvider.ts @@ -28,6 +28,7 @@ import AutocompleteLruCache from "./cache.js"; import { noFirstCharNewline, onlyWhitespaceAfterEndOfLine, + stopAtStopTokens, } from "./charStream.js"; import { constructAutocompletePrompt, @@ -662,6 +663,7 @@ export class CompletionProvider { lang.endOfLine, fullStop, ); + charGenerator = stopAtStopTokens(charGenerator, stop); charGenerator = this.bracketMatchingService.stopOnUnmatchedClosingBracket( charGenerator, prefix, diff --git a/core/llm/llms/HuggingFaceInferenceAPI.ts b/core/llm/llms/HuggingFaceInferenceAPI.ts index a016a357d..21b607163 100644 --- a/core/llm/llms/HuggingFaceInferenceAPI.ts +++ b/core/llm/llms/HuggingFaceInferenceAPI.ts @@ -1,4 +1,3 @@ -import { stopAtStopTokens } from "../../autocomplete/charStream.js"; import { CompletionOptions, ModelProvider } from "../../index.js"; import { BaseLLM } from "../index.js"; import { streamSse } from "../stream.js"; @@ -50,7 +49,7 @@ class HuggingFaceInferenceAPI extends BaseLLM { } } - for await (const text of stopAtStopTokens(stream(), options.stop ?? [])) { + for await (const text of stream()) { yield text; } }