fix: decisions from system one correctly

This commit is contained in:
2026-10-13 21:25:25 -04:00
parent f778fae70c
commit a0d95d52e4

View File

@@ -220,26 +220,12 @@ pub async fn create_decision(
score,
confidence,
probabilities: {
let reverse_legend = HashMap::<_, _, RandomState>::from_iter(
legend.into_iter().map(|(index, value)| {
(
value,
index
.parse::<i32>()
.expect("this should be an integer, I believe"),
)
}),
);
probabilities
.into_iter()
.map(|(choice_id, probability)| {
openai::decisions::ScoreProbability {
value: reverse_legend
.get(&choice_id)
.expect("it should exist, I think")
.clone(),
label: choice_id,
value: choice_id.parse().expect("it should be a number, I think"),
label: legend.get(&choice_id).expect("it should exist, I think").clone(),
probability,
}
})