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