Project 3: Recipe Instruction Parser
AI Engineer
Builds on these lessons
Current Task
Objective
StrOutputParser normalizes a model response object down to a plain string, the simplest of LangChain's output parsers.
Task: parse a fake AIMessage-like response with StrOutputParser and print the result.
index.py
from langchain_core.output_parsers import StrOutputParser
parser = StrOutputParser()
class FakeMessage:
content = "Preheat the oven to 200C."
print(parser.invoke(FakeMessage()))
* Hint: Correct characters turn green, incorrect ones turn red.
Live Preview
🖼️
Verify your code to see the preview