From 6c32821ad46bc10e75a98ae08d1e88e17b9becc0 Mon Sep 17 00:00:00 2001 From: Emerson Gomes Date: Sat, 27 Jul 2024 11:07:29 -0500 Subject: [PATCH] Allow removal of max_output_tokens by setting GEN_AI_MAX_OUTPUT_TOKENS=0 (#1958) Co-authored-by: Emerson Gomes --- backend/danswer/llm/chat_llm.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/backend/danswer/llm/chat_llm.py b/backend/danswer/llm/chat_llm.py index 632e09c51..6dc33df45 100644 --- a/backend/danswer/llm/chat_llm.py +++ b/backend/danswer/llm/chat_llm.py @@ -266,7 +266,7 @@ class DefaultMultiLLM(LLM): stream=stream, # model params temperature=self._temperature, - max_tokens=self._max_output_tokens, + max_tokens=self._max_output_tokens if self._max_output_tokens > 0 else None, timeout=self._timeout, **self._model_kwargs, )