Alibrown commited on
Commit
0eccc0b
Β·
verified Β·
1 Parent(s): 1121463

Update main.py

Browse files
Files changed (1) hide show
  1. main.py +4 -2
main.py CHANGED
@@ -267,12 +267,13 @@ async def chat_completions(
267
  "Your request needs more detail before I can help. "
268
  "Suggestions: " + " | ".join(adi_result["recommendations"])
269
  )
 
270
  model_module.push_log({
271
  "prompt": user_prompt,
272
  "system_prompt": system_prompt,
273
  "adi_score": adi_result["adi"],
274
  "adi_decision": decision,
275
- "adi_metrics": adi_result["metrics"],
276
  "response": None,
277
  "routed_to": "REJECT",
278
  "model": req.model,
@@ -304,11 +305,12 @@ async def chat_completions(
304
  )
305
 
306
  # ── Log to Dataset ────────────────────────────────────────────────────────
 
307
  model_module.push_log({
308
  "prompt": user_prompt,
309
  "system_prompt": system_prompt,
310
  "adi_score": adi_result["adi"],
311
- "adi_metrics": adi_result["metrics"],
312
  "adi_decision": decision,
313
  "response": response_text,
314
  "routed_to": routed_to,
 
267
  "Your request needs more detail before I can help. "
268
  "Suggestions: " + " | ".join(adi_result["recommendations"])
269
  )
270
+ import json as _json
271
  model_module.push_log({
272
  "prompt": user_prompt,
273
  "system_prompt": system_prompt,
274
  "adi_score": adi_result["adi"],
275
  "adi_decision": decision,
276
+ "adi_metrics": _json.dumps(adi_result["metrics"]), # Arrow needs string, not dict
277
  "response": None,
278
  "routed_to": "REJECT",
279
  "model": req.model,
 
305
  )
306
 
307
  # ── Log to Dataset ────────────────────────────────────────────────────────
308
+ import json as _json
309
  model_module.push_log({
310
  "prompt": user_prompt,
311
  "system_prompt": system_prompt,
312
  "adi_score": adi_result["adi"],
313
+ "adi_metrics": _json.dumps(adi_result["metrics"]), # Arrow needs string, not dict
314
  "adi_decision": decision,
315
  "response": response_text,
316
  "routed_to": routed_to,