03. Relevance Checker module added

Add relevance check module

step

  1. Perform Naive RAG

  2. (This tutorial) Added relevance check for documents in the answer

Reference

  • It's an extension from the previous tutorial, so there may be overlapping parts. Please refer to the previous tutorial for insufficient explanation.

Preferences

Basic PDF-based Retrieval Chain creation

Here, we create a Retrieval Chain based on PDF documents. Retrieval Chain with the simplest structure.

However, LangGraph creates Retirever and Chain separately. Only then can you do detailed processing for each node.

Reference

  • As covered in the previous tutorial, we omit the detailed description.

State definition

State : Defines the state of sharing between nodes and nodes in Graph.

Generally TypedDict Use format. This time, we add the results of the relevance check to the state.

Node definition

  • Nodes : Nodes that handle each step. Usually implemented as a Python function. Input and output are state values.

Reference

  • State Updated after performing a defined logic with input State Returns.

Edges

  • Edges : Currently State Run next based on Node Python function to determine.

General edges, conditional edges, and more.

Visualize compa-like graphs.

Graph execution

  • config Parameters convey the necessary setting information when running the graph.

  • recursion_limit : Set the maximum number of recurses when running the graph.

  • inputs : Pass the required input information when running the graph.

However, the search results relevance_check If it fails, a situation arises where the same Query repeatedly enters the retrieve node again.

Repeatedly, when the same Query enters the retrieve node again, it leads to the same search results, which eventually leads to a recursive state.

The maximum number of recursiones, to prevent Mock recursive status recursion_limit ). And for error processing GraphRecursionError Process.

The next tutorial will cover how to solve this recursive problem.

Last updated