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 eb54b6b
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion crates/goose/src/providers/openai.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand Down

0 comments on commit eb54b6b

Please sign in to comment.