File size: 347 Bytes
6826247 |
1 2 3 4 5 6 7 8 9 10 11 |
import json
import os
from datetime import datetime
def log_prompt_result(prompt: str, result: dict):
os.makedirs("logs", exist_ok=True)
timestamp = datetime.now().strftime("%Y-%m-%d_%H-%M-%S")
log_file = f"logs/{timestamp}.json"
with open(log_file, "w") as f:
json.dump({"prompt": prompt, "result": result}, f, indent=2)
|