langchain/docs/snippets/get_started/quickstart/output_parser.mdx
Harrison Chase 33fd6184ba
beef up getting started (#8139)
Co-authored-by: Bagatur <baskaryan@gmail.com>
2023-07-23 19:57:43 -07:00

14 lines
376 B
Plaintext

```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']
```