initial commit
This commit is contained in:
9
venv/Lib/site-packages/langchain_community/llms/utils.py
Normal file
9
venv/Lib/site-packages/langchain_community/llms/utils.py
Normal file
@@ -0,0 +1,9 @@
|
||||
"""Common utility functions for 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, maxsplit=1)[0]
|
||||
Reference in New Issue
Block a user