Prompt Engineering for Context-Aware Q&A

you own this product
prerequisites
intermediate Python • basics of LLMs and prompting • basics of Pydantic `BaseModel` • comfort with `await` in Jupyter • Project 2 recommended (standalone retrieval starter provided)
skills learned
system-prompt design for grounded answers • context injection • Pydantic-AI structured outputs and source attribution • confidence and groundedness checks • basic LLM API error handling with OpenRouter / Mistral Small 3.1
1 week · 4-6 hours per week · INTERMEDIATE

pro $24.99 per month

  • access to all Manning books, MEAPs, liveVideos, liveProjects, and audiobooks!
  • choose one free eBook per month to keep
  • exclusive 50% discount on all purchases
  • renews monthly, pause or cancel renewal anytime

lite $19.99 per month

  • access to all Manning books, including MEAPs!

team

5, 10 or 20 seats+ for your team - learn more


Look inside

In this liveProject, you’ll build the generation layer of a document-grounded Q&A system that lets users interrogate the EU AI Act and get back answers with real citations, not hallucinations. Using Pydantic AI with OpenRouter and the free Mistral Small 3.1 model, you’ll craft a system prompt that keeps the LLM strictly on-context, implement smart context injection for top-ranked chunks, and add source attribution so every claim links back to a specific passage.

This project is a part of the series Building an Agentic RAG Application.
This project is designed for learning purposes and is not a complete, production-ready application or solution.

project author

Matteus Tanha
Dr. Matteus Tanha is an AI engineer and architect with over a decade of experience building production machine learning and agentic AI systems. He is co-founder of Alpha Quants, a boutique AI consultancy serving finance and enterprise clients, and has led AI initiatives at organizations including the Financial Times and Zurich Insurance. At the Financial Times, he architected AskFT, a retrieval-augmented research assistant combining semantic search and LLM orchestration to serve over a million monthly users. His work spans hybrid retrieval systems, knowledge graphs, and multi-agent orchestration, with deep expertise in RAG architectures and vector and graph databases. Matteus holds a Ph.D. in Computational Chemistry from Carnegie Mellon University, where his research applied machine learning methods to quantum chemical computation.

prerequisites

This liveProject is for learners who want to build the generation side of a RAG pipeline: turning retrieved context into accurate, citation-supported answers with Pydantic AI and OpenRouter’s free tier.


TOOLS
  • Intermediate Python
  • APIs and configuration
  • Jupyter Notebooks
  • Command line (basics)
TECHNIQUES
  • LLMs and prompting
  • RAG at a high level
  • Structured model output
  • Groundedness

features

Self-paced
You choose the schedule and decide how much time to invest as you build your project.
Project roadmap
Each project is divided into several achievable steps.
Get Help
While within the liveProject platform, get help from fellow participants and even more help with paid sessions with our expert mentors.
Compare with others
For each step, compare your deliverable to the solutions by the author and other participants.
book resources
Get full access to select books for 90 days. Permanent access to excerpts from Manning products are also included, as well as references to other resources.
choose your plan

team

monthly
annual
$49.99
$499.99
only $41.67 per month
  • five seats for your team
  • access to all Manning books, MEAPs, liveVideos, liveProjects, and audiobooks!
  • choose another free product every time you renew
  • choose twelve free products per year
  • exclusive 50% discount on all purchases
  • renews monthly, pause or cancel renewal anytime
  • renews annually, pause or cancel renewal anytime
  • Prompt Engineering for Context-Aware Q&A project for free