gte/embed/input.rs
1/// Input for text embedding
2pub struct TextInput {
3 pub texts: Vec<String>,
4}
5
6impl TextInput {
7 pub fn new(texts: Vec<String>) -> Self {
8 Self { texts }
9 }
10
11 pub fn from_str(texts: &[&str]) -> Self {
12 Self::new(
13 texts.iter().map(|s| s.to_string()).collect(),
14 )
15 }
16}
17
18impl crate::commons::input::text::TextInput<'_> for TextInput {
19 type InputType = String;
20
21 fn into_encode_input(self) -> Vec<Self::InputType> {
22 self.texts
23 }
24}
25
26