Skip to content

LLMCheckerChain

LLMCheckerChain asks an AI model to answer a question and, before handing over the answer, makes it review it: the model writes a first draft, lists the assumptions it is based on, checks whether each one is true and writes the final answer taking that review into account.

It is useful for questions where the model’s first impulse can lead to a mistake and it pays to think twice.

When to use it

  • Answering general knowledge questions where a false assumption easily leads to a wrong answer.
  • Reviewing statements before using them in a text for customers.
  • Getting more careful answers when being right matters more than speed.

Configuration

FieldWhat it does
Input (required)The question the model must answer. You can type it or connect it to the text output of another component.
ConnectionWhat to connect
Model (required)An AI model component, for example OpenAI.

Output

  • Text: the final, reviewed answer. Connect it to a Chat Output or to any text input.
  • Runnable: the component ready to be run by another one. Connect it to Runnable As Tool so an agent can use it as a tool.

Example

Editorial Sauce’s content team wants to check facts before publishing a guide:

  1. Connect a Chat Input to Input and a model to Model.
  2. Connect Text to a Chat Output.
  3. Type in the chat: “What is the longest river on the Iberian Peninsula?”.

The model drafts an answer, reviews the assumptions it made and returns the corrected answer if any of them was false.

Good practices

  • The component asks the model several times for each question, so it takes longer than a normal request. Use it when accuracy is worth the wait.
  • The review is done by the model itself with what it knows: it does not look at your documents or the internet. To answer with your own information, use Retrieval QA History.