It sounds like you are using tidymodels to fit your model? Currently predict() for tidymodels only allows for a single character value in type, so only one at a time:
There are certainly different ways to work around this, though! Let me know if it is tidymodels specifically and then we can figure out the best option.
Correct. I am using tidymodels process here. I suppose one work around would be to deploy as type = "prob" then just pivot the pred columns and grab the top value.
Otherwise you would have to deploy the model API twice with unique names like "prob/predict" and "class/predict". Then depending on use case call the specific API end point.
Another option would be to create a more customized plumber file and deploy that to Connect. The function vetiver_deploy_rsconnect() goes through some steps like make a plumber file, bundle it up, send it to Connect; instead, you can do it more manually when you have more customized needs. Take a look here to see what the generated plumber files typically look like.
Say you have a model like this:
library(tidymodels)
data(two_class_dat)
fitted <-
workflow(Class ~ ., logistic_reg()) |>
fit(data = two_class_dat)
library(vetiver)
#>
#> Attaching package: 'vetiver'
#> The following object is masked from 'package:tune':
#>
#> load_pkgs
library(pins)
b <- board_connect()
#> Connecting to Posit Connect 2024.02.0 at <https://colorado.posit.co/rsc>
v <- vetiver_model(fitted, "two-class-glm")
vetiver_pin_write(b, v)
#> Writing to pin 'julia.silge/two-class-glm'