|
|
""" |
|
|
Entry point script for analyzing images with the forensic agent. |
|
|
""" |
|
|
|
|
|
import argparse |
|
|
import sys |
|
|
from pathlib import Path |
|
|
|
|
|
|
|
|
sys.path.insert(0, str(Path(__file__).parent.parent)) |
|
|
|
|
|
from src.agents import ForensicAgent |
|
|
|
|
|
|
|
|
def main(): |
|
|
parser = argparse.ArgumentParser( |
|
|
description="Analyze an image using the forensic agent" |
|
|
) |
|
|
parser.add_argument( |
|
|
"--image", |
|
|
type=str, |
|
|
required=True, |
|
|
help="Path to the image file to analyze" |
|
|
) |
|
|
parser.add_argument( |
|
|
"--query", |
|
|
type=str, |
|
|
default=None, |
|
|
help="Optional specific question about the image" |
|
|
) |
|
|
parser.add_argument( |
|
|
"--model", |
|
|
type=str, |
|
|
default="gpt-5.1", |
|
|
help="LLM model to use (default: gpt-5.1)" |
|
|
) |
|
|
parser.add_argument( |
|
|
"--temperature", |
|
|
type=float, |
|
|
default=0.2, |
|
|
help="LLM temperature (default: 0.2)" |
|
|
) |
|
|
|
|
|
args = parser.parse_args() |
|
|
|
|
|
|
|
|
print(f"Initializing forensic agent with model: {args.model}...") |
|
|
agent = ForensicAgent( |
|
|
llm_model=args.model, |
|
|
temperature=args.temperature |
|
|
) |
|
|
|
|
|
|
|
|
print(f"\nAnalyzing image: {args.image}") |
|
|
if args.query: |
|
|
print(f"Query: {args.query}") |
|
|
print("-" * 60) |
|
|
|
|
|
try: |
|
|
result = agent.analyze(args.image, args.query) |
|
|
|
|
|
print("\n" + "=" * 60) |
|
|
print("ANALYSIS RESULTS") |
|
|
print("=" * 60) |
|
|
print(f"\nConclusion:\n{result['conclusion']}") |
|
|
|
|
|
if result['tool_usage']: |
|
|
print(f"\nTools used: {', '.join(result['tool_usage'])}") |
|
|
else: |
|
|
print("\nNo tools were used.") |
|
|
|
|
|
print("\n" + "=" * 60) |
|
|
|
|
|
except Exception as e: |
|
|
print(f"\nError: {e}", file=sys.stderr) |
|
|
sys.exit(1) |
|
|
|
|
|
|
|
|
if __name__ == "__main__": |
|
|
main() |
|
|
|
|
|
|
|
|
|