A proof-of-concept fact-checking plugin for OpenAgents. It was a fun way to learn about extism, OpenAgents, and tomatoes!
Introduction
This plugin checks a given statement with Google Fact Check Tools.
API Information
- https://developers.google.com/fact-check/tools/api
- https://developers.google.com/search/docs/appearance/structured-data/factcheck
How it works
- Retrieves a statement from the input.
- Queries the fact-check API for existing claims about the given statement.
- Chooses the best matching review
- Outputs the matching claim, review title, rating, and source as a JSON string.
Usage
- Ensure the plugin is correctly integrated into the hosting environment.
- Call the
run
function with a statement to check and a Google API key - Receive fact-check summary as output.
> extism call plugin.wasm run --input '{"statement":"Tomatoes are fruit","key":"*********"}' --wasi --allow-host 'factchecktools.googleapis.com'
Response to the above may be (formatted for easier reading)
{ "allRatings" : [ "Mixture" ], "claim" : "Tomatoes are officially considered fruits in the U.S.", "overallRating" : "Mixture", "rating" : "Mixture", "source" : "https://www.snopes.com/fact-check/tomatoes-fruits-vegetables/", "title" : "Are Tomatoes Fruits or Vegetables?" }