Download predictor.py from dougdotcon/douvras-agent-failure-predictor: direct link, hf CLI and curl.
- Browser
- Download file 843 Bytes
-
https://huggingface.co/dougdotcon/douvras-agent-failure-predictor/resolve/main/predictor.py
- Command line
-
hf download hf://dougdotcon/douvras-agent-failure-predictor/predictor.py
-
curl -L -o predictor.py https://huggingface.co/dougdotcon/douvras-agent-failure-predictor/resolve/main/predictor.py
843 Bytes
| from __future__ import annotations | |
| import argparse | |
| import json | |
| def predict(trajectory_text: str) -> str: | |
| text = trajectory_text.casefold() | |
| if "ferramenta" in text and "vez da consulta" in text: | |
| return "wrong_tool" | |
| if "argumentos inválidos" in text: | |
| return "invalid_arguments" | |
| if "encerrou antes" in text: | |
| return "premature_stop" | |
| if "objetivo" in text and "silenciosamente" in text: | |
| return "context_drift" | |
| if "repetiu" in text and "mesma chamada" in text: | |
| return "retry_loop" | |
| return "safe_recovery" | |
| def main() -> None: | |
| parser = argparse.ArgumentParser() | |
| parser.add_argument("--trajectory", required=True) | |
| args = parser.parse_args() | |
| print(json.dumps({"failure_type": predict(args.trajectory)}, ensure_ascii=False)) | |
| if __name__ == "__main__": | |
| main() | |