1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
use crate::qdrant::*;
#[derive(Clone)]
pub struct FeedbackStrategyBuilder {
pub(crate) variant: feedback_strategy::Variant,
}
impl FeedbackStrategyBuilder {
/// Create a naive feedback strategy with specified coefficients.
///
/// The naive strategy uses the formula: `a * score + sim(confidence^b * c * delta)`
///
/// # Arguments
///
/// * `a` - Coefficient for the original score component.
/// * `b` - Exponent for confidence in the feedback component.
/// * `c` - Coefficient for the delta in the feedback component.
///
/// # Examples
///
/// ```
/// use qdrant_client::qdrant::FeedbackStrategyBuilder;
///
/// let strategy = FeedbackStrategyBuilder::naive(1.0, 1.0, 1.0);
/// ```
pub fn naive(a: f32, b: f32, c: f32) -> Self {
Self {
variant: feedback_strategy::Variant::Naive(NaiveFeedbackStrategy { a, b, c }),
}
}
/// Builds the desired type. Can often be omitted.
pub fn build(self) -> FeedbackStrategy {
FeedbackStrategy {
variant: Some(self.variant),
}
}
}
impl From<FeedbackStrategyBuilder> for FeedbackStrategy {
fn from(value: FeedbackStrategyBuilder) -> Self {
value.build()
}
}