|
12 | 12 |
|
13 | 13 | from __future__ import annotations |
14 | 14 |
|
15 | | -from collections import Counter, defaultdict |
16 | | -from importlib import metadata |
17 | 15 | import json |
18 | 16 | import os |
19 | | -from pathlib import Path |
20 | 17 | import platform |
21 | 18 | import shutil |
22 | 19 | import statistics |
23 | 20 | import subprocess |
24 | 21 | import sys |
25 | 22 | import time |
26 | 23 | import uuid |
| 24 | +from collections import Counter, defaultdict |
| 25 | +from importlib import metadata |
| 26 | +from pathlib import Path |
27 | 27 |
|
28 | 28 | SCENARIO = "replace-me" |
29 | 29 | RUN_LABEL = "replace-me" |
@@ -79,9 +79,7 @@ def emit(kind: str, **payload: object) -> None: |
79 | 79 |
|
80 | 80 |
|
81 | 81 | def runtime_context() -> dict[str, object]: |
82 | | - approved = { |
83 | | - name: ("set" if os.getenv(name) else "unset") for name in APPROVED_ENV_VARS |
84 | | - } |
| 82 | + approved = {name: ("set" if os.getenv(name) else "unset") for name in APPROVED_ENV_VARS} |
85 | 83 | package_versions = { |
86 | 84 | name: version |
87 | 85 | for name in ("openai", "agents") |
@@ -157,22 +155,16 @@ def summarize_results() -> dict[str, object]: |
157 | 155 | if item.get("first_token_latency_s") is not None |
158 | 156 | ] |
159 | 157 | result_flags = Counter(str(item["result_flag"]) for item in measured or items) |
160 | | - observations = [ |
161 | | - str(item["observation_summary"]) for item in (measured or items)[:3] |
162 | | - ] |
| 158 | + observations = [str(item["observation_summary"]) for item in (measured or items)[:3]] |
163 | 159 | summary_cases[case_id] = { |
164 | 160 | "mode": str(items[-1]["mode"]), |
165 | 161 | "runs": len(measured), |
166 | 162 | "warmups": len(items) - len(measured), |
167 | 163 | "result_flags": dict(result_flags), |
168 | | - "median_total_latency_s": ( |
169 | | - statistics.median(latencies) if latencies else None |
170 | | - ), |
| 164 | + "median_total_latency_s": (statistics.median(latencies) if latencies else None), |
171 | 165 | "mean_total_latency_s": statistics.mean(latencies) if latencies else None, |
172 | 166 | "median_first_token_latency_s": ( |
173 | | - statistics.median(first_token_latencies) |
174 | | - if first_token_latencies |
175 | | - else None |
| 167 | + statistics.median(first_token_latencies) if first_token_latencies else None |
176 | 168 | ), |
177 | 169 | "observations": observations, |
178 | 170 | } |
|
0 commit comments