fix simulation reporting and research resilience
This commit is contained in:
@@ -65,9 +65,10 @@ class SimulationLogger:
|
||||
day: int,
|
||||
time_of_day: str,
|
||||
agents: list[AgentPersona],
|
||||
entries: list[ActionEntry],
|
||||
metrics: WorldMetrics,
|
||||
coherence_scores: dict[int, Any] | None = None,
|
||||
entries: list[ActionEntry],
|
||||
metrics: WorldMetrics,
|
||||
selection: dict[str, Any] | None = None,
|
||||
coherence_scores: dict[int, Any] | None = None,
|
||||
personality_mandates: dict[int, str] | None = None,
|
||||
cross_agent_repeated: str = "",
|
||||
):
|
||||
@@ -144,20 +145,19 @@ class SimulationLogger:
|
||||
"day": day,
|
||||
"time_of_day": time_of_day,
|
||||
"agents": agent_records,
|
||||
"summary": {
|
||||
"abandon_count": abandon_count,
|
||||
"defect_count": defect_count,
|
||||
"sentiment_distribution": sentiment_dist,
|
||||
"cross_agent_repeated_phrases": cross_agent_repeated[:300],
|
||||
},
|
||||
"metrics": {
|
||||
"brand_sentiment": round(metrics.brand_sentiment, 3),
|
||||
"purchase_intent": round(metrics.purchase_intent, 3),
|
||||
"churn_risk": round(metrics.churn_risk, 3),
|
||||
"adoption_rate": round(metrics.adoption_rate, 3),
|
||||
"stability": round(metrics.stability, 3),
|
||||
"trust": round(metrics.trust, 3),
|
||||
},
|
||||
"summary": {
|
||||
"abandon_count": abandon_count,
|
||||
"defect_count": defect_count,
|
||||
"sentiment_distribution": sentiment_dist,
|
||||
"cross_agent_repeated_phrases": cross_agent_repeated[:300],
|
||||
},
|
||||
"selection": selection or {},
|
||||
# Keep JSONL observability aligned with the complete metrics
|
||||
# snapshot stored in the database.
|
||||
"metrics": {
|
||||
key: round(float(getattr(metrics, key)), 3)
|
||||
for key in WorldMetrics.model_fields
|
||||
},
|
||||
}
|
||||
self._write(record)
|
||||
|
||||
|
||||
Reference in New Issue
Block a user