Skip to content

Use vetiver_create_rsconnect_bundle() to create an RStudio Connect model API bundle for a vetiver_model() that has been versioned and stored via vetiver_pin_write().

Usage

vetiver_create_rsconnect_bundle(
  board,
  name,
  version = NULL,
  predict_args = list(),
  filename = fs::file_temp(pattern = "bundle", ext = ".tar.gz")
)

Arguments

board

A pin board, created by board_folder(), board_rsconnect(), board_url() or another board_ function.

name

Pin name.

version

Retrieve a specific version of a pin. Use pin_versions() to find out which versions are available and when they were created.

predict_args

A list of optional arguments passed to vetiver_api() such as the endpoint path or prediction type.

filename

The path for the model API bundle to be created (can be used as the argument to connectapi::bundle_path())

Value

The location of the model API bundle filename, invisibly.

Details

This function creates a deployable bundle. See RStudio Connect docs for how to deploy this bundle, as well as the connectapi R package for how to integrate with Connect's API from R.

The two functions vetiver_create_rsconnect_bundle() and vetiver_deploy_rsconnect() are alternatives to each other, providing different strategies for deploying a vetiver model API to RStudio Connect.

Examples

library(pins)
b <- board_temp(versioned = TRUE)
cars_lm <- lm(mpg ~ ., data = mtcars)
v <- vetiver_model(cars_lm, "cars_linear")
vetiver_pin_write(b, v)
#> Creating new version '20220929T181141Z-2bb55'
#> Writing to pin 'cars_linear'
#> 
#> Create a Model Card for your published model
#>  Model Cards provide a framework for transparent, responsible reporting
#>  Use the vetiver `.Rmd` template as a place to start
#> This message is displayed once per session.

## when you pin to RStudio Connect, your pin name will be typically be like:
## "user.name/cars_linear"
vetiver_create_rsconnect_bundle(
    b,
    "cars_linear",
    predict_args = list(debug = TRUE)
)
#> Your rsconnect bundle has been created at:
#>  /tmp/RtmpsuWAgn/bundle2d5e5930c17f.tar.gz