0Pricing
LLM Apps in Production (RAG + Vector DB + Caching) · Lekcja

Testowanie i ocena aplikacji RAG

Zbuduj zaufanie do swojej pierwszej aplikacji RAG, tworząc zbiór testowy i mierząc jakość retrievalu oraz odpowiedzi za pomocą praktycznych metryk przed wdrożeniem.

Testowanie i ocena aplikacji RAG to bezpłatna lekcja LLM Apps in Production (RAG + Vector DB + Caching) na CoddyKit. To lekcja 4 z 4. Możesz przeczytać całą lekcję poniżej za darmo — a potem ćwiczyć ją interaktywnie w przeglądarce z wbudowanym edytorem kodu i tutorem AI dostępnym 24/7. To część ścieżki edukacyjnej LLM Apps in Production (RAG + Vector DB + Caching), a Twój postęp synchronizuje się między webem a aplikacją CoddyKit. Kurs LLM Apps in Production (RAG + Vector DB + Caching) zawiera 4 lekcji w sumie.

Części tej lekcji nie zostały jeszcze przetłumaczone i są wyświetlane po angielsku.

Why Evaluate RAG

A RAG app can look fine on a few queries and fail badly on others. Without measurement you cannot tell if a change helped or hurt.

Evaluation gives you a repeatable score to guide improvements.

Two Things to Measure

RAG quality has two parts:

  • Retrieval: did we fetch the right documents?
  • Generation: did the answer use them correctly?

A bad answer can come from either, so measure both.

Building a Test Set

Create a small set of questions with known correct answers and the documents that contain them. Even 20 to 50 examples are enough to start.

testset = [
    {'q': 'What is the refund window?',
     'answer': '30 days',
     'source': 'policy.md'}
]

Retrieval Metric: Hit Rate

Hit rate (or recall@k) checks whether the correct source appears in the top-k retrieved chunks. High hit rate means retrieval is doing its job.

def hit(retrieved, expected_source):
    return any(d.metadata['source'] == expected_source
               for d in retrieved)

Faithfulness

Faithfulness asks: is the answer supported by the retrieved context, or did the model make things up? An LLM judge can score this automatically.

Answer Relevance

Answer relevance measures whether the response actually addresses the question, regardless of sources. A faithful answer can still be off-topic.

LLM as a Judge

You can use a strong model to grade outputs against the expected answer, returning a pass or score with a reason.

judge_prompt = (
    'Question: {q}\nExpected: {gold}\n'
    'Got: {pred}\nIs it correct? Answer yes or no.'
)

Running the Evaluation

Loop over the test set, run your pipeline, and aggregate scores into a single report you can compare across versions.

scores = []
for case in testset:
    pred = rag.invoke(case['q'])
    scores.append(grade(case, pred))
print(sum(scores) / len(scores))

Comparing Configurations

Change one variable — chunk size, k, prompt, model — rerun the same test set, and compare scores. This turns guesswork into evidence-based tuning.

Watching for Regressions

Keep the test suite in CI. When a change drops a metric, you catch the regression before users do. Treat evaluation like unit tests for AI quality.

Improving From Results

Use failures to guide fixes:

  • Low hit rate? Adjust chunking or retrieval
  • Low faithfulness? Strengthen grounding instructions
  • Low relevance? Improve the prompt

Quick Check

Test your evaluation knowledge.

Recap

You learned to evaluate your RAG app:

  • Measure both retrieval and generation
  • Build a small test set with known answers
  • Use hit rate, faithfulness, and answer relevance
  • Let an LLM judge grade outputs
  • Compare configs and guard against regressions in CI

Evaluation turns RAG improvement into a measurable, repeatable process.

Często zadawane pytania

Czy lekcja „Testowanie i ocena aplikacji RAG” jest bezpłatna?

Tak — pełny tekst „Testowanie i ocena aplikacji RAG” jest dostępny za darmo tutaj w sieci. Aby ćwiczyć ją interaktywnie (wbudowany edytor kodu i tutor AI dostępny 24/7) i odblokować resztę kursu LLM Apps in Production (RAG + Vector DB + Caching), przejdź na CoddyKit PRO. Kurs LLM Apps in Production (RAG + Vector DB + Caching) zawiera 4 lekcji w sumie.

Co nauczysz się w „Testowanie i ocena aplikacji RAG”?

Zbuduj zaufanie do swojej pierwszej aplikacji RAG, tworząc zbiór testowy i mierząc jakość retrievalu oraz odpowiedzi za pomocą praktycznych metryk przed wdrożeniem. Ćwiczysz LLM Apps in Production (RAG + Vector DB + Caching) z praktycznym kodem, który uruchamiasz bezpośrednio w przeglądarce, a tutor AI dostępny 24/7 odpowiada na Twoje pytania podczas pracy nad lekcją.

Czy potrzebuję doświadczenia, aby zacząć LLM Apps in Production (RAG + Vector DB + Caching)?

Nie wymagamy żadnego doświadczenia. LLM Apps in Production (RAG + Vector DB + Caching) w CoddyKit jest strukturyzowany dla początkujących i zaawansowanych użytkowników, więc możesz zacząć tutaj lub od początku i uczyć się w swoim tempie. To lekcja 4 z 4.

Ile czasu zajmuje lekcja „Testowanie i ocena aplikacji RAG”?

Większość lekcji CoddyKit trwa około 5–10 minut. Każda lekcja to mały, interaktywny krok, dzięki czemu robisz systematyczne postępy i zawsze wracasz dokładnie do tego samego miejsca — na webie i w aplikacji.

Czy mogę pisać i uruchamiać kod w tej lekcji LLM Apps in Production (RAG + Vector DB + Caching)?

Tak. Każda lekcja LLM Apps in Production (RAG + Vector DB + Caching) zawiera wbudowany edytor kodu, więc piszesz i uruchamiasz prawdziwy kod bezpośrednio w przeglądarce i od razu otrzymujesz sprzężenie zwrotne od AI — bez konfiguracji na komputerze.

Wszystkie lekcje w tym kursie

  1. Wybór dostawcy LLM
  2. Podstawy wczytywania danych i dzielenia tekstu na fragmenty
  3. Budowa prostego potoku RAG
  4. Testowanie i ocena aplikacji RAG
← Powrót do LLM Apps in Production (RAG + Vector DB + Caching)