Project 19: Profile Bio Assistant
AI Engineer
Current Task
Objective
Review day: combine PromptTemplate and StrOutputParser — days 2 and 3 — into one small pipeline.
Task: format a prompt, parse a fake response with StrOutputParser, and print the final string.
index.py
from langchain_core.prompts import PromptTemplate
from langchain_core.output_parsers import StrOutputParser
prompt = PromptTemplate.from_template("Summarize this bio setting: {bio}")
formatted = prompt.format(bio="Backend engineer, 5 years, loves distributed systems.")
parser = StrOutputParser()
class FakeMessage:
content = "Experienced backend engineer specializing in distributed systems."
print(parser.invoke(FakeMessage()))
* Hint: Correct characters turn green, incorrect ones turn red.
Live Preview
🖼️
Verify your code to see the preview