Leanpub Header

Skip to main content

Reliable RAG & LLM Testing Bundle

Build semantic search, test it with pytest, and gate every change in CI: a four-book path to RAG and LLM applications you can trust in production.

Bought separately

$28.97

Minimum price

$5.00

$7.00

You pay

Author earns

$

Also available for 1 book credit with a Reader Membership

These books have a total suggested price of $28.97. Get them now for only $5.00!
About

About

About the Bundle

Reliable RAG & LLM Testing Bundle brings together four practical books that take you from building a retrieval system to proving that it keeps working.

Building a RAG application is easy. Making it reliable is not. A small change to a prompt, a model version, or a knowledge base can quietly make answers worse, and traditional unit tests will not tell you. This bundle gives you the full path: build the retrieval layer, learn the testing tools, automate them in CI, and apply them to real LLM and RAG pipelines.

WHAT'S INSIDE

  1. Semantic Search from Scratch Build a working semantic search engine with pure Python and NumPy, so you understand exactly what your retriever is doing.
  2. Python Testing with pytest A practical guide to writing reliable tests: fixtures, parametrization, mocking, and the habits that keep a test suite useful as a project grows.
  3. GitHub Actions for Python Projects Automate testing, building, and deployment so every change is checked before it reaches users.
  4. Testing LLM & RAG Applications with Python Write unit and integration tests for LLM and RAG pipelines, measure retrieval quality with Precision@k and Recall@k, check whether answers are grounded in their sources, build evaluation datasets, test failure handling, measure latency and cost, catch regressions, and add quality gates to your CI workflow.

WHO THIS BUNDLE IS FOR

  • Python developers building search, RAG, or LLM features
  • Data scientists and AI engineers moving a prototype toward production
  • Backend and DevOps engineers responsible for the reliability of AI-powered services

You do not need to be a machine learning expert. You should be comfortable with Python and basic testing concepts.

WHAT YOU WILL BE ABLE TO DO

  • Build and understand a simple retrieval system
  • Write clear, fast, and maintainable pytest test suites
  • Evaluate retrieval with measurable metrics instead of guesswork
  • Detect when generated answers are not supported by the retrieved context
  • Handle timeouts, retries, and provider failures deliberately
  • Run automated quality gates in GitHub Actions before merging changes

Build semantic search, test it with pytest, and gate every change in CI. A four-book path to RAG and LLM applications you can trust in production.

Learn to build, test, and ship reliable RAG apps: semantic search from scratch, pytest, CI with GitHub Actions, and testing LLM and RAG pipelines in Python.

RAG testing, LLM testing, pytest, Python testing, semantic search, retrieval evaluation, Precision@k, Recall@k, grounding, hallucination detection, evaluation datasets, regression testing, GitHub Actions, CI quality gates, LLM reliability, AI engineering, Python

WHY A BUNDLE

The books are designed to be read in order, and they reinforce each other. The search book shows how retrieval works, the pytest and CI books teach the tools, and the testing book puts everything together for LLM and RAG applications.

Readers who buy the bundle receive all future updates to the books in it.

Books

About the Books

Testing LLM & RAG Applications with Python

Testing LLM & RAG Applications with Python

pytest, Evaluation Datasets & CI Quality Gates

LLM and RAG applications can fail in ways that traditional unit tests do not catch. A retrieval system may return the wrong documents, a context builder may truncate important evidence, and a model may produce a confident answer that is not supported by its sources.

Testing LLM & RAG Applications with Python gives you a practical workflow for testing AI systems from retrieval to final answer. You will build tests with pytest, evaluate retrieval quality, check whether answers are grounded in their sources, create reusable evaluation datasets, and add automated quality gates with GitHub Actions.

You will learn how to:

- Write unit and integration tests for LLM and RAG pipelines using pytest

- Evaluate retrieval quality with metrics such as recall@k and precision@k

- Test whether generated answers are grounded in retrieved sources

- Build reusable evaluation datasets for prompts, retrieval, and end-to-end flows

- Use GitHub Actions to run quality gates before merging changes

- Detect regressions in accuracy, latency, and cost before they reach users

This book is for Python developers, data scientists, and AI engineers building applications that use LLMs, RAG, or semantic search. You do not need to be a machine-learning expert, but you should be comfortable with Python and basic testing concepts.

Python Testing with pytest A Practical Guide to Writing Reliable Tests

Python Testing with pytest A Practical Guide to Writing Reliable Tests

A Practical Guide to Writing Reliable Tests

Book Description

Python Testing with pytest is a practical guide to building reliable Python software through automated testing.

Writing code that works is only the beginning. As projects grow, refactoring, new features, and changing requirements can introduce unexpected regressions. A well-designed test suite provides the safety net developers need to change their code with confidence.

This capsule introduces pytest from the ground up and gradually moves toward the practices used in real-world Python projects.

You will learn how to write clear and focused tests, use assertions effectively, test normal and edge-case behavior, verify exceptions, organize test code, understand pytest output, and build a repeatable testing workflow.

The book also introduces the principles behind Arrange–Act–Assert, reusable testing patterns, parametrization, fixtures, test organization, code coverage, continuous integration, and professional testing practices.

Rather than treating testing as an afterthought, this book presents it as an essential part of software development.

Whether you are a Python developer, a student learning software engineering, or a developer moving from small scripts toward larger applications, this capsule gives you a practical foundation for writing software that is easier to maintain, refactor, and trust.

Learn the tools. Understand the principles. Build with confidence.

Ahmed Adawy Tech Capsules
Practical engineering knowledge, one focused capsule at a time.

GitHub Actions for Python Projects A Practical Guide to CI/CD Automation

GitHub Actions for Python Projects A Practical Guide to CI/CD Automation

Automating Testing, Building & Deployment

GitHub Actions for Python Projects is a practical, developer-focused guide to automating Python project workflows with GitHub Actions. Instead of treating CI/CD as abstract DevOps theory, this technical capsule focuses on the workflow concepts developers actually need when building and maintaining real Python projects. You will work through practical examples covering automated testing, code coverage, documentation builds, artifact generation, and deployment-oriented workflows. The goal is not simply to explain GitHub Actions, but to show how its components fit together into a reliable and maintainable automation workflow. You will learn: 1. How GitHub Actions workflows are structured 2. How to configure Python environments in CI 3. How to install and manage project dependencies 4. How to automate testing with pytest 5. How to generate and use test coverage reports 6. How to build project documentation automatically 7. How to upload and preserve workflow artifacts 8. How to organize jobs and steps effectively 9. How to design a practical workflow execution order 10. How to build reusable CI patterns for real Python projects Whether you are building a small Python project, maintaining an open-source repository, or moving toward a more professional CI/CD workflow, this capsule provides a concise and practical foundation for integrating automation into your development process. The focus throughout the capsule is on implementation, workflow design, and reusable engineering patterns rather than lengthy theoretical discussions. A compact technical guide for developers who want to move from manually running project tasks to building reliable, automated workflows with GitHub Actions.

Semantic Search from Scratch

Semantic Search from Scratch

Build a Working Semantic Search Engine with Pure Python and NumPy

Modern AI systems retrieve information by meaning rather than exact keyword matches. Under the hood, this capability relies on a surprisingly simple foundation: representing text as vectors, measuring similarity, and ranking results.

​In Semantic Search from Scratch, you will build this core mechanism yourself from first principles using only Python and NumPy.

​We deliberately avoid third-party vector databases, machine-learning frameworks, and high-level retrieval libraries. The goal isn't to build a production platform, but to demystify the mathematical mechanics behind semantic retrieval, vector spaces, and Retrieval-Augmented Generation (RAG).

​What You Will Learn & Build:

  • ​Vectors as Representations: Understand how natural language transforms into dense numerical representations.
  • ​Mathematical Similarity: Implement Cosine Similarity from scratch using raw matrix operations.
  • ​Document Indexing: Construct a complete educational vector index to store and query text representations.
  • ​Top-K Retrieval & Ranking: Build a scoring loop that ranks contextually relevant documents for downstream AI prompts.
  • ​RAG Foundations: Connect the dots between vector similarity and modern AI retrieval pipelines.

​Who Is This Capsule For?

​This guide is designed for intermediate Python developers, AI engineers, and curiosity-driven builders who want to peel back the layers of high-level AI libraries and truly understand how semantic search works under the hood.

The Leanpub 60 Day 100% Happiness Guarantee

Within 60 days of purchase you can get a 100% refund on any Leanpub purchase, in two clicks.

See full terms...

Earn $8 on a $10 Purchase, and $16 on a $20 Purchase

We pay 80% royalties on purchases of $7.99 or more, and 80% royalties minus a 50 cent flat fee on purchases between $0.99 and $7.98. You earn $8 on a $10 sale, and $16 on a $20 sale. So, if we sell 5000 non-refunded copies of your book for $20, you'll earn $80,000.

(Yes, some authors have already earned much more than that on Leanpub.)

Learn more about writing on Leanpub

Free Updates. DRM Free.

If you buy a Leanpub book, you get free updates for as long as the author updates the book! Many authors use Leanpub to publish their books in-progress, while they are writing them. All readers get free updates, regardless of when they bought the book or how much they paid (including free).

Most Leanpub books are available in PDF (for computers) and EPUB (for phones, tablets and Kindle). The formats that a book includes are shown at the top right corner of this page.

Finally, Leanpub books don't have any DRM copy-protection nonsense, so you can easily read them on any supported device.

Learn more about Leanpub's ebook formats and where to read them

Write and Publish on Leanpub

You can use Leanpub to easily write, publish and sell in-progress and completed ebooks and online courses!

Leanpub is a powerful platform for serious authors, combining a simple, elegant writing and publishing workflow with a store focused on selling in-progress ebooks.

Leanpub is a magical typewriter for authors: just write in plain text, and to publish your ebook, just click a button. (Or, if you are producing your ebook your own way, you can even upload your own PDF and/or EPUB files and then publish with one click!) It really is that easy.

Learn more about writing on Leanpub