Spaces:
Running
Running
File size: 1,899 Bytes
0e38162 | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 | #!/usr/bin/env python3
"""
CLI: run the full CitationEdge pipeline on a PDF.
Usage:
python scripts/run_agent.py path/to/paper.pdf
python scripts/run_agent.py path/to/paper.pdf --job-id my_job_123
"""
import argparse
import asyncio
import json
import sys
from pathlib import Path
sys.path.insert(0, str(Path(__file__).parent.parent))
from dotenv import load_dotenv
load_dotenv()
from orchestrators.custom_orchestrator import CitationEdgeOrchestrator
from utils.helpers import generate_id
from utils.logger import get_logger
logger = get_logger("run_agent")
async def main():
parser = argparse.ArgumentParser(description="Run CitationEdge analysis on a PDF")
parser.add_argument("pdf_path", help="Path to the research paper PDF")
parser.add_argument("--job-id", default=None, help="Custom job ID (auto-generated if omitted)")
args = parser.parse_args()
pdf_path = Path(args.pdf_path)
if not pdf_path.exists():
print(f"Error: PDF not found: {pdf_path}")
sys.exit(1)
job_id = args.job_id or generate_id("cli")
print(f"\n=== Agentic CitationEdge ===")
print(f"Job ID: {job_id}")
print(f"PDF: {pdf_path}")
print(f"Starting 7-agent pipeline...\n")
orch = CitationEdgeOrchestrator()
result = await orch.run(job_id=job_id, pdf_path=str(pdf_path))
print("\n=== Pipeline Complete ===")
print(json.dumps(result, indent=2, default=str))
scores = result.get("scores", {})
if scores:
print(f"\n Overall Score: {scores.get('overall_score', 0):.1f}/10")
print(f" Literary: {scores.get('literary_score', 0):.1f}/10")
print(f" Argument: {scores.get('argument_score', 0):.1f}/10")
print(f" Citations: {scores.get('citation_completeness', 0):.1f}/10")
print(f"\n Report: {result.get('report_path', 'N/A')}")
if __name__ == "__main__":
asyncio.run(main())
|