From eb54b6baef238c5376f5fb9fff4ad0ea0e342d03 Mon Sep 17 00:00:00 2001 From: Zaki Ali Date: Fri, 20 Dec 2024 14:19:59 -0800 Subject: [PATCH] Fixup error printing --- crates/goose/src/providers/openai.rs | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/crates/goose/src/providers/openai.rs b/crates/goose/src/providers/openai.rs index 8e035cc2..f46b080e 100644 --- a/crates/goose/src/providers/openai.rs +++ b/crates/goose/src/providers/openai.rs @@ -135,7 +135,11 @@ impl Moderation for OpenAiProvider { let category_scores = response_json["results"][0]["category_scores"].clone(); return Ok(ModerationResult::new( flagged, - Some(categories.keys().cloned().collect()), + Some(categories + .iter() + .filter(|(_, value)| value.as_bool().unwrap_or(false)) + .map(|(key, _)| key.to_string()) + .collect()), Some(category_scores), )); } else {