Add document embedding and retrieval via a dedicated embedding model #10
1 changed files with 5 additions and 4 deletions
|
|
@ -26,10 +26,11 @@ impl Document {
|
||||||
/// retrieved excerpts can be traced back to their position in the
|
/// retrieved excerpts can be traced back to their position in the
|
||||||
/// source file.
|
/// source file.
|
||||||
fn from_chunk(path: &Path, index: usize, chunk: &str, total: usize) -> Self {
|
fn from_chunk(path: &Path, index: usize, chunk: &str, total: usize) -> Self {
|
||||||
let source = if total > 1 {
|
let source = match total {
|
||||||
|
total_chunks if total_chunks > 1 => {
|
||||||
format!("{} (part {}/{total})", path.display(), index + 1)
|
format!("{} (part {}/{total})", path.display(), index + 1)
|
||||||
} else {
|
}
|
||||||
path.display().to_string()
|
_ => path.display().to_string(),
|
||||||
};
|
};
|
||||||
|
|
||||||
Self {
|
Self {
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue