From c9324542fc4fa2aec9ccbab877e4f48c1d21d1a1 Mon Sep 17 00:00:00 2001 From: Nate Date: Sun, 29 Sep 2024 13:52:42 -0700 Subject: [PATCH] acknowledge user-provided maxStopWords in HuggingFaceTGI.ts --- core/llm/llms/HuggingFaceTGI.ts | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) 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;