feat: add generation metrics to logs (think, rounds, tokens)
Log think flag, round count, prompt/output token counts per generation. Change log category from 'usage' to 'generation' for clean MCP filtering. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
@@ -68,12 +68,12 @@ async def log_generation(
|
||||
"""Persist per-generation timing breakdown to app_logs for benchmarking."""
|
||||
async with async_session() as session:
|
||||
log = AppLog(
|
||||
category="usage",
|
||||
category="generation",
|
||||
user_id=user_id,
|
||||
action="generation",
|
||||
endpoint=f"/chat/conversations/{conv_id}",
|
||||
duration_ms=timing.get("total_ms"),
|
||||
details=json.dumps({"model": model, **timing}),
|
||||
details=json.dumps({"model": model, "conv_id": conv_id, **timing}),
|
||||
)
|
||||
session.add(log)
|
||||
await session.commit()
|
||||
|
||||
Reference in New Issue
Block a user