Team Ai
Datasetpublic

codekingpro/portable-devtools

sourceHugging Faceupdated 5mo agoView on Hugging Face
1likes14kdownloads
utils.py10 linesDownload Raw Back to llms
1"""Common utility functions for LLM APIs."""2 3import re4from typing import List5 6 7def enforce_stop_tokens(text: str, stop: List[str]) -> str:8    """Cut off the text as soon as any stop words occur."""9    return re.split("|".join(stop), text, maxsplit=1)[0]10 
codekingpro/portable-devtools · Team Ai