-
Notifications
You must be signed in to change notification settings - Fork 15
Description
`library(shiny)
library(bslib)
library(shinychat)
library(data.table)
df_mod <- ellmer::models_aws_bedrock(profile = NULL)
data.table::setDT(df_mod)
provider_name <- sort(unique(df_mod$provider))
ui <- page_fillable(
titlePanel("shinychat example"),
shiny::selectizeInput(inputId = 'provider',label= 'Select Provider',
choices=provider_name, selected='Anthropic'),
shiny::selectizeInput(inputId ='model' ,'Select Model', choices=NULL),
shiny::br(),
chat_mod_ui(
"claude",
messages = list(
"Hi! Use this chat interface to chat with AI Assistant"
)
)
)
server <- function(input, output, session) {
shiny::observeEvent(input$provider,{
shiny::req(input$provider)
mod_list <- unique(df_mod[provider==input$provider,id])
shiny::updateSelectizeInput(session = session,
inputId = 'model', choices = mod_list)
})
claude <- ellmer::chat_aws_bedrock(system_prompt = 'You are assistant in code writing for programmer. provide all the code in one block. do not need to explain the code.',
model='anthropic.claude-3-5-sonnet-20240620-v1:0'
)
chat_mod_server("claude", claude)
}
shinyApp(ui, server)
`
How can I change the model from user input in claude instance inside chat_mod_server("claude",claude)
?
Thanks in advance.