99 - TAVILY_API_KEY: (Optional) For web search verification
1010"""
1111
12- import json
1312import os
14- import tempfile
1513
1614from dingo .config import InputArgs
1715from dingo .exec import Executor
@@ -33,23 +31,14 @@ def main() -> int:
3331 print ("WARNING: TAVILY_API_KEY not set - web search verification will be limited" )
3432 print (" Set it with: export TAVILY_API_KEY='your-api-key'" )
3533
36- # Read the complete article (Markdown input)
37- article_path = "test/data/blog_article_full.md"
34+ article_path = "test/data/factcheck_article.jsonl"
3835 if not os .path .exists (article_path ):
3936 print (f"ERROR: Article file not found: { article_path } " )
4037 return 1
4138
42- with open (article_path , 'r' , encoding = 'utf-8' ) as f :
43- article_content = f .read ()
44-
45- # Wrap article in JSONL so Executor treats it as a single Data object.
46- temp_jsonl = tempfile .NamedTemporaryFile (mode = 'w' , suffix = '.jsonl' , delete = False , encoding = 'utf-8' )
47- temp_jsonl .write (json .dumps ({"content" : article_content }, ensure_ascii = False ) + '\n ' )
48- temp_jsonl .close ()
49-
5039 # Configuration for ArticleFactChecker
5140 config = {
52- "input_path" : temp_jsonl . name ,
41+ "input_path" : article_path ,
5342 "dataset" : {
5443 "source" : "local" ,
5544 "format" : "jsonl"
@@ -113,49 +102,38 @@ def main() -> int:
113102 print ("Artifact output: outputs/article_factcheck_<timestamp>/" )
114103 print ("=" * 70 )
115104
116- # Create input args and executor
117105 input_args = InputArgs (** config )
118106 executor = Executor .exec_map ["local" ](input_args )
119107
120- try :
121- # Execute fact-checking
122- print ("\n Executing agent-based fact-checking...\n " )
123-
124- result = executor .execute ()
125-
126- # Display results
127- print ("\n " + "=" * 70 )
128- print ("FACT-CHECKING RESULTS" )
129- print ("=" * 70 )
130-
131- if result :
132- print (f"\n Total items evaluated: { result .total } " )
133- print (f"Passed: { result .num_good } | Issues found: { result .num_bad } " )
134- if result .score :
135- print (f"Overall score: { result .score :.2%} " )
136- if result .type_ratio :
137- print ("\n Issue breakdown:" )
138- for field_key , type_counts in result .type_ratio .items ():
139- for label , count in type_counts .items ():
140- print (f" [{ field_key } ] { label } : { count } " )
141-
142- print ("\n Fact-checking complete!" )
143- print (f"\n Dingo standard output: { input_args .output_path } /" )
144- print (" |-- summary.json (aggregated statistics)" )
145- print (" +-- content/<LABEL>.jsonl (results grouped by quality label)" )
146-
147- print ("\n Intermediate artifacts: outputs/article_factcheck_<timestamp>_<uuid>/" )
148- print (" |-- article_content.md (original Markdown article)" )
149- print (" |-- claims_extracted.jsonl (extracted claims, one per line)" )
150- print (" |-- claims_verification.jsonl (per-claim verification details)" )
151- print (" +-- verification_report.json (full structured report)" )
152- print ("\n Note: Override artifact path with agent_config.output_path in config" )
153-
154- finally :
155- try :
156- os .unlink (temp_jsonl .name )
157- except OSError :
158- pass
108+ print ("\n Executing agent-based fact-checking...\n " )
109+ result = executor .execute ()
110+
111+ print ("\n " + "=" * 70 )
112+ print ("FACT-CHECKING RESULTS" )
113+ print ("=" * 70 )
114+
115+ if result :
116+ print (f"\n Total items evaluated: { result .total } " )
117+ print (f"Passed: { result .num_good } | Issues found: { result .num_bad } " )
118+ if result .score :
119+ print (f"Overall score: { result .score :.2%} " )
120+ if result .type_ratio :
121+ print ("\n Issue breakdown:" )
122+ for field_key , type_counts in result .type_ratio .items ():
123+ for label , count in type_counts .items ():
124+ print (f" [{ field_key } ] { label } : { count } " )
125+
126+ print ("\n Fact-checking complete!" )
127+ print (f"\n Dingo standard output: { input_args .output_path } /" )
128+ print (" |-- summary.json (aggregated statistics)" )
129+ print (" +-- content/<LABEL>.jsonl (results grouped by quality label)" )
130+
131+ print ("\n Intermediate artifacts: outputs/article_factcheck_<timestamp>_<uuid>/" )
132+ print (" |-- article_content.md (original Markdown article)" )
133+ print (" |-- claims_extracted.jsonl (extracted claims, one per line)" )
134+ print (" |-- claims_verification.jsonl (per-claim verification details)" )
135+ print (" +-- verification_report.json (full structured report)" )
136+ print ("\n Note: Override artifact path with agent_config.output_path in config" )
159137
160138 return 0
161139
0 commit comments