use serde::Serialize;
#[derive(Clone, Debug, Serialize)]
pub struct ChunkParams {
pub model: String,
pub max_tokens: u32,
pub overlap: u32,
}
impl ChunkParams {
pub fn new(model: impl Into<String>, max_tokens: u32) -> Self {
Self {
model: model.into(),
max_tokens,
overlap: 0,
}
}
#[must_use]
pub fn with_overlap(mut self, overlap: u32) -> Self {
self.overlap = overlap;
self
}
}
#[derive(Clone, Debug, Serialize)]
pub struct ChunkRequest {
pub text: String,
pub params: ChunkParams,
}
impl ChunkRequest {
pub fn new(text: impl Into<String>, params: ChunkParams) -> Self {
Self {
text: text.into(),
params,
}
}
}