qdrant_client/builders/
recommend_input_builder.rs1use crate::qdrant::*;
2
3#[derive(Clone)]
4pub struct RecommendInputBuilder {
5 pub(crate) positive: Option<Vec<VectorInput>>,
7 pub(crate) negative: Option<Vec<VectorInput>>,
9 pub(crate) strategy: Option<Option<i32>>,
11}
12
13impl RecommendInputBuilder {
14 #[allow(unused_mut)]
16 pub fn positive<VALUE: core::convert::Into<Vec<VectorInput>>>(self, value: VALUE) -> Self {
17 let mut new = self;
18 new.positive = Option::Some(value.into());
19 new
20 }
21 #[allow(unused_mut)]
23 pub fn negative<VALUE: core::convert::Into<Vec<VectorInput>>>(self, value: VALUE) -> Self {
24 let mut new = self;
25 new.negative = Option::Some(value.into());
26 new
27 }
28 #[allow(unused_mut)]
30 pub fn strategy<VALUE: core::convert::Into<i32>>(self, value: VALUE) -> Self {
31 let mut new = self;
32 new.strategy = Option::Some(Option::Some(value.into()));
33 new
34 }
35
36 fn build_inner(self) -> Result<RecommendInput, std::convert::Infallible> {
37 Ok(RecommendInput {
38 positive: self.positive.unwrap_or_default(),
39 negative: self.negative.unwrap_or_default(),
40 strategy: self.strategy.unwrap_or_default(),
41 })
42 }
43 fn create_empty() -> Self {
45 Self {
46 positive: core::default::Default::default(),
47 negative: core::default::Default::default(),
48 strategy: core::default::Default::default(),
49 }
50 }
51}
52
53impl From<RecommendInputBuilder> for RecommendInput {
54 fn from(value: RecommendInputBuilder) -> Self {
55 value.build_inner().unwrap_or_else(|_| {
56 panic!(
57 "Failed to convert {0} to {1}",
58 "RecommendInputBuilder", "RecommendInput"
59 )
60 })
61 }
62}
63
64impl RecommendInputBuilder {
65 pub fn build(self) -> RecommendInput {
67 self.build_inner().unwrap_or_else(|_| {
68 panic!(
69 "Failed to build {0} into {1}",
70 "RecommendInputBuilder", "RecommendInput"
71 )
72 })
73 }
74}
75
76impl Default for RecommendInputBuilder {
77 fn default() -> Self {
78 Self::create_empty()
79 }
80}