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:
- 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
- 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.
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
Initialize all registered solvers
List all registered claim processors
List all registered retrievers
List all registered solvers
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