MCPcopy Create free account
hub / github.com/Harry-027/DocuMind / process_file

Method process_file

server/src/processor.rs:30–37  ·  view source on GitHub ↗

process_file splits the text into chunks so to generate the embeddings for proper context length and saves them to the db

(&self, file_name: &str)

Source from the content-addressed store, hash-verified

28 // process_file splits the text into chunks so to generate the embeddings
29 // for proper context length and saves them to the db
30 pub async fn process_file(&self, file_name: &str) -> Result<()> {
31 let chunks = self.process_chunks(file_name)?;
32 let embeddings = self.process_embeddings(chunks.to_owned()).await.unwrap();
33 let coll_name = file_name.split_once(".pdf").unwrap().0;
34 self.save_embeddings(coll_name, embeddings.to_owned())
35 .await?;
36 Ok(())
37 }
38
39 // process_prompt gets the similar cosine embeddings for the user prompt
40 // and sets the context for LLM to get the result generated as per the context

Callers 1

upload_fileFunction · 0.80

Calls 3

process_chunksMethod · 0.80
process_embeddingsMethod · 0.80
save_embeddingsMethod · 0.80

Tested by

no test coverage detected