Spaces:
Running
Running
from typing import List | |
from langchain.schema import BaseOutputParser | |
class CustomStringOutputParser(BaseOutputParser[List[str]]): | |
"""Parse the output of an LLM call to a list.""" | |
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 |