From c6f700b7cbb0ead1d0cb96cb6c87428ff2e2f8ce Mon Sep 17 00:00:00 2001 From: Ayo Ayibiowu Date: Thu, 27 Jun 2024 22:28:59 +0200 Subject: [PATCH] fix(community): allow support for disabling max_tokens args (#21534) This PR fixes an issue with not able to use unlimited/infinity tokens from the respective provider for the LiteLLM provider. This is an issue when working in an agent environment that the token usage can drastically increase beyond the initial value set causing unexpected behavior. --- libs/community/langchain_community/chat_models/litellm.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/libs/community/langchain_community/chat_models/litellm.py b/libs/community/langchain_community/chat_models/litellm.py index 6d338f60db..3788b911ff 100644 --- a/libs/community/langchain_community/chat_models/litellm.py +++ b/libs/community/langchain_community/chat_models/litellm.py @@ -191,7 +191,7 @@ class ChatLiteLLM(BaseChatModel): n: int = 1 """Number of chat completions to generate for each prompt. Note that the API may not return the full n completions if duplicates are generated.""" - max_tokens: int = 256 + max_tokens: Optional[int] = None max_retries: int = 6