posit-dev / posit-dev/shinychat

Select different model from UI from selection of bedrock models

Open
#63 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
TypeScript
Stars
139
Forks
28
Avg merge
23h 44m
Merged PRs (30d)
50

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) ?

Image

Thanks in advance.

Contributor guide

No contributing guide indexed for this repository

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start by tracing the chat_aws_bedrock construction and chat_mod_server("claude", claude) entry points shown in the issue, then inspect how the selected model is used. Determine whether the provider and model inputs can control the active chat instance, and consider the work complete when a user selection changes the model used by the chat without breaking the existing Shiny example.

Written by the indexing model from the issue text.

Assessment

Tech stack
aws, r
Domain
ai, frontend
Issue type
Feature
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.