(
&self,
folder: &ExistingGraphFolder,
template: &DocumentTemplate,
model: CachedEmbeddingModel,
)
| 509 | } |
| 510 | |
| 511 | pub(crate) async fn vectorise_folder( |
| 512 | &self, |
| 513 | folder: &ExistingGraphFolder, |
| 514 | template: &DocumentTemplate, |
| 515 | model: CachedEmbeddingModel, |
| 516 | ) -> Result<(), GQLError> { |
| 517 | let cloned_folder = folder.clone(); |
| 518 | self.cache |
| 519 | .insert_or_replace_with(folder.local_path(), move |old_graph| async { |
| 520 | let graph = match old_graph { |
| 521 | None => self |
| 522 | .read_graph_from_disk_inner(cloned_folder.clone()) |
| 523 | .await? |
| 524 | .graph() |
| 525 | .clone(), |
| 526 | Some(old_graph) => old_graph.graph().clone(), |
| 527 | }; |
| 528 | let vectors = self |
| 529 | .vectorise_with_template(graph.clone(), folder, template, model) |
| 530 | .await; |
| 531 | Ok::<_, GQLError>(GraphWithVectors::new(graph, vectors, cloned_folder)) |
| 532 | }) |
| 533 | .await?; |
| 534 | Ok(()) |
| 535 | } |
| 536 | |
| 537 | pub async fn get_all_graph_folders(&self) -> impl Iterator<Item = ExistingGraphFolder> { |
| 538 | let work_dir = self.work_dir_read().await; |
no test coverage detected