Project 12: Product Support Assistant
AI Engineer
Builds on these lessons
Current Task
Objective
create_retrieval_chain wires a retriever (finds relevant chunks) and an LLM (answers using them) into one grounded call.
Task: invoke a retrieval chain with a product question and print the response's answer key.
index.py
from langchain.chains import create_retrieval_chain
retrieval_chain = create_retrieval_chain(retriever, question_answer_chain)
response = retrieval_chain.invoke({"input": "What's the battery life on the Pro model?"})
print(response["answer"])
* Hint: Correct characters turn green, incorrect ones turn red.
Live Preview
🖼️
Verify your code to see the preview