Source code for langchain_community.llms.utils
"""LLM APIs的常用实用函数。"""
import re
from typing import List
[docs]def enforce_stop_tokens(text: str, stop: List[str]) -> str:
"""一旦出现任何停用词,立即截断文本。"""
return re.split("|".join(stop), text, maxsplit=1)[0]