mirror of
https://github.com/Mintplex-Labs/langchain-python.git
synced 2026-07-19 13:26:32 -04:00
9 lines
259 B
Python
9 lines
259 B
Python
"""Common utility functions for working with LLM APIs."""
|
|
import re
|
|
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]
|