Initial commit: add .gitignore and README
This commit is contained in:
17
fusionagi/verification/outcome.py
Normal file
17
fusionagi/verification/outcome.py
Normal file
@@ -0,0 +1,17 @@
|
||||
from typing import Any, Callable
|
||||
from fusionagi._logger import logger
|
||||
|
||||
class OutcomeVerifier:
|
||||
def __init__(self, verify_fn=None):
|
||||
self._verify_fn = verify_fn
|
||||
def verify(self, step_result, context=None):
|
||||
ctx = context or {}
|
||||
if self._verify_fn:
|
||||
try:
|
||||
return self._verify_fn(step_result, ctx)
|
||||
except Exception:
|
||||
logger.exception("OutcomeVerifier failed")
|
||||
return False
|
||||
if isinstance(step_result, dict) and step_result.get("error"):
|
||||
return False
|
||||
return True
|
||||
Reference in New Issue
Block a user