mirror of
https://github.com/BerriAI/litellm.git
synced 2026-09-29 01:42:19 +00:00
22 lines
528 B
Rust
22 lines
528 B
Rust
use serde::Serialize;
|
|
use serde_json::Value;
|
|
|
|
#[derive(Clone, Debug, PartialEq, Serialize)]
|
|
pub struct PartialHits {
|
|
pub values: Vec<Option<Value>>,
|
|
pub missing_indices: Vec<usize>,
|
|
}
|
|
|
|
impl PartialHits {
|
|
pub fn new(values: Vec<Option<Value>>) -> Self {
|
|
let missing_indices = values
|
|
.iter()
|
|
.enumerate()
|
|
.filter_map(|(index, value)| value.is_none().then_some(index))
|
|
.collect();
|
|
Self {
|
|
values,
|
|
missing_indices,
|
|
}
|
|
}
|
|
}
|