FA3-Datafetch/backend/scripts/inspect_llm_logs.py

25 lines
725 B
Python

import asyncio
import sys
import os
# Add the parent directory to sys.path
sys.path.append(os.path.dirname(os.path.dirname(os.path.abspath(__file__))))
from sqlalchemy import select
from app.database import engine, SessionLocal
from app.models import LLMUsageLog
async def inspect_logs():
async with SessionLocal() as session:
result = await session.execute(select(LLMUsageLog).limit(10))
logs = result.scalars().all()
print(f"Found {len(logs)} logs.")
for log in logs:
print(f"ID: {log.id}")
print(f"Prompt Preview: {log.prompt[:200]}...") # Print first 200 chars
print("-" * 50)
if __name__ == "__main__":
asyncio.run(inspect_logs())