qdrant_client/builders/
document_builder.rs1use std::collections::HashMap;
2
3use crate::qdrant::{Document, Value};
4
5impl Document {
6 pub fn new(text: impl Into<String>, model: impl Into<String>) -> Self {
7 Self {
8 text: text.into(),
9 model: model.into(),
10 options: HashMap::new(),
11 }
12 }
13}
14
15pub struct DocumentBuilder {
16 text: String,
17 model: String,
18 options: HashMap<String, Value>,
19}
20
21impl DocumentBuilder {
22 pub fn new(text: impl Into<String>, model: impl Into<String>) -> Self {
23 Self {
24 text: text.into(),
25 model: model.into(),
26 options: HashMap::new(),
27 }
28 }
29
30 pub fn text(mut self, text: impl Into<String>) -> Self {
31 self.text = text.into();
32 self
33 }
34
35 pub fn model(mut self, model: impl Into<String>) -> Self {
36 self.model = model.into();
37 self
38 }
39
40 pub fn options(mut self, options: HashMap<String, Value>) -> Self {
41 self.options = options;
42 self
43 }
44
45 pub fn build(self) -> Document {
46 Document {
47 text: self.text,
48 model: self.model,
49 options: self.options,
50 }
51 }
52}