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)
| 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 |
no test coverage detected