Zero config. Text in, results out. One line for everything.
Public fields
nameCollection name
pathStorage path
dimensionVector dimension
model_nameModel identifier
model_typeModel type
languageLanguage setting
tierStorage tier
Methods
Method new()
Create or open a VectrixDB collection
Usage
Vectrix$new(
name = "default",
path = NULL,
model = NULL,
dimension = NULL,
embed_fn = NULL,
model_path = NULL,
language = NULL,
tier = "dense",
auto_download = TRUE
)Arguments
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)
Examples
\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)
}
Method add()
Add texts to the collection
Method search()
Search the collection
Usage
Vectrix$search(
query,
limit = 10,
mode = "hybrid",
rerank = NULL,
filter = NULL,
diversity = 0.7
)Method get()
Get documents by ID
Examples
if (FALSE) { # \dontrun{
# 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
} # }
## ------------------------------------------------
## Method `Vectrix$new`
## ------------------------------------------------
if (FALSE) { # \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)
} # }
## ------------------------------------------------
## Method `Vectrix$add`
## ------------------------------------------------
if (FALSE) { # \dontrun{
db$add(c("text 1", "text 2"))
db$add("another text", metadata = list(source = "web"))
} # }
## ------------------------------------------------
## Method `Vectrix$search`
## ------------------------------------------------
if (FALSE) { # \dontrun{
results <- db$search("python programming")
results <- db$search("AI", mode = "ultimate", rerank = "mmr")
print(results$top()$text)
} # }