| Vectrix | R Documentation |
Zero config. Text in, results out. One line for everything.
nameCollection name
pathStorage path
dimensionVector dimension
model_nameModel identifier
model_typeModel type
languageLanguage setting
tierStorage tier
new()Create or open a VectrixDB collection
Vectrix$new( name = "default", path = NULL, model = NULL, dimension = NULL, embed_fn = NULL, model_path = NULL, language = NULL, tier = "dense", auto_download = TRUE )
nameCollection name
pathStorage path. Defaults to a session temp directory.
modelEmbedding model: "tfidf" (default), "glove-50", "glove-100", "glove-200", "glove-300", or "word2vec"
dimensionVector dimension (auto-detected for GloVe)
embed_fnCustom embedding function: fn(texts) -> matrix
model_pathPath to pre-trained word vectors (GloVe .txt or word2vec .bin)
languageLanguage behavior: "en" (English-focused) or "ml" (multilingual/Unicode)
tierStorage tier: "dense", "hybrid", "ultimate", or "graph"
auto_downloadAutomatically download GloVe vectors if needed (default: TRUE)
\dontrun{
# Default TF-IDF embeddings (no external files needed)
db <- Vectrix$new("docs")
# With GloVe 100d word vectors (auto-downloads ~130MB)
db <- Vectrix$new("docs", model = "glove-100")
# With pre-downloaded GloVe
db <- Vectrix$new("docs", model_path = "path/to/glove.6B.100d.txt")
# Custom embedding function
db <- Vectrix$new("docs", embed_fn = my_embed_function, dimension = 768)
}
add()Add texts to the collection
Vectrix$add(texts, metadata = NULL, ids = NULL)
textsSingle text or character vector of texts
metadataOptional metadata list or list of lists
idsOptional custom IDs
Self for chaining
\dontrun{
db$add(c("text 1", "text 2"))
db$add("another text", metadata = list(source = "web"))
}
set_language()Update collection language behavior
Vectrix$set_language(language = "en")
languageLanguage behavior: "en" or "ml"
Self for chaining
search()Search the collection
Vectrix$search( query, limit = 10, mode = "hybrid", rerank = NULL, filter = NULL, diversity = 0.7 )
querySearch query text
limitNumber of results (default: 10)
modeSearch mode: "dense", "sparse", "hybrid", "ultimate"
rerankReranking method: NULL, "mmr", "exact", "cross-encoder"
filterMetadata filter
diversityDiversity parameter for MMR (0-1)
Results object with search results
\dontrun{
results <- db$search("python programming")
results <- db$search("AI", mode = "ultimate", rerank = "mmr")
print(results$top()$text)
}
delete()Delete documents by ID
Vectrix$delete(ids)
idsDocument ID(s) to delete
Self for chaining
clear()Clear all documents from collection
Vectrix$clear()
Self for chaining
count()Get number of documents
Vectrix$count()
Integer count
get()Get documents by ID
Vectrix$get(ids)
idsDocument ID(s)
List of Result objects
similar()Find similar documents to a given document
Vectrix$similar(id, limit = 10)
idDocument ID
limitNumber of results
Results object
close()Close the database connection
Vectrix$close()
print()Print Vectrix summary
Vectrix$print()
clone()The objects of this class are cloneable with this method.
Vectrix$clone(deep = FALSE)
deepWhether to make a deep clone.
## Not run:
# Create and add - ONE LINE
db <- Vectrix$new("my_docs")$add(c("Python is great", "Machine learning is fun"))
# Search - ONE LINE
results <- db$search("programming")
# Full power - STILL ONE LINE
results <- db$search("AI", mode = "ultimate") # dense + sparse + rerank
## End(Not run)
## ------------------------------------------------
## Method `Vectrix$new`
## ------------------------------------------------
## Not run:
# Default TF-IDF embeddings (no external files needed)
db <- Vectrix$new("docs")
# With GloVe 100d word vectors (auto-downloads ~130MB)
db <- Vectrix$new("docs", model = "glove-100")
# With pre-downloaded GloVe
db <- Vectrix$new("docs", model_path = "path/to/glove.6B.100d.txt")
# Custom embedding function
db <- Vectrix$new("docs", embed_fn = my_embed_function, dimension = 768)
## End(Not run)
## ------------------------------------------------
## Method `Vectrix$add`
## ------------------------------------------------
## Not run:
db$add(c("text 1", "text 2"))
db$add("another text", metadata = list(source = "web"))
## End(Not run)
## ------------------------------------------------
## Method `Vectrix$search`
## ------------------------------------------------
## Not run:
results <- db$search("python programming")
results <- db$search("AI", mode = "ultimate", rerank = "mmr")
print(results$top()$text)
## End(Not run)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.