openfactcheck.OpenFactCheck#

class openfactcheck.OpenFactCheck(config)[source][source]#

Base class for OpenFactCheck that initializes the solvers and pipeline with the given configuration.

Parameters:

config (OpenFactCheckConfig) – An instance of OpenFactCheckConfig containing the configuration settings for OpenFactCheck.

logger#

An instance of the logger to log messages.

Type:

Logger

config#

An instance of OpenFactCheckConfig containing the configuration settings for OpenFactCheck.

Type:

OpenFactCheckConfig

solver_configs#

A dictionary containing the configuration settings for the solvers.

Type:

dict

pipeline#

A list of solvers to be included in the pipeline.

Type:

list

output_path#

The path to the output directory where the results will be stored.

Type:

str

load_solvers(solver_paths)[source][source]#

Load solvers from the given paths.

list_solvers()[source][source]#

List all registered solvers.

list_claimprocessors()[source][source]#

List all registered claim processors.

list_retrievers()[source][source]#

List all registered retrievers.

list_verifiers()[source][source]#

List all registered verifiers.

init_solver(solver_name, args)[source][source]#

Initialize a solver with the given configuration.

init_solvers()[source][source]#

Initialize all registered solvers.

init_pipeline()[source][source]#

Initialize the pipeline with the given configuration.

init_pipeline_manually(pipeline)[source][source]#

Initialize the pipeline with the given configuration.

persist_output(state, idx, solver_name, cont, sample_name=0)#

Persist the output of the solver.

read_output(sample_name)#

Read the output file for the given sample.

remove_output(sample_name)#

Remove the output file for the given sample.

__call__(response, question, callback_fun, \*\*kwargs)#

Evaluate the response using the pipeline.

Examples

>>> config = OpenFactCheckConfig("config.json")
>>> ofc = OpenFactCheck(config)
>>> response, sample_name = ofc("This is a sample response.")
>>> output = ofc.read_output(sample_name)
>>> ofc.remove_output(sample_name)
__init__(config)[source][source]#

Initialize OpenFactCheck with the given configuration.

Parameters:

config (OpenFactCheckConfig) – An instance of OpenFactCheckConfig containing the configuration settings for OpenFactCheck.

Methods

__init__(config)

Initialize OpenFactCheck with the given configuration.

init_pipeline()

Initialize the pipeline with the given configuration

init_pipeline_manually(pipeline)

Initialize the pipeline with the given configuration

init_solver(solver_name, args)

Initialize a solver with the given configuration

init_solvers()

Initialize all registered solvers

list_claimprocessors()

List all registered claim processors

list_retrievers()

List all registered retrievers

list_solvers()

List all registered solvers

list_verifiers()

List all registered verifiers

load_solvers(solver_paths)

Load solvers from the given paths

Attributes

FactCheckerEvaluator

Return the FactChecker Evaluator

LLMEvaluator

Return the LLM Evaluator

ResponseEvaluator

Return the LLM Response Evaluator