pharia_skill/csi/
chunking.rs1use serde::Serialize;
2
3#[derive(Clone, Debug, Serialize)]
5pub struct ChunkParams {
6 pub model: String,
9 pub max_tokens: u32,
11 pub overlap: u32,
14}
15
16impl ChunkParams {
17 pub fn new(model: impl Into<String>, max_tokens: u32) -> Self {
18 Self {
19 model: model.into(),
20 max_tokens,
21 overlap: 0,
22 }
23 }
24
25 #[must_use]
26 pub fn with_overlap(mut self, overlap: u32) -> Self {
27 self.overlap = overlap;
28 self
29 }
30}
31
32#[derive(Clone, Debug, Serialize)]
33pub struct ChunkRequest {
34 pub text: String,
35 pub params: ChunkParams,
36}
37
38impl ChunkRequest {
39 pub fn new(text: impl Into<String>, params: ChunkParams) -> Self {
40 Self {
41 text: text.into(),
42 params,
43 }
44 }
45}