Spaces:
Sleeping
Sleeping
File size: 495 Bytes
5832f57 be43fc0 5832f57 |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 |
from typing import List
from langchain.schema import BaseOutputParser
class CustomStringOutputParser(BaseOutputParser[List[str]]):
"""Parse the output of an LLM call to a list."""
@property
def _type(self) -> str:
return "str"
def parse(self, text: str) -> str:
"""Parse the output of an LLM call."""
text = text.split("texter:")[0]
text = text.split("helper")[0]
text = text.rstrip("\n")
text = text.strip()
return text |