Skip to content

Commit

Permalink
Fixup error printing
Browse files Browse the repository at this point in the history
  • Loading branch information
zakiali committed Dec 20, 2024
1 parent 7f6793e commit b2023fc
Showing 1 changed file with 7 additions and 1 deletion.
8 changes: 7 additions & 1 deletion crates/goose/src/providers/openai.rs
Original file line number Diff line number Diff line change
Expand Up @@ -135,7 +135,13 @@ 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 {
Expand Down

0 comments on commit b2023fc

Please sign in to comment.