AutoGPT is the vision of accessible AI for everyone, to use and to build on. Our mission is to provide the tools, so that you can focus on what matters.
feat(blocks): Add references output pin to Fact Checker block (#11166)
Toran Bruce Richardsadfa75eca836
diff --git a/autogpt_platform/backend/backend/blocks/jina/fact_checker.py b/autogpt_platform/backend/backend/blocks/jina/fact_checker.pyindex 9cf1e277fd..663ce4ae16 100644--- a/autogpt_platform/backend/backend/blocks/jina/fact_checker.py+++ b/autogpt_platform/backend/backend/blocks/jina/fact_checker.py@@ -1,5 +1,8 @@+from typing import Listfrom urllib.parse import quote+from typing_extensions import TypedDict+from backend.blocks.jina._auth import (JinaCredentials,JinaCredentialsField,@@ -10,6 +13,12 @@ from backend.data.model import SchemaFieldfrom backend.util.request import Requests+class Reference(TypedDict):+ url: str+ keyQuote: str+ isSupportive: bool++class FactCheckerBlock(Block):class Input(BlockSchema):statement: str = SchemaField(@@ -23,6 +32,10 @@ class FactCheckerBlock(Block):)result: bool = SchemaField(description="The result of the factuality check")reason: str = SchemaField(description="The reason for the factuality result")+ references: List[Reference] = SchemaField(+ description="List of references supporting or contradicting the statement",+ default=[],+ )error: str = SchemaField(description="Error message if the check fails")def __init__(self):@@ -53,5 +66,11 @@ class FactCheckerBlock(Block):yield "factuality", data["factuality"]yield "result", data["result"]yield "reason", data["reason"]++ # Yield references if present in the response+ if "references" in data:+ yield "references", data["references"]+ else:+ yield "references", []else:raise RuntimeError(f"Expected 'data' key not found in response: {data}")