diff --git a/core/llm/llms/HuggingFaceTGI.ts b/core/llm/llms/HuggingFaceTGI.ts index a7c339fc4..9636dbc63 100644 --- a/core/llm/llms/HuggingFaceTGI.ts +++ b/core/llm/llms/HuggingFaceTGI.ts @@ -37,7 +37,10 @@ class HuggingFaceTGI extends BaseLLM { top_k: options.topK, presence_penalty: options.presencePenalty, frequency_penalty: options.frequencyPenalty, - stop: options.stop?.slice(0, HuggingFaceTGI.MAX_STOP_TOKENS), + stop: options.stop?.slice( + 0, + this.maxStopWords ?? HuggingFaceTGI.MAX_STOP_TOKENS, + ), }; return finalOptions;