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