diff --git a/libs/langchain/langchain/llms/utils.py b/libs/langchain/langchain/llms/utils.py index 32fdb52eb3..b69c759eea 100644 --- a/libs/langchain/langchain/llms/utils.py +++ b/libs/langchain/langchain/llms/utils.py @@ -5,4 +5,4 @@ from typing import List def enforce_stop_tokens(text: str, stop: List[str]) -> str: """Cut off the text as soon as any stop words occur.""" - return re.split("|".join(stop), text)[0] + return re.split("|".join(stop), text, maxsplit=1)[0]