For the complete documentation index, see llms.txt. This page is also available as Markdown.

Send results to S3

Recipe — export evaluation results to S3.

import json
from datetime import datetime, timedelta
import boto3
from layerlens import Stratix

client = Stratix()
s3 = boto3.client("s3")
BUCKET = "my-evaluation-archive"

# Page through recent evaluations
since = datetime.utcnow() - timedelta(hours=24)
page = 1
while True:
 response = client.evaluations.get_many(page=page, page_size=100, sort_by="submitted_at", order="desc")
 evaluations = [e for e in response.evaluations if e.submitted_at >= since]
 if not evaluations:
 break

 for evaluation in evaluations:
 # Get all per-prompt results
 all_results = client.results.get_all(evaluation=evaluation)
 payload = {
 "evaluation": evaluation.dict(),
 "results": [r.dict() for r in all_results],
 }
 s3.put_object(
 Bucket=BUCKET,
 Key=f"evals/{evaluation.id}.json",
 Body=json.dumps(payload, default=str).encode(),
 )

 if page >= response.pagination.total_pages:
 break
 page += 1

Wire from any scheduler (cron, GitHub Actions, Lambda) — see daily smoke eval for the scheduling pattern.

See also

Last updated

Was this helpful?