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