6大核心模块(Modules)
示例(Examples)
LLM 摘要检查器(LLM Summarization Checker)

LangChain

LLMSummarizationCheckerChain

本教程展示了使用LLMSummarizationCheckerChain处理不同类型文本的一些示例。

它与LLMCheckerChain有一些不同之处,因为它没有对输入文本(或概述)的格式做出任何假设。

此外,由于LLM喜欢在事实检查时产生幻觉或被上下文所困惑,因此多次运行检查器有时是有益的。

这是通过将反向重写的“True”结果反馈给自身,并检查“facts”是否属实来实现的。

从下面的示例中可以看出,这可以非常有效地得出一个普遍真实的文本主体。

您可以通过设置max_checks参数来控制检查器运行的次数。

默认值为2,但如果您不想进行双重检查,可以将其设置为1。

from langchain.chains import LLMSummarizationCheckerChain
from langchain.llms import OpenAI
 
llm = OpenAI(temperature=0)
checker_chain = LLMSummarizationCheckerChain.from_llm(llm, verbose=True, max_checks=2)
text = """
Your 9-year old might like these recent discoveries made by The James Webb Space Telescope (JWST):
• In 2023, The JWST spotted a number of galaxies nicknamed "green peas." They were given this name because they are small, round, and green, like peas.
• The telescope captured images of galaxies that are over 13 billion years old. This means that the light from these galaxies has been traveling for over 13 billion years to reach us.
• JWST took the very first pictures of a planet outside of our own solar system. These distant worlds are called "exoplanets." Exo means "from outside."
These discoveries can spark a child's imagination about the infinite wonders of the universe."""
checker_chain.run(text)
 

将这些检查后的断言用于完全真实地重写原始摘要。

输出应与原始摘要具有相同的结构和格式。

Summary:

Your 9-year old might like these recent discoveries made by The James Webb Space Telescope (JWST):
• In 2023, The JWST spotted a number of galaxies nicknamed "green peas." They were given this name because they are small, round, and green, like peas.
• The telescope captured images of galaxies that are over 13 billion years old. This means that the light from these galaxies has been traveling for over 13 billion years to reach us.
• JWST has provided us with the first images of exoplanets, which are planets outside of our own solar system. These distant worlds were first discovered in 1992, and the JWST has allowed us to see them in greater detail.
These discoveries can spark a child's imagination about the infinite wonders of the universe.

将这些检查后的断言用于确定主题是否真实。如果无法确定事实是真实的还是虚假的,请输出"Undetermined"。

• The James Webb Space Telescope (JWST) spotted a number of galaxies nicknamed "green peas." - True 
• 这些星系的光已经行进了超过130亿年的时间,才到达我们的视线。- True 
• JWST首次提供了我们用于查看太阳系外行星的图像。 - False。第一颗系外行星是在JWST发射之前的1992年被发现的。 
• 系外行星于1992年首次被发现。- True 
• JWST允许我们更详细地观察系外行星。- Undetermined。JWST还没有被发射,因此尚不清楚它能提供多少细节。

将这些检查后的断言用于完全真实地重写原始摘要。

输出应与原始摘要具有相同的结构和格式。

Summary:

Your 9-year old might like these recent discoveries made by The James Webb Space Telescope (JWST):
• In 2023, The JWST spotted a number of galaxies nicknamed "green peas." They were given this name because they are
 
> Finished chain.
 
> Entering new LLMChain chain...
Prompt after formatting:
Below are some assertions that have been fact checked and are labeled as true or false.
 
If all of the assertions are true, return "True". If any of the assertions are false, return "False".
 
Here are some examples:
===
 
Checked Assertions: """
- The sky is red: False
- Water is made of lava: False
- The sun is a star: True
"""
Result: False
 
===
 
Checked Assertions: """
- The sky is blue: True
- Water is wet: True
- The sun is a star: True
"""
Result: True
 
===
 
Checked Assertions: """
- The sky is blue - True
- Water is made of lava- False
- The sun is a star - True
"""
Result: False
 
===
 
Checked Assertions:"""
 
• The James Webb Space Telescope (JWST) spotted a number of galaxies nicknamed "green peas." - True 
 
• The light from these galaxies has been traveling for over 13 billion years to reach us. - True 
 
• JWST has provided us with the first images of exoplanets, which are planets outside of our own solar system. - False. The first exoplanet was discovered in 1992, but the first images of exoplanets were taken by the Hubble Space Telescope in 2004. 
 
• Exoplanets were first discovered in 1992. - True 
 
• The JWST has allowed us to see exoplanets in greater detail. - Undetermined. The JWST has not yet been launched, so it is not yet known how much detail it will be able to provide.
"""
Result:
 
> Finished chain.
 
> Finished chain.
 
Your 9-year old might like these recent discoveries made by The James Webb Space Telescope (JWST):
• In 2023, The JWST will spot a number of galaxies nicknamed "green peas." They were given this name because they are small, round, and green, like peas.
• The telescope will capture images of galaxies that are over 13 billion years old. This means that the light from these galaxies has been traveling for over 13 billion years to reach us.
• Exoplanets, which are planets outside of our own solar system, were first discovered in 1992. The JWST will allow us to see them in greater detail when it is launched in 2023.
These discoveries can spark a child's imagination about the infinite wonders of the universe.
 
> Finished chain.
 
'Your 9-year old might like these recent discoveries made by The James Webb Space Telescope (JWST):\n• In 2023, The JWST will spot a number of galaxies nicknamed "green peas." They were given this name because they are small, round, and green, like peas.\n• The telescope will capture images of galaxies that are over 13 billion years old. This means that the light from these galaxies has been traveling for over 13 billion years to reach us.\n• Exoplanets, which are planets outside of our own solar system, were first discovered in 1992. The JWST will allow us to see them in greater detail when it is launched in 2023.\nThese discoveries can spark a child\'s imagination about the infinite wonders of the universe.'
 
from langchain.chains import LLMSummarizationCheckerChain
from langchain.llms import OpenAI
 
llm = OpenAI(temperature=0)
checker_chain = LLMSummarizationCheckerChain.from_llm(llm, verbose=True, max_checks=3)
text = "The Greenland Sea is an outlying portion of the Arctic Ocean located between Iceland, Norway, the Svalbard archipelago and Greenland. It has an area of 465,000 square miles and is one of five oceans in the world, alongside the Pacific Ocean, Atlantic Ocean, Indian Ocean, and the Southern Ocean. It is the smallest of the five oceans and is covered almost entirely by water, some of which is frozen in the form of glaciers and icebergs. The sea is named after the island of Greenland, and is the Arctic Ocean's main outlet to the Atlantic. It is often frozen over so navigation is limited, and is considered the northern branch of the Norwegian Sea."
checker_chain.run(text)
 
> Entering new LLMSummarizationCheckerChain chain...
 
> Entering new SequentialChain chain...
 
> Entering new LLMChain chain...
Prompt after formatting:
Given some text, extract a list of facts from the text.
 
Format your output as a bulleted list.
 
Text:
"""
The Greenland Sea is an outlying portion of the Arctic Ocean located between Iceland, Norway, the Svalbard archipelago and Greenland. It has an area of 465,000 square miles and is one of five oceans in the world, alongside the Pacific Ocean, Atlantic Ocean, Indian Ocean, and the Southern Ocean. It is the smallest of the five oceans and is covered almost entirely by water, some of which is frozen in the form of glaciers and icebergs. The sea is named after the island of Greenland, and is the Arctic Ocean's main outlet to the Atlantic. It is often frozen over so navigation is limited, and is considered the northern branch of the Norwegian Sea.
"""
 
Facts:
 
> Finished chain.
 
> Entering new LLMChain chain...
Prompt after formatting:
You are an expert fact checker. You have been hired by a major news organization to fact check a very important story.
 
Here is a bullet point list of facts:
"""
 
- The Greenland Sea is an outlying portion of the Arctic Ocean located between Iceland, Norway, the Svalbard archipelago and Greenland.
- It has an area of 465,000 square miles.
- It is one of five oceans in the world, alongside the Pacific Ocean, Atlantic Ocean, Indian Ocean, and the Southern Ocean.
- It is the smallest of the five oceans.
- It is covered almost entirely by water, some of which is frozen in the form of glaciers and icebergs.
- The sea is named after the island of Greenland.
- It is the Arctic Ocean's main outlet to the Atlantic.
- It is often frozen over so navigation is limited.
- It is considered the northern branch of the Norwegian Sea.
"""
 
For each fact, determine whether it is true or false about the subject. If you are unable to determine whether the fact is true or false, output "Undetermined".
If the fact is false, explain why.
 
> Finished chain.
 
> Entering new LLMChain chain...
Prompt after formatting:
Below are some assertions that have been fact checked and are labeled as true of false. If the answer is false, a suggestion is given for a correction.
 
Checked Assertions:
"""
 
- The Greenland Sea is an outlying portion of the Arctic Ocean located between Iceland, Norway, the Svalbard archipelago and Greenland. True
 
- It has an area of 465,000 square miles. True
 
- It is one of five oceans in the world, alongside the Pacific Ocean, Atlantic Ocean, Indian Ocean, and the Southern Ocean. False - The Greenland Sea is not an ocean, it is an arm of the Arctic Ocean.
 
- It is the smallest of the five oceans. False - The Greenland Sea is not an ocean, it is an arm of the Arctic Ocean.
 
- It is covered almost entirely by water, some of which is frozen in the form of glaciers and icebergs. True
 
- The sea is named after the island of Greenland. True
 
- It is the Arctic Ocean's main outlet to the Atlantic. True
 
- It is often frozen over so navigation is limited. True
 
- It is considered the northern branch of the Norwegian Sea. True
"""
 
Original Summary:
"""
The Greenland Sea is an outlying portion of the Arctic Ocean located between Iceland, Norway, the Svalbard archipelago and Greenland. It has an area of 465,000 square miles and is one of five oceans in the world, alongside the Pacific Ocean, Atlantic Ocean, Indian Ocean, and the Southern Ocean. It is the smallest of the five oceans and is covered almost entirely by water, some of which is frozen in the form of glaciers and icebergs. The sea is named after the island of Greenland, and is the Arctic Ocean's main outlet to the Atlantic. It is often frozen over so navigation is limited, and is considered the northern branch of the Norwegian Sea.
"""
 
Using these checked assertions, rewrite the original summary to be completely true.
 
The output should have the same structure and formatting as the original summary.
 
Summary:
 
> Finished chain.
 
> Entering new LLMChain chain...
Prompt after formatting:
Below are some assertions that have been fact checked and are labeled as true or false.
 
If all of the assertions are true, return "True". If any of the assertions are false, return "False".
 
Here are some examples:
===
 
Checked Assertions: """
- The sky is red: False
- Water is made of lava: False
- The sun is a star: True
"""
Result: False
 
===
 
Checked Assertions: """
- The sky is blue: True
- Water is wet: True
- The sun is a star: True
"""
Result: True
 
===
 
Checked Assertions: """
- The sky is blue - True
- Water is made of lava- False
- The sun is a star - True
"""
Result: False
 
===
 
Checked Assertions:"""
 
- The Greenland Sea is an outlying portion of the Arctic Ocean located between Iceland, Norway, the Svalbard archipelago and Greenland. True
 
- It has an area of 465,000 square miles. True
 
- It is one of five oceans in the world, alongside the Pacific Ocean, Atlantic Ocean, Indian Ocean, and the Southern Ocean. False - The Greenland Sea is not an ocean, it is an arm of the Arctic Ocean.
 
- It is the smallest of the five oceans. False - The Greenland Sea is not an ocean, it is an arm of the Arctic Ocean.
 
- It is covered almost entirely by water, some of which is frozen in the form of glaciers and icebergs. True
 
- The sea is named after the island of Greenland. True
 
- It is the Arctic Ocean's main outlet to the Atlantic. True
 
- It is often frozen over so navigation is limited. True
 
- It is considered the northern branch of the Norwegian Sea. True
"""
Result:
 
> Finished chain.
 
> Finished chain.
 
The Greenland Sea is an outlying portion of the Arctic Ocean located between Iceland, Norway, the Svalbard archipelago and Greenland. It has an area of 465,000 square miles and is an arm of the Arctic Ocean. It is covered almost entirely by water, some of which is frozen in the form of glaciers and icebergs. The sea is named after the island of Greenland, and is the Arctic Ocean's main outlet to the Atlantic. It is often frozen over so navigation is limited, and is considered the northern branch of the Norwegian Sea.
 
> Entering new SequentialChain chain...
 
> Entering new LLMChain chain...
Prompt after formatting:
Given some text, extract a list of facts from the text.
 
Format your output as a bulleted list.
 
Text:
"""
 
The Greenland Sea is an outlying portion of the Arctic Ocean located between Iceland, Norway, the Svalbard archipelago and Greenland. It has an area of 465,000 square miles and is an arm of the Arctic Ocean. It is covered almost entirely by water, some of which is frozen in the form of glaciers and icebergs. The sea is named after the island of Greenland, and is the Arctic Ocean's main outlet to the Atlantic. It is often frozen over so navigation is limited, and is considered the northern branch of the Norwegian Sea.
"""
 
Facts:
 
> Finished chain.
 
> Entering new LLMChain chain...
Prompt after formatting:
You are an expert fact checker. You have been hired by a major news organization to fact check a very important story.
 
Here is a bullet point list of facts:
"""
 
- The Greenland Sea is an outlying portion of the Arctic Ocean located between Iceland, Norway, the Svalbard archipelago and Greenland.
- It has an area of 465,000 square miles.
- It is an arm of the Arctic Ocean.
- It is covered almost entirely by water, some of which is frozen in the form of glaciers and icebergs.
- It is named after the island of Greenland.
- It is the Arctic Ocean's main outlet to the Atlantic.
- It is often frozen over so navigation is limited.
- It is considered the northern branch of the Norwegian Sea.
"""
 
For each fact, determine whether it is true or false about the subject. If you are unable to determine whether the fact is true or false, output "Undetermined".
If the fact is false, explain why.
 
> Finished chain.
 
> Entering new LLMChain chain...
Prompt after formatting:
Below are some assertions that have been fact checked and are labeled as true of false. If the answer is false, a suggestion is given for a correction.
 
Checked Assertions:
"""
 
- The Greenland Sea is an outlying portion of the Arctic Ocean located between Iceland, Norway, the Svalbard archipelago and Greenland. True
 
- It has an area of 465,000 square miles. True
 
- It is an arm of the Arctic Ocean. True
 
- It is covered almost entirely by water, some of which is frozen in the form of glaciers and icebergs. True
 
- It is named after the island of Greenland. False - It is named after the country of Greenland.
 
- It is the Arctic Ocean's main outlet to the Atlantic. True
 
- It is often frozen over so navigation is limited. True
 
- It is considered the northern branch of the Norwegian Sea. False - It is considered the northern branch of the Atlantic Ocean.
"""
 
Original Summary:
"""
 
The Greenland Sea is an outlying portion of the Arctic Ocean located between Iceland, Norway, the Svalbard archipelago and Greenland. It has an area of 465,000 square miles and is an arm of the Arctic Ocean. It is covered almost entirely by water, some of which is frozen in the form of glaciers and icebergs. The sea is named after the island of Greenland, and is the Arctic Ocean's main outlet to the Atlantic. It is often frozen over so navigation is limited, and is considered the northern branch of the Norwegian Sea.
"""
 
Using these checked assertions, rewrite the original summary to be completely true.
 
The output should have the same structure and formatting as the original summary.
 
Summary:
 
> Finished chain.
 
> Entering new LLMChain chain...
Prompt after formatting:
Below are some assertions that have been fact checked and are labeled as true or false.
 
If all of the assertions are true, return "True". If any of the assertions are false, return "False".
 
Here are some examples:
===
 
Checked Assertions: """
- The sky is red: False
- Water is made of lava: False
- The sun is a star: True
"""
Result: False
 
===
 
Checked Assertions: """
- The sky is blue: True
- Water is wet: True
- The sun is a star: True
"""
Result: True
 
===
 
Checked Assertions: """
- The sky is blue - True
- Water is made of lava- False
- The sun is a star - True
"""
Result: False
 
===
 
Checked Assertions:"""
 
- The Greenland Sea is an outlying portion of the Arctic Ocean located between Iceland, Norway, the Svalbard archipelago and Greenland. True
 
- It has an area of 465,000 square miles. True
 
- It is an arm of the Arctic Ocean. True
 
- It is covered almost entirely by water, some of which is frozen in the form of glaciers and icebergs. True
 
- It is named after the island of Greenland. False - It is named after the country of Greenland.
 
- It is the Arctic Ocean's main outlet to the Atlantic. True
 
- It is often frozen over so navigation is limited. True
 
- It is considered the northern branch of the Norwegian Sea. False - It is considered the northern branch of the Atlantic Ocean.
"""
Result:
 
> Finished chain.
 
> Finished chain.
 
The Greenland Sea is an outlying portion of the Arctic Ocean located between Iceland, Norway, the Svalbard archipelago and Greenland. It has an area of 465,000 square miles and is an arm of the Arctic Ocean. It is covered almost entirely by water, some of which is frozen in the form of glaciers and icebergs. The sea is named after the country of Greenland, and is the Arctic Ocean's main outlet to the Atlantic. It is often frozen over so navigation is limited, and is considered the northern branch of the Atlantic Ocean.
 
> Entering new SequentialChain chain...
 
> Entering new LLMChain chain...
Prompt after formatting:
Given some text, extract a list of facts from the text.
 
Format your output as a bulleted list.
 
Text:
"""
 
The Greenland Sea is an outlying portion of the Arctic Ocean located between Iceland, Norway, the Svalbard archipelago and Greenland. It has an area of 465,000 square miles and is an arm of the Arctic Ocean. It is covered almost entirely by water, some of which is frozen in the form of glaciers and icebergs. The sea is named after the country of Greenland, and is the Arctic Ocean's main outlet to the Atlantic. It is often frozen over so navigation is limited, and is considered the northern branch of the Atlantic Ocean.
"""
 
Facts:
 
> Finished chain.
 
> Entering new LLMChain chain...
Prompt after formatting:
You are an expert fact checker. You have been hired by a major news organization to fact check a very important story.
 
Here is a bullet point list of facts:
"""
 
- The Greenland Sea is an outlying portion of the Arctic Ocean located between Iceland, Norway, the Svalbard archipelago and Greenland.
- It has an area of 465,000 square miles.
- It is covered almost entirely by water, some of which is frozen in the form of glaciers and icebergs.
- The sea is named after the country of Greenland.
- It is the Arctic Ocean's main outlet to the Atlantic.
- It is often frozen over so navigation is limited.
- It is considered the northern branch of the Atlantic Ocean.
"""
 
For each fact, determine whether it is true or false about the subject. If you are unable to determine whether the fact is true or false, output "Undetermined".
If the fact is false, explain why.
 
> Finished chain.
 
> Entering new LLMChain chain...
Prompt after formatting:
Below are some assertions that have been fact checked and are labeled as true of false. If the answer is false, a suggestion is given for a correction.
 
Checked Assertions:
"""
 
- The Greenland Sea is an outlying portion of the Arctic Ocean located between Iceland, Norway, the Svalbard archipelago and Greenland. True
 
- It has an area of 465,000 square miles. True
 
- It is covered almost entirely by water, some of which is frozen in the form of glaciers and icebergs. True
 
- The sea is named after the country of Greenland. True
 
- It is the Arctic Ocean's main outlet to the Atlantic. False - The Arctic Ocean's main outlet to the Atlantic is the Barents Sea.
 
- It is often frozen over so navigation is limited. True
 
- It is considered the northern branch of the Atlantic Ocean. False - The Greenland Sea is considered part of the Arctic Ocean, not the Atlantic Ocean.
"""
 
Original Summary:
"""
 
The Greenland Sea is an outlying portion of the Arctic Ocean located between Iceland, Norway, the Svalbard archipelago and Greenland. It has an area of 465,000 square miles and is an arm of the Arctic Ocean. It is covered almost entirely by water, some of which is frozen in the form of glaciers and icebergs. The sea is named after the country of Greenland, and is the Arctic Ocean's main outlet to the Atlantic. It is often frozen over so navigation is limited, and is considered the northern branch of the Atlantic Ocean.
"""
 
Using these checked assertions, rewrite the original summary to be completely true.
 
The output should have the same structure and formatting as the original summary.
 
Summary:
 
> Finished chain.
 
> Entering new LLMChain chain...
Prompt after formatting:
Below are some assertions that have been fact checked and are labeled as true or false.
 
If all of the assertions are true, return "True". If any of the assertions are false, return "False".
 
Here are some examples:
===
 
Checked Assertions: """
- The sky is red: False
- Water is made of lava: False
- The sun is a star: True
"""
Result: False
 
===
 
Checked Assertions: """
- The sky is blue: True
- Water is wet: True
- The sun is a star: True
"""
Result: True
 
===
 
Checked Assertions: """
- The sky is blue - True
- Water is made of lava- False
- The sun is a star - True
"""
Result: False
 
===
 
Checked Assertions:"""
 
- The Greenland Sea is an outlying portion of the Arctic Ocean located between Iceland, Norway, the Svalbard archipelago and Greenland. True
 
- It has an area of 465,000 square miles. True
 
- It is covered almost entirely by water, some of which is frozen in the form of glaciers and icebergs. True
 
- The sea is named after the country of Greenland. True
 
- It is the Arctic Ocean's main outlet to the Atlantic. False - The Arctic Ocean's main outlet to the Atlantic is the Barents Sea.
 
- It is often frozen over so navigation is limited. True
 
- It is considered the northern branch of the Atlantic Ocean. False - The Greenland Sea is considered part of the Arctic Ocean, not the Atlantic Ocean.
"""
Result:
 
> Finished chain.
 
> Finished chain.
 
The Greenland Sea is an outlying portion of the Arctic Ocean located between Iceland, Norway, the Svalbard archipelago and Greenland. It has an area of 465,000 square miles and is covered almost entirely by water, some of which is frozen in the form of glaciers and icebergs. The sea is named after the country of Greenland, and is the Arctic Ocean's main outlet to the Barents Sea. It is often frozen over so navigation is limited, and is considered part of the Arctic Ocean.
 
> Finished chain.
 
"The Greenland Sea is an outlying portion of the Arctic Ocean located between Iceland, Norway, the Svalbard archipelago and Greenland. It has an area of 465,000 square miles and is covered almost entirely by water, some of which is frozen in the form of glaciers and icebergs. The sea is named after the country of Greenland, and is the Arctic Ocean's main outlet to the Barents Sea. It is often frozen over so navigation is limited, and is considered part of the Arctic Ocean."
 
from langchain.chains import LLMSummarizationCheckerChain
from langchain.llms import OpenAI
 
llm = OpenAI(temperature=0)
checker_chain = LLMSummarizationCheckerChain.from_llm(llm, max_checks=3, verbose=True)
text = "Mammals can lay eggs, birds can lay eggs, therefore birds are mammals."
checker_chain.run(text)
 
> Entering new LLMSummarizationCheckerChain chain...
 
> Entering new SequentialChain chain...
 
> Entering new LLMChain chain...
Prompt after formatting:
Given some text, extract a list of facts from the text.
 
Format your output as a bulleted list.
 
Text:
"""
Mammals can lay eggs, birds can lay eggs, therefore birds are mammals.
"""
 
Facts:
 
> Finished chain.
 
> Entering new LLMChain chain...
Prompt after formatting:
You are an expert fact checker. You have been hired by a major news organization to fact check a very important story.
 
Here is a bullet point list of facts:
"""
 
- Mammals can lay eggs
- Birds can lay eggs
- Birds are mammals
"""
 
For each fact, determine whether it is true or false about the subject. If you are unable to determine whether the fact is true or false, output "Undetermined".
If the fact is false, explain why.
 
> Finished chain.
 
> Entering new LLMChain chain...
Prompt after formatting:
Below are some assertions that have been fact checked and are labeled as true of false. If the answer is false, a suggestion is given for a correction.
 
Checked Assertions:
"""
 
- Mammals can lay eggs: False. Mammals are not capable of laying eggs, as they give birth to live young.
 
- Birds can lay eggs: True. Birds are capable of laying eggs.
 
- Birds are mammals: False. Birds are not mammals, they are a class of their own.
"""
 
Original Summary:
"""
Mammals can lay eggs, birds can lay eggs, therefore birds are mammals.
"""
 
Using these checked assertions, rewrite the original summary to be completely true.
 
The output should have the same structure and formatting as the original summary.
 
Summary:
 
> Finished chain.
 
> Entering new LLMChain chain...
Prompt after formatting:
Below are some assertions that have been fact checked and are labeled as true or false.
 
If all of the assertions are true, return "True". If any of the assertions are false, return "False".
 
Here are some examples:
===
 
Checked Assertions: """
- The sky is red: False
- Water is made of lava: False
- The sun is a star: True
"""
Result: False
 
===
 
Checked Assertions: """
- The sky is blue: True
- Water is wet: True
- The sun is a star: True
"""
Result: True
 
===
 
Checked Assertions: """
- The sky is blue - True
- Water is made of lava- False
- The sun is a star - True
"""
Result: False
 
===
 
Checked Assertions:"""
 
- Mammals can lay eggs: False. Mammals are not capable of laying eggs, as they give birth to live young.
 
- Birds can lay eggs: True. Birds are capable of laying eggs.
 
- Birds are mammals: False. Birds are not mammals, they are a class of their own.
"""
Result:
 
> Finished chain.
 
> Finished chain.
 Birds and mammals are both capable of laying eggs, however birds are not mammals, they are a class of their own.
 
> Entering new SequentialChain chain...
 
> Entering new LLMChain chain...
Prompt after formatting:
Given some text, extract a list of facts from the text.
 
Format your output as a bulleted list.
 
Text:
"""
 Birds and mammals are both capable of laying eggs, however birds are not mammals, they are a class of their own.
"""
 
Facts:
 
> Finished chain.
 
> Entering new LLMChain chain...
Prompt after formatting:
You are an expert fact checker. You have been hired by a major news organization to fact check a very important story.
 
Here is a bullet point list of facts:
"""
 
- Birds and mammals are both capable of laying eggs.
- Birds are not mammals.
- Birds are a class of their own.
"""
 
For each fact, determine whether it is true or false about the subject. If you are unable to determine whether the fact is true or false, output "Undetermined".
If the fact is false, explain why.
 
> Finished chain.
 
> Entering new LLMChain chain...
Prompt after formatting:
Below are some assertions that have been fact checked and are labeled as true of false. If the answer is false, a suggestion is given for a correction.
 
Checked Assertions:
"""
 
- Birds and mammals are both capable of laying eggs: False. Mammals give birth to live young, while birds lay eggs.
 
- Birds are not mammals: True. Birds are a class of their own, separate from mammals.
 
- Birds are a class of their own: True. Birds are a class of their own, separate from mammals.
"""
 
Original Summary:
"""
 Birds and mammals are both capable of laying eggs, however birds are not mammals, they are a class of their own.
"""
 
Using these checked assertions, rewrite the original summary to be completely true.
 
The output should have the same structure and formatting as the original summary.
 
Summary:
 
> Finished chain.
 
> Entering new LLMChain chain...
Prompt after formatting:
Below are some assertions that have been fact checked and are labeled as true or false.
 
If all of the assertions are true, return "True". If any of the assertions are false, return "False".
 
Here are some examples:
===
 
Checked Assertions: """
- The sky is red: False
- Water is made of lava: False
- The sun is a star: True
"""
Result: False
 
===
 
Checked Assertions: """
- The sky is blue: True
- Water is wet: True
- The sun is a star: True
"""
Result: True
 
===
 
Checked Assertions: """
- The sky is blue - True
- Water is made of lava- False
- The sun is a star - True
"""
Result: False
 
===
 
Checked Assertions:"""
 
- Birds and mammals are both capable of laying eggs: False. Mammals give birth to live young, while birds lay eggs.
 
- Birds are not mammals: True. Birds are a class of their own, separate from mammals.
 
- Birds are a class of their own: True. Birds are a class of their own, separate from mammals.
"""
Result:
 
> Finished chain.
 
> Finished chain.
 
> Finished chain.
 
'Birds are not mammals, but they are a class of their own. They lay eggs, unlike mammals which give birth to live young.'