mirror of
https://github.com/BerriAI/litellm.git
synced 2025-04-26 03:04:13 +00:00
14 lines
No EOL
376 B
Text
14 lines
No EOL
376 B
Text
```python
|
|
from langchain.schema import BaseOutputParser
|
|
|
|
class CommaSeparatedListOutputParser(BaseOutputParser):
|
|
"""Parse the output of an LLM call to a comma-separated list."""
|
|
|
|
|
|
def parse(self, text: str):
|
|
"""Parse the output of an LLM call."""
|
|
return text.strip().split(", ")
|
|
|
|
CommaSeparatedListOutputParser().parse("hi, bye")
|
|
# >> ['hi', 'bye']
|
|
``` |