The parser decides which failures you see.
Eight replies a model could give when asked for a JSON answer with citations, run through four LangChain output parsers. The replies are hand-written and representative; no model was called. The parsers are ports of langchain-core 1.7.0, checked against the library.
- Returned without error
- Raised OutputParserException
- Returned, but unusable
- Usable answers
What it adds to the prompt
Show the format instructions
StrOutputParser has no format instructions. The prompt has to ask for JSON in its own words.
Eight replies, one parser
Question: “How long does a refund take?” Passages: refund-window, refund-timing, billing.
| Reply (select to inspect) | Result | What your code receives |
|---|
Usable means an answer string and at least one citation that names a real passage. The parsers do not know that rule; the lab grades every result against it.
Inspect one reply
| Parser | Result | Detail |
|---|
| Every cut of this reply | Raised | Unusable | Usable |
|---|