Skip to contents

load_context_embeddings_from_feather_files lets you load vector data to a feather file

Usage

load_context_embeddings_from_feather_files(filenames)

Arguments

filenames

a list of feather filenames that contain vector embeddings and text information

Value

the vector data contained in the feather file.

Details

This function provides a simple way to load vector data (embeddings) from a binary feather file, instead of using regular databases.

Examples


conn <- get_ollama_connection()

document <- "Standing proudly on the Île de la Cité in the heart of Paris, 
France's capital city, lies one of the world's most beloved and historic 
landmarks: the magnificent Notre Dame Cathedral. This Gothic masterpiece 
has been welcoming pilgrims and tourists alike for over 850 years, since its 
construction began in 1163 under King Louis VII. With its towering spires, 
stunning stained glass windows, and intricate stone carvings, this beautiful 
church is a testament to medieval architecture and engineering skill. 
Unfortunately, a devastating fire ravaged the cathedral on April 15, 2019, 
but thanks to swift action from firefighters and restoration efforts 
underway, Notre Dame continues to inspire awe in those who visit her."

writeLines(document, con = "doc1.txt")

write_vectors_to_feather_file(file_name = "doc1.feather",
vector_data = generate_document_embeddings(conn, 
document_path = "doc1.txt",
splitter = "paragraph"))

load_context_embeddings_from_feather_files(filenames = "doc1.feather")
#>      embeddings
#>          <AsIs>
#> 1: -0.02001....
#>                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                         text
#>                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                       <char>
#> 1: Standing proudly on the Île de la Cité in the heart of Paris,  France's capital city, lies one of the world's most beloved and historic  landmarks: the magnificent Notre Dame Cathedral. This Gothic masterpiece  has been welcoming pilgrims and tourists alike for over 850 years, since its  construction began in 1163 under King Louis VII. With its towering spires,  stunning stained glass windows, and intricate stone carvings, this beautiful  church is a testament to medieval architecture and engineering skill.  Unfortunately, a devastating fire ravaged the cathedral on April 15, 2019,  but thanks to swift action from firefighters and restoration efforts  underway, Notre Dame continues to inspire awe in those who visit her.