Integration
diff --git a/search.json b/search.json
index 5320907..0f18c9c 100644
--- a/search.json
+++ b/search.json
@@ -1 +1 @@
-[{"path":"https://mlverse.github.io/chattr/LICENSE.html","id":null,"dir":"","previous_headings":"","what":"MIT License","title":"MIT License","text":"Copyright (c) 2023 chattr authors Permission hereby granted, free charge, person obtaining copy software associated documentation files (“Software”), deal Software without restriction, including without limitation rights use, copy, modify, merge, publish, distribute, sublicense, /sell copies Software, permit persons Software furnished , subject following conditions: copyright notice permission notice shall included copies substantial portions Software. SOFTWARE PROVIDED “”, WITHOUT WARRANTY KIND, EXPRESS IMPLIED, INCLUDING LIMITED WARRANTIES MERCHANTABILITY, FITNESS PARTICULAR PURPOSE NONINFRINGEMENT. EVENT SHALL AUTHORS COPYRIGHT HOLDERS LIABLE CLAIM, DAMAGES LIABILITY, WHETHER ACTION CONTRACT, TORT OTHERWISE, ARISING , CONNECTION SOFTWARE USE DEALINGS SOFTWARE.","code":""},{"path":"https://mlverse.github.io/chattr/articles/backend-llamagpt.html","id":"intro","dir":"Articles","previous_headings":"","what":"Intro","title":"Interact with local models","text":"LlamaGPT-Chat command line chat application. integrates LLM via C++. means work LLM’s language. available today free download use. C++, models able run locally computer, even GPU available. models quite fast responses. integrating LlamaGPT-Chat, able access multiple types LLM’s one additional back-end within chattr.","code":""},{"path":"https://mlverse.github.io/chattr/articles/backend-llamagpt.html","id":"installation","dir":"Articles","previous_headings":"","what":"Installation","title":"Interact with local models","text":"get LlamaGPT-Chat working machine need two things: version LlamaGPT-Chat works computer LLM file works chat program","code":""},{"path":"https://mlverse.github.io/chattr/articles/backend-llamagpt.html","id":"install-llamagpt-chat","dir":"Articles","previous_headings":"Installation","what":"Install LLamaGPT-Chat","title":"Interact with local models","text":"LlamaGPT-Chat need “compiled binary” specific Operating System. example, Windows, compiled binary .exe file. GitHub repository offers pre-compiled binaries can download use: Releases. Depending system’s security, pre-compiled program may blocked running. case, need “build” program computer. instructions .","code":""},{"path":"https://mlverse.github.io/chattr/articles/backend-llamagpt.html","id":"llm-file","dir":"Articles","previous_headings":"Installation","what":"LLM file","title":"Interact with local models","text":"GitHub repository contains list compatible models. Download least one models, make note saved computer.","code":""},{"path":"https://mlverse.github.io/chattr/articles/backend-llamagpt.html","id":"setup","dir":"Articles","previous_headings":"","what":"Setup","title":"Interact with local models","text":"start, instruct chattr switch LLamaGPT back-end using chattr_use() first time use interface, confirm path compiled program, model matches machine. check use chattr_defaults() either, , paths incorrect, correct updating path, model arguments chattr_defaults() need change defaults every time start new R session, use chattr_defaults_save(). create YAML file working directory. chattr use file override defaults. Use chattr_test() confirm chattr able communicate LLamaGPT-Chat, model use R session accessible","code":"library(chattr) chattr_use(\"llamagpt\") #> #> ── chattr #> • Provider: LlamaGPT #> • Path/URL: ~/LlamaGPTJ-chat/build/bin/chat #> • Model: ~/ggml-gpt4all-j-v1.3-groovy.bin #> • Label: GPT4ALL 1.3 (LlamaGPT) chattr_defaults() #> #> ── chattr ────────────────────────────────────────────────────────────────────── #> #> ── Defaults for: Default ── #> #> ── Prompt: #> • Use the R language, the tidyverse, and tidymodels #> #> ── Model #> • Provider: LlamaGPT #> • Path/URL: ~/LlamaGPTJ-chat/build/bin/chat #> • Model: ~/ggml-gpt4all-j-v1.3-groovy.bin #> • Label: GPT4ALL 1.3 (LlamaGPT) #> #> ── Model Arguments: #> • threads: 4 #> • temp: 0.01 #> • n_predict: 1000 #> #> ── Context: #> Max Data Files: 0 #> Max Data Frames: 0 #> ✖ Chat History #> ✖ Document contents chattr_defaults(path = \"[path to compiled program]\", model = \"[path to model]\") #> #> ── chattr ────────────────────────────────────────────────────────────────────── #> #> ── Defaults for: Default ── #> #> ── Prompt: #> • Use the R language, the tidyverse, and tidymodels #> #> ── Model #> • Provider: LlamaGPT #> • Path/URL: [path to compiled program] #> • Model: [path to model] #> • Label: GPT4ALL 1.3 (LlamaGPT) #> #> ── Model Arguments: #> • threads: 4 #> • temp: 0.01 #> • n_predict: 1000 #> #> ── Context: #> Max Data Files: 0 #> Max Data Frames: 0 #> ✖ Chat History #> ✖ Document contents chattr_defaults_save() chattr_test() #> ✔ Model started sucessfully #> ✔ Model session closed sucessfully"},{"path":"https://mlverse.github.io/chattr/articles/backend-llamagpt.html","id":"model-arguments","dir":"Articles","previous_headings":"","what":"Model Arguments","title":"Interact with local models","text":"arguments sent model can modified chattr_defaults() modifying model_arguments argument. expects list object. arguments sets default: example adding batch_size defaults: see current list available model arguments go : Detailed command list. IMPORTANT - chattr passes arguments directly LLamaGPT-chat command line flag, except model. chattr use value chattr_defaults(model = \"[path model]\") instead.","code":"chattr_defaults()$model_arguments #> $threads #> [1] 4 #> #> $temp #> [1] 0.01 #> #> $n_predict #> [1] 1000 chattr_defaults(model_arguments = list(batch_size = 40)) #> #> ── chattr ────────────────────────────────────────────────────────────────────── #> #> ── Defaults for: Default ── #> #> ── Prompt: #> • Use the R language, the tidyverse, and tidymodels #> #> ── Model #> • Provider: LlamaGPT #> • Path/URL: [path to compiled program] #> • Model: [path to model] #> • Label: GPT4ALL 1.3 (LlamaGPT) #> #> ── Model Arguments: #> • batch_size: 40 #> • threads: 4 #> • temp: 0.01 #> • n_predict: 1000 #> #> ── Context: #> Max Data Files: 0 #> Max Data Frames: 0 #> ✖ Chat History #> ✖ Document contents"},{"path":"https://mlverse.github.io/chattr/articles/copilot-chat.html","id":"intro","dir":"Articles","previous_headings":"","what":"Intro","title":"Interact with GitHub Copilot Chat","text":"introduction docs.github.com: GitHub Copilot Chat chat interface lets interact GitHub Copilot, ask receive answers coding-related questions within GitHub.com supported IDEs. chat interface provides access coding information support without requiring navigate documentation search online forums.","code":""},{"path":"https://mlverse.github.io/chattr/articles/copilot-chat.html","id":"rstudio","dir":"Articles","previous_headings":"","what":"RStudio","title":"Interact with GitHub Copilot Chat","text":"RStudio’s integration Copilot needs enabled, setup, order chattr work. due complexity authenticating Copilot Chat. yet setup GitHub Copilot RStudio IDE, instructions: https://docs.posit.co/ide/user/ide/guide/tools/copilot.html","code":""},{"path":"https://mlverse.github.io/chattr/articles/copilot-chat.html","id":"test-connection","dir":"Articles","previous_headings":"","what":"Test connection","title":"Interact with GitHub Copilot Chat","text":"Use chattr_test() function confirm connection works:","code":"library(chattr) chattr_use(\"copilot\") chattr_test() #> ── Testing chattr #> • Provider: OpenAI - Copilot Chat #> • Path/URL: https://api.githubcopilot.com/chat/completions #> • Model: #> ✔ Connection with GitHub Copilot cofirmed #> |--Prompt: Hi! #> |--Response: Hello! How can I assist you today?"},{"path":"https://mlverse.github.io/chattr/articles/openai-gpt.html","id":"intro","dir":"Articles","previous_headings":"","what":"Intro","title":"Interact with OpenAI GPT models","text":"OpenAI’s GPT models possibly widely used LLM today. Typically, interaction models via chatting inside OpenAI’s web portal. also offer REST API endpoint can use communicate LLM’s. chattr able send receive correct API calls make “chatting” experience GPT models seamless.","code":""},{"path":"https://mlverse.github.io/chattr/articles/openai-gpt.html","id":"secret-key","dir":"Articles","previous_headings":"","what":"Secret key","title":"Interact with OpenAI GPT models","text":"OpenAI requires secret key authenticate user. required application non-OpenAI application, chattr, one order function. key long alphanumeric sequence. sequence created OpenAI portal. obtain secret key, follow link: OpenAI API Keys default, chattr look secret key inside Environment Variable called OPENAI_API_KEY. packages integrate OpenAI use variable name. Use Sys.setenv() set variable. downside using method variable available current R session: preferred method save secret key .Renviron file. way, need load environment variable every time start new R session. .Renviron file available home directory. example entry:","code":"Sys.setenv(\"OPENAI_API_KEY\" = \"####################\") OPENAI_API_KEY=####################"},{"path":"https://mlverse.github.io/chattr/articles/openai-gpt.html","id":"test-connection","dir":"Articles","previous_headings":"","what":"Test connection","title":"Interact with OpenAI GPT models","text":"Use chattr_test() function confirm connection works:","code":"library(chattr) chattr_test() ✔ Connection with OpenAI cofirmed ✔ Access to models confirmed"},{"path":"https://mlverse.github.io/chattr/articles/openai-gpt.html","id":"change-the-model","dir":"Articles","previous_headings":"","what":"Change the model","title":"Interact with OpenAI GPT models","text":"default, chattr setup interact GPT 4 (gpt-4). switch 3.5, use: switch back GPT 4, run: see latest list endpoint use, go : Model Endpoint Compatability","code":"library(chattr) chattr_use(\"gpt35\") #> #> ── chattr #> • Provider: OpenAI - Chat Completions #> • Path/URL: https://api.openai.com/v1/chat/completions #> • Model: gpt-3.5-turbo #> • Label: GPT 3.5 (OpenAI) chattr_use(\"gpt4\") #> #> ── chattr #> • Provider: OpenAI - Chat Completions #> • Path/URL: https://api.openai.com/v1/chat/completions #> • Model: gpt-4 #> • Label: GPT 4 (OpenAI)"},{"path":"https://mlverse.github.io/chattr/articles/openai-gpt.html","id":"data-files-and-data-frames","dir":"Articles","previous_headings":"","what":"Data files and data frames","title":"Interact with OpenAI GPT models","text":"information environment work space, default chattr avoids sending data files, data frame information OpenAI. Sending information convenient creates shorthand requests. wish submit information part prompts, use chattr_defaults(), example: chattr_defaults(max_data_files = 10) chattr_defaults(max_data_frames = 10) two commands send 10 data frames, 10 data files part prompt. can decide number limit . send, larger prompt. set anything 0, warning show every time start Shiny app:","code":"• Provider: Open AI - Chat Completions • Path/URL: https://api.openai.com/v1/chat/completions • Model: gpt-3.5-turbo ! A list of the top 10 files will be sent externally to OpenAI with every request To avoid this, set the number of files to be sent to 0 using chattr::chattr_defaults(max_data_files = 0)Î"},{"path":"https://mlverse.github.io/chattr/articles/other-interfaces.html","id":"output","dir":"Articles","previous_headings":"","what":"Output","title":"Other interfaces","text":"Based making request , chattr return response appropriately following manner: request made R console, response returned console message, R code (cat()). way, can decide copy-paste code run. also prevent comments LLM cause error. request made script, code chunk Quarto (Visual editor), output inserted right prompt document.","code":""},{"path":"https://mlverse.github.io/chattr/articles/other-interfaces.html","id":"using-the-chattr-function","dir":"Articles","previous_headings":"","what":"Using the chattr() function","title":"Other interfaces","text":"fastest way interact LLM simply calling chattr() function enter request . example request made OpenAI:","code":"library(chattr) chattr(\"show me a simple recipe\") # Load required packages library(tidymodels) # Create a simple recipe for the iris dataset iris_recipe <- recipe(Species ~ ., data = iris) # Print the recipe iris_recipe"},{"path":"https://mlverse.github.io/chattr/articles/other-interfaces.html","id":"highlight-the-request-in-a-script","dir":"Articles","previous_headings":"","what":"Highlight the request in a script","title":"Other interfaces","text":"script, chattr process current line, highlighted line(s), prompt. assume request going code, chattr comment line lines highlighted. mentioned Output section, response inserted document. example request submitted OpenAI: results:","code":"Create a function that: - Removes specified variables - Behaves like dplyr's select function # Create a function that: # - Removes specified variables # - Behaves like dplyr's select function # This function removes specified variables and behaves like dplyr's select function # It uses the tidyverse packages: dplyr and tidyr remove_vars <- function(data, ...) { data %>% select(-one_of(...)) } }"},{"path":"https://mlverse.github.io/chattr/articles/prompt_defaults.html","id":"support-for-glue","dir":"Articles","previous_headings":"","what":"Support for glue","title":"Modify prompt enhancements","text":"prompt argument supports glue. means can pass current values variables, current output functions within current R session. Make sure output, value, character readable LLM. simple example function passes variables currently R session contain “x”: my_list() function passed prompt argument enclosed braces: Now can test , setting two variables start “x” see sent LLM, can use chattr(preview = TRUE). two variables listed part prompt: can see adding new variable modify prompt us modify chattr_defaults():","code":"my_list <- function() { return(ls(pattern = \"x\", envir = globalenv())) } chattr_defaults(prompt = \"{ my_list() }\") #> #> ── chattr ────────────────────────────────────────────────────────────────────── #> #> ── Defaults for: Default ── #> #> ── Prompt: #> • {{ my_list() }} #> #> ── Model #> • Provider: OpenAI - Chat Completions #> • Path/URL: https://api.openai.com/v1/chat/completions #> • Model: gpt-4 #> • Label: GPT 4 (OpenAI) #> #> ── Model Arguments: #> • temperature: 0.01 #> • max_tokens: 1000 #> • stream: TRUE #> #> ── Context: #> Max Data Files: 0 #> Max Data Frames: 0 #> ✔ Chat History #> ✖ Document contents x1 <- 1 x2 <- 2 chattr(preview = TRUE) #> #> ── chattr ────────────────────────────────────────────────────────────────────── #> #> ── Preview for: Console #> • Provider: OpenAI - Chat Completions #> • Path/URL: https://api.openai.com/v1/chat/completions #> • Model: gpt-4 #> • Label: GPT 4 (OpenAI) #> • temperature: 0.01 #> • max_tokens: 1000 #> • stream: TRUE #> #> ── Prompt: #> role: system #> content: You are a helpful coding assistant #> role: user #> content: #> * Use the 'Tidy Modeling with R' (https://www.tmwr.org/) book as main reference #> * Use the 'R for Data Science' (https://r4ds.had.co.nz/) book as main reference #> * Use tidyverse packages: readr, ggplot2, dplyr, tidyr #> * For models, use tidymodels packages: recipes, parsnip, yardstick, workflows, #> broom #> * Avoid explanations unless requested by user, expecting code only #> * For any line that is not code, prefix with a: # #> * Keep each line of explanations to no more than 80 characters #> * DO NOT use Markdown for the code #> [Your future prompt goes here] x3 <- 3 chattr(preview = TRUE) #> #> ── chattr ────────────────────────────────────────────────────────────────────── #> #> ── Preview for: Console #> • Provider: OpenAI - Chat Completions #> • Path/URL: https://api.openai.com/v1/chat/completions #> • Model: gpt-4 #> • Label: GPT 4 (OpenAI) #> • temperature: 0.01 #> • max_tokens: 1000 #> • stream: TRUE #> #> ── Prompt: #> role: system #> content: You are a helpful coding assistant #> role: user #> content: #> * Use the 'Tidy Modeling with R' (https://www.tmwr.org/) book as main reference #> * Use the 'R for Data Science' (https://r4ds.had.co.nz/) book as main reference #> * Use tidyverse packages: readr, ggplot2, dplyr, tidyr #> * For models, use tidymodels packages: recipes, parsnip, yardstick, workflows, #> broom #> * Avoid explanations unless requested by user, expecting code only #> * For any line that is not code, prefix with a: # #> * Keep each line of explanations to no more than 80 characters #> * DO NOT use Markdown for the code #> [Your future prompt goes here]"},{"path":"https://mlverse.github.io/chattr/authors.html","id":null,"dir":"","previous_headings":"","what":"Authors","title":"Authors and Citation","text":"Edgar Ruiz. Author, maintainer. Posit Software, PBC. Copyright holder, funder.","code":""},{"path":"https://mlverse.github.io/chattr/authors.html","id":"citation","dir":"","previous_headings":"","what":"Citation","title":"Authors and Citation","text":"Ruiz E (2024). chattr: Integrates LLM's RStudio IDE. R package version 0.0.0.9010, https://mlverse.github.io/chattr/, https://github.com/mlverse/chattr.","code":"@Manual{, title = {chattr: Integrates LLM's with the RStudio IDE}, author = {Edgar Ruiz}, year = {2024}, note = {R package version 0.0.0.9010, https://mlverse.github.io/chattr/}, url = {https://github.com/mlverse/chattr}, }"},{"path":"https://mlverse.github.io/chattr/index.html","id":"chattr","dir":"","previous_headings":"","what":"Integrates LLM's with the RStudio IDE","title":"Integrates LLM's with the RStudio IDE","text":"Intro Install Available models App Additional ways interact works setup keyboard shortcut","code":""},{"path":"https://mlverse.github.io/chattr/index.html","id":"intro","dir":"","previous_headings":"","what":"Intro","title":"Integrates LLM's with the RStudio IDE","text":"chattr interface LLMs (Large Language Models). enables interaction model directly RStudio IDE. chattr allows submit prompt LLM script, using provided Shiny Gadget. package’s main goal aid exploratory data analysis (EDA) tasks. additional information appended request, provides sort “guard rails”, packages techniques usually recommend best practice, used model’s responses.","code":""},{"path":"https://mlverse.github.io/chattr/index.html","id":"install","dir":"","previous_headings":"","what":"Install","title":"Integrates LLM's with the RStudio IDE","text":"Since early version package install package GitHub:","code":"remotes::install_github(\"mlverse/chattr\")"},{"path":"https://mlverse.github.io/chattr/index.html","id":"available-models","dir":"","previous_headings":"","what":"Available models","title":"Integrates LLM's with the RStudio IDE","text":"chattr provides two main integration two main LLM back-ends. back-end provides access multiple LLM types. plan add back-ends time goes :","code":""},{"path":[]},{"path":"https://mlverse.github.io/chattr/index.html","id":"the-app","dir":"","previous_headings":"Using","what":"The App","title":"Integrates LLM's with the RStudio IDE","text":"main way use chattr Shiny Gadget app. default, RStudio app run inside Viewer pane. chattr prompt select model back-end use. list actual models depend setup . model setup found, return error. receive error, please refer previous section learn setup model back-end machine. example selection prompt look like: prompt occurs first time call chattr_app(), chattr(). close app, open , app use model initially selected. selection set rest R session, manually change . Please note , example, chattr find setup OpenAI, lines show options actual prompt. wish avoid interactive prompt, call chattr_use() designate model wish use calling app. can also use chattr_use() change model back-end interacting R session: Screenshot Sniny gadget app dark mode RStudio theme LLM finishes response, chattr app processes markdown code chunks. place three convenience buttons: Copy clipboard - write code inside chunk clipboard. Copy document - copy-paste code directly app called . app started working script, chattr copy code script. Copy new script - creates new R script RStudio IDE, copies content chunk directly . useful LLM writes Shiny app lot effort put make app’s appearance close possible IDE. way feels integrated work space. includes switching color scheme based current RStudio theme light, dark. settings screen can accessed clicking “gear” button. screen opens contain following: Save Open chats - early experiment allow us save retrieve past chats. chattr save file RDS format. main objective feature, able see past chats, continue previous conversations LLM. Prompt settings - section can change additional information attached prompt. Including number max data files, data frames sent LLM. Screenshot Sniny gadget options","code":"chattr::chattr_app() #> ── chattr - Available models #> #> 1: GitHub - Copilot Chat - (copilot) #> 2: OpenAI - Chat Completions - gpt-3.5-turbo (gpt35) #> 3: OpenAI - Chat Completions - gpt-4 (gpt4) #> 4: LlamaGPT - ~/ggml-gpt4all-j-v1.3-groovy.bin (llamagpt) #> #> Select the number of the model you would like to use: chattr_use(\"gpt35\") chattr_app()"},{"path":"https://mlverse.github.io/chattr/index.html","id":"additional-ways-to-interact","dir":"","previous_headings":"Using","what":"Additional ways to interact","title":"Integrates LLM's with the RStudio IDE","text":"Apart Shiny app, chattr provides two ways interact LLM. details, see: interfaces","code":""},{"path":"https://mlverse.github.io/chattr/index.html","id":"how-it-works","dir":"","previous_headings":"","what":"How it works","title":"Integrates LLM's with the RStudio IDE","text":"chattr enriches request additional instructions, name structure data frames currently environment, path data files working directory. supported model, chattr include current chat history. Diagram illustrates chattr handles model requests see chattr send model, set preview argument TRUE:","code":"library(chattr) data(mtcars) data(iris) chattr_use(\"gpt4\") #> #> ── chattr #> • Provider: OpenAI - Chat Completions #> • Path/URL: https://api.openai.com/v1/chat/completions #> • Model: gpt-4 #> • Label: GPT 4 (OpenAI) chattr(preview = TRUE) #> #> ── chattr ────────────────────────────────────────────────────────────────────── #> #> ── Preview for: Console #> • Provider: OpenAI - Chat Completions #> • Path/URL: https://api.openai.com/v1/chat/completions #> • Model: gpt-4 #> • Label: GPT 4 (OpenAI) #> • temperature: 0.01 #> • max_tokens: 1000 #> • stream: TRUE #> #> ── Prompt: #> role: system #> content: You are a helpful coding assistant #> role: user #> content: #> * Use the 'Tidy Modeling with R' (https://www.tmwr.org/) book as main reference #> * Use the 'R for Data Science' (https://r4ds.had.co.nz/) book as main reference #> * Use tidyverse packages: readr, ggplot2, dplyr, tidyr #> * For models, use tidymodels packages: recipes, parsnip, yardstick, workflows, #> broom #> * Avoid explanations unless requested by user, expecting code only #> * For any line that is not code, prefix with a: # #> * Keep each line of explanations to no more than 80 characters #> * DO NOT use Markdown for the code #> [Your future prompt goes here]"},{"path":"https://mlverse.github.io/chattr/index.html","id":"keyboard-shortcut","dir":"","previous_headings":"","what":"Keyboard Shortcut","title":"Integrates LLM's with the RStudio IDE","text":"best way access chattr’s app setting keyboard shortcut . package includes RStudio Addin gives us direct access app, turn, allows keyboard shortcut assigned addin. name addin : “Open Chat”. familiar assign keyboard shortcut see next section.","code":""},{"path":"https://mlverse.github.io/chattr/index.html","id":"how-to-setup-the-keyboard-shortcut","dir":"","previous_headings":"Keyboard Shortcut","what":"How to setup the keyboard shortcut","title":"Integrates LLM's with the RStudio IDE","text":"Select Tools top menu, select Modify Keyboard Shortcuts Screenshot shows find option modify keyboard shortcuts Search chattr adding writing “open chat”, search box Screenshot shows input addin search select key combination shortcut, click Shortcut box type press key combination keyboard. case, chose Ctrl+Shift+C Screenshot shows interface looks like shortcut selected","code":""},{"path":"https://mlverse.github.io/chattr/reference/ch_history.html","id":null,"dir":"Reference","previous_headings":"","what":"Displays the current session' chat history — ch_history","title":"Displays the current session' chat history — ch_history","text":"Displays current session' chat history","code":""},{"path":"https://mlverse.github.io/chattr/reference/ch_history.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Displays the current session' chat history — ch_history","text":"","code":"ch_history(x = NULL)"},{"path":"https://mlverse.github.io/chattr/reference/ch_history.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"Displays the current session' chat history — ch_history","text":"x list object contains chat history. Use argument override current history.","code":""},{"path":"https://mlverse.github.io/chattr/reference/ch_submit.html","id":null,"dir":"Reference","previous_headings":"","what":"Method to easily integrate to new LLM API's — ch_submit","title":"Method to easily integrate to new LLM API's — ch_submit","text":"Method easily integrate new LLM API's","code":""},{"path":"https://mlverse.github.io/chattr/reference/ch_submit.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Method to easily integrate to new LLM API's — ch_submit","text":"","code":"ch_submit( defaults, prompt = NULL, stream = NULL, prompt_build = TRUE, preview = FALSE, ... )"},{"path":"https://mlverse.github.io/chattr/reference/ch_submit.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"Method to easily integrate to new LLM API's — ch_submit","text":"defaults Defaults object, generally puled chattr_defaults() prompt prompt send LLM stream output response LLM happens, wait response complete. Defaults TRUE. prompt_build Include context additional prompt part request preview Primarily used debugging. indicates send prompt LLM (FALSE), print resulting prompt (TRUE) ... Optional arguments; currently unused.","code":""},{"path":"https://mlverse.github.io/chattr/reference/ch_submit.html","id":"details","dir":"Reference","previous_headings":"","what":"Details","title":"Method to easily integrate to new LLM API's — ch_submit","text":"Use function integrate LLM API. requirements get work properly: output function needs parsed response LLM support streaming, make sure use cat() function output response LLM API happening. preview set TRUE, send LLM API. Simply return resulting prompt. defaults argument controls method use. can use chattr_defaults() function, set provider. provider value creates R class name. pre-pend cl_ class name. See examples clarity.","code":""},{"path":"https://mlverse.github.io/chattr/reference/ch_submit.html","id":"ref-examples","dir":"Reference","previous_headings":"","what":"Examples","title":"Method to easily integrate to new LLM API's — ch_submit","text":"","code":"if (FALSE) { library(chattr) ch_submit.ch_my_llm <- function(defaults, prompt = NULL, stream = NULL, prompt_build = TRUE, preview = FALSE, ...) { # Use `prompt_build` to append the prompts you with to append if(prompt_build) prompt <- paste0(\"Use the tidyverse\\n\", prompt) # If `preview` is true, return the resulting prompt back if(preview) return(prompt) llm_response <- paste0(\"You said this: \\n\", prompt) if(stream) { cat(\"streaming:\\n\") for(i in seq_len(nchar(llm_response))) { # If `stream` is true, make sure to `cat()` the current output cat(substr(llm_response, i, i)) Sys.sleep(0.1) } } # Make sure to return the entire output from the LLM at the end llm_response } chattr_defaults(\"console\", provider = \"my llm\") chattr(\"hello\") chattr(\"hello\", stream = FALSE) chattr(\"hello\", prompt_build = FALSE) chattr(\"hello\", preview = TRUE) }"},{"path":"https://mlverse.github.io/chattr/reference/chattr.html","id":null,"dir":"Reference","previous_headings":"","what":"Submits prompt to LLM — chattr","title":"Submits prompt to LLM — chattr","text":"Submits prompt LLM","code":""},{"path":"https://mlverse.github.io/chattr/reference/chattr.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Submits prompt to LLM — chattr","text":"","code":"chattr(prompt = NULL, preview = FALSE, prompt_build = TRUE, stream = NULL)"},{"path":"https://mlverse.github.io/chattr/reference/chattr.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"Submits prompt to LLM — chattr","text":"prompt Request send LLM. Defaults NULL preview Primarily used debugging. indicates send prompt LLM (FALSE), print resulting prompt (TRUE) prompt_build Include context additional prompt part request stream output response LLM happens, wait response complete. Defaults TRUE.","code":""},{"path":"https://mlverse.github.io/chattr/reference/chattr.html","id":"value","dir":"Reference","previous_headings":"","what":"Value","title":"Submits prompt to LLM — chattr","text":"output LLM console, document script.","code":""},{"path":"https://mlverse.github.io/chattr/reference/chattr.html","id":"ref-examples","dir":"Reference","previous_headings":"","what":"Examples","title":"Submits prompt to LLM — chattr","text":"","code":"library(chattr) chattr_use(\"test\") #> #> ── chattr #> • Provider: test backend #> • Path/URL: #> • Model: Test model #> • Label: Test chattr(\"hello\") #> hello chattr(\"hello\", preview = TRUE) #> hello #> #> ── chattr ────────────────────────────────────────────────────────────────────── #> #> ── Preview for: Console #> • Provider: test backend #> • Path/URL: #> • Model: Test model #> • Label: Test #> • n_predict: 1000 #> #> ── Prompt: #> hello"},{"path":"https://mlverse.github.io/chattr/reference/chattr_app.html","id":null,"dir":"Reference","previous_headings":"","what":"Starts a Shiny app interface to the LLM — chattr_app","title":"Starts a Shiny app interface to the LLM — chattr_app","text":"Starts Shiny app interface LLM","code":""},{"path":"https://mlverse.github.io/chattr/reference/chattr_app.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Starts a Shiny app interface to the LLM — chattr_app","text":"","code":"chattr_app( viewer = c(\"viewer\", \"dialog\"), as_job = getOption(\"chattr.as_job\", FALSE), as_job_port = getOption(\"shiny.port\", 7788), as_job_host = getOption(\"shiny.host\", \"127.0.0.1\") )"},{"path":"https://mlverse.github.io/chattr/reference/chattr_app.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"Starts a Shiny app interface to the LLM — chattr_app","text":"viewer Specifies Shiny app going display as_job App runs RStudio IDE Job. Defaults FALSE. set TRUE, Shiny app able transfer code blocks directly document, console, IDE. as_job_port Port use Shiny app. Applicable as_job set TRUE. as_job_host Host IP use Shiny app. Applicable as_job set TRUE.","code":""},{"path":"https://mlverse.github.io/chattr/reference/chattr_app.html","id":"value","dir":"Reference","previous_headings":"","what":"Value","title":"Starts a Shiny app interface to the LLM — chattr_app","text":"chat interface inside 'RStudio' IDE","code":""},{"path":"https://mlverse.github.io/chattr/reference/chattr_defaults.html","id":null,"dir":"Reference","previous_headings":"","what":"Default arguments to use when making requests to the LLM — chattr_defaults","title":"Default arguments to use when making requests to the LLM — chattr_defaults","text":"Default arguments use making requests LLM","code":""},{"path":"https://mlverse.github.io/chattr/reference/chattr_defaults.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Default arguments to use when making requests to the LLM — chattr_defaults","text":"","code":"chattr_defaults( type = \"default\", prompt = NULL, max_data_files = NULL, max_data_frames = NULL, include_doc_contents = NULL, include_history = NULL, provider = NULL, path = NULL, model = NULL, model_arguments = NULL, system_msg = NULL, yaml_file = \"chattr.yml\", force = FALSE, label = NULL, ... )"},{"path":"https://mlverse.github.io/chattr/reference/chattr_defaults.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"Default arguments to use when making requests to the LLM — chattr_defaults","text":"type Entry point interact model. Accepted values: 'notebook', chat' prompt Request send LLM. Defaults NULL max_data_files Sets maximum number data files send model. defaults 20. send , set NULL max_data_frames Sets maximum number data frames loaded current R session send model. defaults 20. send , set NULL include_doc_contents Send current code document include_history Indicates whether include chat history everytime new prompt submitted provider name provider LLM. Today, \"openai\" available path location model. URL file path. model name path model use. model_arguments Additional arguments pass model part request, requires list. Examples arguments: temperature, top_p, max_tokens system_msg OpenAI GPT 3.5 , system message send part request yaml_file path valid config YAML file contains defaults use session force Re-process base work space level file defaults label Label display Shiny app, locations ... Additional model arguments standard models/backends","code":""},{"path":"https://mlverse.github.io/chattr/reference/chattr_defaults.html","id":"value","dir":"Reference","previous_headings":"","what":"Value","title":"Default arguments to use when making requests to the LLM — chattr_defaults","text":"'ch_model' object contains current defaults used communicate LLM.","code":""},{"path":"https://mlverse.github.io/chattr/reference/chattr_defaults.html","id":"details","dir":"Reference","previous_headings":"","what":"Details","title":"Default arguments to use when making requests to the LLM — chattr_defaults","text":"idea use addin shortcut execute request, arguments can controlled via function. default, try load defaults config YAML file, none found, defaults GPT 3.5 used. defaults can modified calling function, even interactive session started.","code":""},{"path":"https://mlverse.github.io/chattr/reference/chattr_defaults_save.html","id":null,"dir":"Reference","previous_headings":"","what":"Saves the current defaults in a yaml file that is compatible with\nthe config package — chattr_defaults_save","title":"Saves the current defaults in a yaml file that is compatible with\nthe config package — chattr_defaults_save","text":"Saves current defaults yaml file compatible config package","code":""},{"path":"https://mlverse.github.io/chattr/reference/chattr_defaults_save.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Saves the current defaults in a yaml file that is compatible with\nthe config package — chattr_defaults_save","text":"","code":"chattr_defaults_save(path = \"chattr.yml\", overwrite = FALSE, type = NULL)"},{"path":"https://mlverse.github.io/chattr/reference/chattr_defaults_save.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"Saves the current defaults in a yaml file that is compatible with\nthe config package — chattr_defaults_save","text":"path Path file save configuration overwrite Indicates replace file exists type type UI save defaults . defaults NULL save whatever types used current R session","code":""},{"path":"https://mlverse.github.io/chattr/reference/chattr_defaults_save.html","id":"value","dir":"Reference","previous_headings":"","what":"Value","title":"Saves the current defaults in a yaml file that is compatible with\nthe config package — chattr_defaults_save","text":"creates YAML file defaults set current R session.","code":""},{"path":"https://mlverse.github.io/chattr/reference/chattr_test.html","id":null,"dir":"Reference","previous_headings":"","what":"Confirms conectivity to LLM interface — chattr_test","title":"Confirms conectivity to LLM interface — chattr_test","text":"Confirms conectivity LLM interface","code":""},{"path":"https://mlverse.github.io/chattr/reference/chattr_test.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Confirms conectivity to LLM interface — chattr_test","text":"","code":"chattr_test(defaults = NULL) ch_test(defaults = NULL)"},{"path":"https://mlverse.github.io/chattr/reference/chattr_test.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"Confirms conectivity to LLM interface — chattr_test","text":"defaults Defaults object, generally puled chattr_defaults()","code":""},{"path":"https://mlverse.github.io/chattr/reference/chattr_test.html","id":"value","dir":"Reference","previous_headings":"","what":"Value","title":"Confirms conectivity to LLM interface — chattr_test","text":"returns console massages status test.","code":""},{"path":"https://mlverse.github.io/chattr/reference/chattr_use.html","id":null,"dir":"Reference","previous_headings":"","what":"Sets the LLM model to use in your session — chattr_use","title":"Sets the LLM model to use in your session — chattr_use","text":"Sets LLM model use session","code":""},{"path":"https://mlverse.github.io/chattr/reference/chattr_use.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Sets the LLM model to use in your session — chattr_use","text":"","code":"chattr_use(model_label = NULL)"},{"path":"https://mlverse.github.io/chattr/reference/chattr_use.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"Sets the LLM model to use in your session — chattr_use","text":"model_label label LLM model use. Valid values 'copilot', 'gpt4', 'gpt35', 'llamagpt'. value 'test' also acceptable, meant package examples, internal testin.","code":""},{"path":"https://mlverse.github.io/chattr/reference/chattr_use.html","id":"value","dir":"Reference","previous_headings":"","what":"Value","title":"Sets the LLM model to use in your session — chattr_use","text":"returns console messages allow user select model use.","code":""},{"path":"https://mlverse.github.io/chattr/reference/chattr_use.html","id":"details","dir":"Reference","previous_headings":"","what":"Details","title":"Sets the LLM model to use in your session — chattr_use","text":"error \"model setup found\" returned, none expected setup Copilot, OpenIA LLama automatically detected. setup model: OpenIA - main thing chattr checks prescence R user's OpenAI PAT (Personal Access Token). looks 'OPENAI_API_KEY' environment variable. Get PAT OpenAI website, save environment variable. restart R, try . GitHub Copilot - Setup GitHub Copilot RStudio IDE, restart R. chattr look default location RStudio saves Copilot authentication information. Use 'CHATTR_MODEL' environment variable set R session, create YAML file named 'chattr.yml' working directory control model, defaults use communicate model.","code":""}]
+[{"path":"https://mlverse.github.io/chattr/LICENSE.html","id":null,"dir":"","previous_headings":"","what":"MIT License","title":"MIT License","text":"Copyright (c) 2023 chattr authors Permission hereby granted, free charge, person obtaining copy software associated documentation files (“Software”), deal Software without restriction, including without limitation rights use, copy, modify, merge, publish, distribute, sublicense, /sell copies Software, permit persons Software furnished , subject following conditions: copyright notice permission notice shall included copies substantial portions Software. SOFTWARE PROVIDED “”, WITHOUT WARRANTY KIND, EXPRESS IMPLIED, INCLUDING LIMITED WARRANTIES MERCHANTABILITY, FITNESS PARTICULAR PURPOSE NONINFRINGEMENT. EVENT SHALL AUTHORS COPYRIGHT HOLDERS LIABLE CLAIM, DAMAGES LIABILITY, WHETHER ACTION CONTRACT, TORT OTHERWISE, ARISING , CONNECTION SOFTWARE USE DEALINGS SOFTWARE.","code":""},{"path":"https://mlverse.github.io/chattr/articles/backend-llamagpt.html","id":"intro","dir":"Articles","previous_headings":"","what":"Intro","title":"Interact with local models","text":"LlamaGPT-Chat command line chat application. integrates LLM via C++. means work LLM’s language. available today free download use. C++, models able run locally computer, even GPU available. models quite fast responses. integrating LlamaGPT-Chat, able access multiple types LLM’s one additional back-end within chattr.","code":""},{"path":"https://mlverse.github.io/chattr/articles/backend-llamagpt.html","id":"installation","dir":"Articles","previous_headings":"","what":"Installation","title":"Interact with local models","text":"get LlamaGPT-Chat working machine need two things: version LlamaGPT-Chat works computer LLM file works chat program","code":""},{"path":"https://mlverse.github.io/chattr/articles/backend-llamagpt.html","id":"install-llamagpt-chat","dir":"Articles","previous_headings":"Installation","what":"Install LLamaGPT-Chat","title":"Interact with local models","text":"LlamaGPT-Chat need “compiled binary” specific Operating System. example, Windows, compiled binary .exe file. GitHub repository offers pre-compiled binaries can download use: Releases. Depending system’s security, pre-compiled program may blocked running. case, need “build” program computer. instructions .","code":""},{"path":"https://mlverse.github.io/chattr/articles/backend-llamagpt.html","id":"llm-file","dir":"Articles","previous_headings":"Installation","what":"LLM file","title":"Interact with local models","text":"GitHub repository contains list compatible models. Download least one models, make note saved computer.","code":""},{"path":"https://mlverse.github.io/chattr/articles/backend-llamagpt.html","id":"setup","dir":"Articles","previous_headings":"","what":"Setup","title":"Interact with local models","text":"start, instruct chattr switch LLamaGPT back-end using chattr_use() first time use interface, confirm path compiled program, model matches machine. check use chattr_defaults() either, , paths incorrect, correct updating path, model arguments chattr_defaults() need change defaults every time start new R session, use chattr_defaults_save(). create YAML file working directory. chattr use file override defaults. Use chattr_test() confirm chattr able communicate LLamaGPT-Chat, model use R session accessible","code":"library(chattr) chattr_use(\"llamagpt\") #> #> ── chattr #> • Provider: LlamaGPT #> • Path/URL: ~/LlamaGPTJ-chat/build/bin/chat #> • Model: ~/ggml-gpt4all-j-v1.3-groovy.bin #> • Label: GPT4ALL 1.3 (LlamaGPT) chattr_defaults() #> #> ── chattr ────────────────────────────────────────────────────────────────────── #> #> ── Defaults for: Default ── #> #> ── Prompt: #> • Use the R language, the tidyverse, and tidymodels #> #> ── Model #> • Provider: LlamaGPT #> • Path/URL: ~/LlamaGPTJ-chat/build/bin/chat #> • Model: ~/ggml-gpt4all-j-v1.3-groovy.bin #> • Label: GPT4ALL 1.3 (LlamaGPT) #> #> ── Model Arguments: #> • threads: 4 #> • temp: 0.01 #> • n_predict: 1000 #> #> ── Context: #> Max Data Files: 0 #> Max Data Frames: 0 #> ✖ Chat History #> ✖ Document contents chattr_defaults(path = \"[path to compiled program]\", model = \"[path to model]\") #> #> ── chattr ────────────────────────────────────────────────────────────────────── #> #> ── Defaults for: Default ── #> #> ── Prompt: #> • Use the R language, the tidyverse, and tidymodels #> #> ── Model #> • Provider: LlamaGPT #> • Path/URL: [path to compiled program] #> • Model: [path to model] #> • Label: GPT4ALL 1.3 (LlamaGPT) #> #> ── Model Arguments: #> • threads: 4 #> • temp: 0.01 #> • n_predict: 1000 #> #> ── Context: #> Max Data Files: 0 #> Max Data Frames: 0 #> ✖ Chat History #> ✖ Document contents chattr_defaults_save() chattr_test() #> ✔ Model started sucessfully #> ✔ Model session closed sucessfully"},{"path":"https://mlverse.github.io/chattr/articles/backend-llamagpt.html","id":"model-arguments","dir":"Articles","previous_headings":"","what":"Model Arguments","title":"Interact with local models","text":"arguments sent model can modified chattr_defaults() modifying model_arguments argument. expects list object. arguments sets default: example adding batch_size defaults: see current list available model arguments go : Detailed command list. IMPORTANT - chattr passes arguments directly LLamaGPT-chat command line flag, except model. chattr use value chattr_defaults(model = \"[path model]\") instead.","code":"chattr_defaults()$model_arguments #> $threads #> [1] 4 #> #> $temp #> [1] 0.01 #> #> $n_predict #> [1] 1000 chattr_defaults(model_arguments = list(batch_size = 40)) #> #> ── chattr ────────────────────────────────────────────────────────────────────── #> #> ── Defaults for: Default ── #> #> ── Prompt: #> • Use the R language, the tidyverse, and tidymodels #> #> ── Model #> • Provider: LlamaGPT #> • Path/URL: [path to compiled program] #> • Model: [path to model] #> • Label: GPT4ALL 1.3 (LlamaGPT) #> #> ── Model Arguments: #> • batch_size: 40 #> • threads: 4 #> • temp: 0.01 #> • n_predict: 1000 #> #> ── Context: #> Max Data Files: 0 #> Max Data Frames: 0 #> ✖ Chat History #> ✖ Document contents"},{"path":"https://mlverse.github.io/chattr/articles/copilot-chat.html","id":"intro","dir":"Articles","previous_headings":"","what":"Intro","title":"Interact with GitHub Copilot Chat","text":"introduction docs.github.com: GitHub Copilot Chat chat interface lets interact GitHub Copilot, ask receive answers coding-related questions within GitHub.com supported IDEs. chat interface provides access coding information support without requiring navigate documentation search online forums.","code":""},{"path":"https://mlverse.github.io/chattr/articles/copilot-chat.html","id":"rstudio","dir":"Articles","previous_headings":"","what":"RStudio","title":"Interact with GitHub Copilot Chat","text":"RStudio’s integration Copilot needs enabled, setup, order chattr work. due complexity authenticating Copilot Chat. yet setup GitHub Copilot RStudio IDE, instructions: https://docs.posit.co/ide/user/ide/guide/tools/copilot.html","code":""},{"path":"https://mlverse.github.io/chattr/articles/copilot-chat.html","id":"test-connection","dir":"Articles","previous_headings":"","what":"Test connection","title":"Interact with GitHub Copilot Chat","text":"Use chattr_test() function confirm connection works:","code":"library(chattr) chattr_use(\"copilot\") chattr_test() #> ── Testing chattr #> • Provider: OpenAI - Copilot Chat #> • Path/URL: https://api.githubcopilot.com/chat/completions #> • Model: #> ✔ Connection with GitHub Copilot cofirmed #> |--Prompt: Hi! #> |--Response: Hello! How can I assist you today?"},{"path":"https://mlverse.github.io/chattr/articles/openai-gpt.html","id":"intro","dir":"Articles","previous_headings":"","what":"Intro","title":"Interact with OpenAI GPT models","text":"OpenAI’s GPT models possibly widely used LLM today. Typically, interaction models via chatting inside OpenAI’s web portal. also offer REST API endpoint can use communicate LLM’s. chattr able send receive correct API calls make “chatting” experience GPT models seamless.","code":""},{"path":"https://mlverse.github.io/chattr/articles/openai-gpt.html","id":"secret-key","dir":"Articles","previous_headings":"","what":"Secret key","title":"Interact with OpenAI GPT models","text":"OpenAI requires secret key authenticate user. required application non-OpenAI application, chattr, one order function. key long alphanumeric sequence. sequence created OpenAI portal. obtain secret key, follow link: OpenAI API Keys default, chattr look secret key inside Environment Variable called OPENAI_API_KEY. packages integrate OpenAI use variable name. Use Sys.setenv() set variable. downside using method variable available current R session: preferred method save secret key .Renviron file. way, need load environment variable every time start new R session. .Renviron file available home directory. example entry:","code":"Sys.setenv(\"OPENAI_API_KEY\" = \"####################\") OPENAI_API_KEY=####################"},{"path":"https://mlverse.github.io/chattr/articles/openai-gpt.html","id":"test-connection","dir":"Articles","previous_headings":"","what":"Test connection","title":"Interact with OpenAI GPT models","text":"Use chattr_test() function confirm connection works:","code":"library(chattr) chattr_test() ✔ Connection with OpenAI cofirmed ✔ Access to models confirmed"},{"path":"https://mlverse.github.io/chattr/articles/openai-gpt.html","id":"change-the-model","dir":"Articles","previous_headings":"","what":"Change the model","title":"Interact with OpenAI GPT models","text":"default, chattr setup interact GPT 4 (gpt-4). switch 3.5, use: switch back GPT 4, run: see latest list endpoint use, go : Model Endpoint Compatibility","code":"library(chattr) chattr_use(\"gpt35\") #> #> ── chattr #> • Provider: OpenAI - Chat Completions #> • Path/URL: https://api.openai.com/v1/chat/completions #> • Model: gpt-3.5-turbo #> • Label: GPT 3.5 (OpenAI) chattr_use(\"gpt4\") #> #> ── chattr #> • Provider: OpenAI - Chat Completions #> • Path/URL: https://api.openai.com/v1/chat/completions #> • Model: gpt-4 #> • Label: GPT 4 (OpenAI)"},{"path":"https://mlverse.github.io/chattr/articles/openai-gpt.html","id":"data-files-and-data-frames","dir":"Articles","previous_headings":"","what":"Data files and data frames","title":"Interact with OpenAI GPT models","text":"information environment work space, default chattr avoids sending data files, data frame information OpenAI. Sending information convenient creates shorthand requests. wish submit information part prompts, use chattr_defaults(), example: chattr_defaults(max_data_files = 10) chattr_defaults(max_data_frames = 10) two commands send 10 data frames, 10 data files part prompt. can decide number limit . send, larger prompt. set anything 0, warning show every time start Shiny app:","code":"• Provider: Open AI - Chat Completions • Path/URL: https://api.openai.com/v1/chat/completions • Model: gpt-3.5-turbo ! A list of the top 10 files will be sent externally to OpenAI with every request To avoid this, set the number of files to be sent to 0 using chattr::chattr_defaults(max_data_files = 0)Î"},{"path":"https://mlverse.github.io/chattr/articles/other-interfaces.html","id":"output","dir":"Articles","previous_headings":"","what":"Output","title":"Other interfaces","text":"Based making request , chattr return response appropriately following manner: request made R console, response returned console message, R code (cat()). way, can decide copy-paste code run. also prevent comments LLM cause error. request made script, code chunk Quarto (Visual editor), output inserted right prompt document.","code":""},{"path":"https://mlverse.github.io/chattr/articles/other-interfaces.html","id":"using-the-chattr-function","dir":"Articles","previous_headings":"","what":"Using the chattr() function","title":"Other interfaces","text":"fastest way interact LLM simply calling chattr() function enter request . example request made OpenAI:","code":"library(chattr) chattr(\"show me a simple recipe\") # Load required packages library(tidymodels) # Create a simple recipe for the iris dataset iris_recipe <- recipe(Species ~ ., data = iris) # Print the recipe iris_recipe"},{"path":"https://mlverse.github.io/chattr/articles/other-interfaces.html","id":"highlight-the-request-in-a-script","dir":"Articles","previous_headings":"","what":"Highlight the request in a script","title":"Other interfaces","text":"script, chattr process current line, highlighted line(s), prompt. assume request going code, chattr comment line lines highlighted. mentioned Output section, response inserted document. example request submitted OpenAI: results:","code":"Create a function that: - Removes specified variables - Behaves like dplyr's select function # Create a function that: # - Removes specified variables # - Behaves like dplyr's select function # This function removes specified variables and behaves like dplyr's select function # It uses the tidyverse packages: dplyr and tidyr remove_vars <- function(data, ...) { data %>% select(-one_of(...)) } }"},{"path":"https://mlverse.github.io/chattr/articles/prompt_defaults.html","id":"support-for-glue","dir":"Articles","previous_headings":"","what":"Support for glue","title":"Modify prompt enhancements","text":"prompt argument supports glue. means can pass current values variables, current output functions within current R session. Make sure output, value, character readable LLM. simple example function passes variables currently R session contain “x”: my_list() function passed prompt argument enclosed braces: Now can test , setting two variables start “x” see sent LLM, can use chattr(preview = TRUE). two variables listed part prompt: can see adding new variable modify prompt us modify chattr_defaults():","code":"my_list <- function() { return(ls(pattern = \"x\", envir = globalenv())) } chattr_defaults(prompt = \"{ my_list() }\") #> #> ── chattr ────────────────────────────────────────────────────────────────────── #> #> ── Defaults for: Default ── #> #> ── Prompt: #> • {{ my_list() }} #> #> ── Model #> • Provider: OpenAI - Chat Completions #> • Path/URL: https://api.openai.com/v1/chat/completions #> • Model: gpt-4 #> • Label: GPT 4 (OpenAI) #> #> ── Model Arguments: #> • temperature: 0.01 #> • max_tokens: 1000 #> • stream: TRUE #> #> ── Context: #> Max Data Files: 0 #> Max Data Frames: 0 #> ✔ Chat History #> ✖ Document contents x1 <- 1 x2 <- 2 chattr(preview = TRUE) #> #> ── chattr ────────────────────────────────────────────────────────────────────── #> #> ── Preview for: Console #> • Provider: OpenAI - Chat Completions #> • Path/URL: https://api.openai.com/v1/chat/completions #> • Model: gpt-4 #> • Label: GPT 4 (OpenAI) #> • temperature: 0.01 #> • max_tokens: 1000 #> • stream: TRUE #> #> ── Prompt: #> role: system #> content: You are a helpful coding assistant #> role: user #> content: #> * x1 #> * x2 #> [Your future prompt goes here] x3 <- 3 chattr(preview = TRUE) #> #> ── chattr ────────────────────────────────────────────────────────────────────── #> #> ── Preview for: Console #> • Provider: OpenAI - Chat Completions #> • Path/URL: https://api.openai.com/v1/chat/completions #> • Model: gpt-4 #> • Label: GPT 4 (OpenAI) #> • temperature: 0.01 #> • max_tokens: 1000 #> • stream: TRUE #> #> ── Prompt: #> role: system #> content: You are a helpful coding assistant #> role: user #> content: #> * x1 #> * x2 #> * x3 #> [Your future prompt goes here]"},{"path":"https://mlverse.github.io/chattr/authors.html","id":null,"dir":"","previous_headings":"","what":"Authors","title":"Authors and Citation","text":"Edgar Ruiz. Author, maintainer. Posit Software, PBC. Copyright holder, funder.","code":""},{"path":"https://mlverse.github.io/chattr/authors.html","id":"citation","dir":"","previous_headings":"","what":"Citation","title":"Authors and Citation","text":"Ruiz E (2024). chattr: Integrates LLM's RStudio IDE. R package version 0.0.0.9011, https://mlverse.github.io/chattr/, https://github.com/mlverse/chattr.","code":"@Manual{, title = {chattr: Integrates LLM's with the RStudio IDE}, author = {Edgar Ruiz}, year = {2024}, note = {R package version 0.0.0.9011, https://mlverse.github.io/chattr/}, url = {https://github.com/mlverse/chattr}, }"},{"path":"https://mlverse.github.io/chattr/index.html","id":"chattr","dir":"","previous_headings":"","what":"Integrates LLM's with the RStudio IDE","title":"Integrates LLM's with the RStudio IDE","text":"Intro Install Available models App Additional ways interact works setup keyboard shortcut","code":""},{"path":"https://mlverse.github.io/chattr/index.html","id":"intro","dir":"","previous_headings":"","what":"Intro","title":"Integrates LLM's with the RStudio IDE","text":"chattr interface LLMs (Large Language Models). enables interaction model directly RStudio IDE. chattr allows submit prompt LLM script, using provided Shiny Gadget. package’s main goal aid exploratory data analysis (EDA) tasks. additional information appended request, provides sort “guard rails”, packages techniques usually recommend best practice, used model’s responses.","code":""},{"path":"https://mlverse.github.io/chattr/index.html","id":"install","dir":"","previous_headings":"","what":"Install","title":"Integrates LLM's with the RStudio IDE","text":"Since early version package install package GitHub:","code":"remotes::install_github(\"mlverse/chattr\")"},{"path":"https://mlverse.github.io/chattr/index.html","id":"available-models","dir":"","previous_headings":"","what":"Available models","title":"Integrates LLM's with the RStudio IDE","text":"chattr provides two main integration two main LLM back-ends. back-end provides access multiple LLM types. plan add back-ends time goes :","code":""},{"path":[]},{"path":"https://mlverse.github.io/chattr/index.html","id":"the-app","dir":"","previous_headings":"Using","what":"The App","title":"Integrates LLM's with the RStudio IDE","text":"main way use chattr Shiny Gadget app. default, RStudio app run inside Viewer pane. chattr prompt select model back-end use. list actual models depend setup . model setup found, return error. receive error, please refer previous section learn setup model back-end machine. example selection prompt look like: prompt occurs first time call chattr_app(), chattr(). close app, open , app use model initially selected. selection set rest R session, manually change . Please note , example, chattr find setup OpenAI, lines show options actual prompt. wish avoid interactive prompt, call chattr_use() designate model wish use calling app. can also use chattr_use() change model back-end interacting R session: Screenshot Sniny gadget app dark mode RStudio theme LLM finishes response, chattr app processes markdown code chunks. place three convenience buttons: Copy clipboard - write code inside chunk clipboard. Copy document - copy-paste code directly app called . app started working script, chattr copy code script. Copy new script - creates new R script RStudio IDE, copies content chunk directly . useful LLM writes Shiny app lot effort put make app’s appearance close possible IDE. way feels integrated work space. includes switching color scheme based current RStudio theme light, dark. settings screen can accessed clicking “gear” button. screen opens contain following: Save Open chats - early experiment allow us save retrieve past chats. chattr save file RDS format. main objective feature, able see past chats, continue previous conversations LLM. Prompt settings - section can change additional information attached prompt. Including number max data files, data frames sent LLM. Screenshot Sniny gadget options","code":"chattr::chattr_app() #> ── chattr - Available models #> #> 1: GitHub - Copilot Chat - (copilot) #> 2: OpenAI - Chat Completions - gpt-3.5-turbo (gpt35) #> 3: OpenAI - Chat Completions - gpt-4 (gpt4) #> 4: LlamaGPT - ~/ggml-gpt4all-j-v1.3-groovy.bin (llamagpt) #> #> Select the number of the model you would like to use: chattr_use(\"gpt35\") chattr_app()"},{"path":"https://mlverse.github.io/chattr/index.html","id":"additional-ways-to-interact","dir":"","previous_headings":"Using","what":"Additional ways to interact","title":"Integrates LLM's with the RStudio IDE","text":"Apart Shiny app, chattr provides two ways interact LLM. details, see: interfaces","code":""},{"path":"https://mlverse.github.io/chattr/index.html","id":"how-it-works","dir":"","previous_headings":"","what":"How it works","title":"Integrates LLM's with the RStudio IDE","text":"chattr enriches request additional instructions, name structure data frames currently environment, path data files working directory. supported model, chattr include current chat history. Diagram illustrates chattr handles model requests see chattr send model, set preview argument TRUE:","code":"library(chattr) data(mtcars) data(iris) chattr_use(\"gpt4\") #> #> ── chattr #> • Provider: OpenAI - Chat Completions #> • Path/URL: https://api.openai.com/v1/chat/completions #> • Model: gpt-4 #> • Label: GPT 4 (OpenAI) chattr(preview = TRUE) #> #> ── chattr ────────────────────────────────────────────────────────────────────── #> #> ── Preview for: Console #> • Provider: OpenAI - Chat Completions #> • Path/URL: https://api.openai.com/v1/chat/completions #> • Model: gpt-4 #> • Label: GPT 4 (OpenAI) #> • temperature: 0.01 #> • max_tokens: 1000 #> • stream: TRUE #> #> ── Prompt: #> role: system #> content: You are a helpful coding assistant #> role: user #> content: #> * Use the 'Tidy Modeling with R' (https://www.tmwr.org/) book as main reference #> * Use the 'R for Data Science' (https://r4ds.had.co.nz/) book as main reference #> * Use tidyverse packages: readr, ggplot2, dplyr, tidyr #> * For models, use tidymodels packages: recipes, parsnip, yardstick, workflows, #> broom #> * Avoid explanations unless requested by user, expecting code only #> * For any line that is not code, prefix with a: # #> * Keep each line of explanations to no more than 80 characters #> * DO NOT use Markdown for the code #> [Your future prompt goes here]"},{"path":"https://mlverse.github.io/chattr/index.html","id":"keyboard-shortcut","dir":"","previous_headings":"","what":"Keyboard Shortcut","title":"Integrates LLM's with the RStudio IDE","text":"best way access chattr’s app setting keyboard shortcut . package includes RStudio Addin gives us direct access app, turn, allows keyboard shortcut assigned addin. name addin : “Open Chat”. familiar assign keyboard shortcut see next section.","code":""},{"path":"https://mlverse.github.io/chattr/index.html","id":"how-to-setup-the-keyboard-shortcut","dir":"","previous_headings":"Keyboard Shortcut","what":"How to setup the keyboard shortcut","title":"Integrates LLM's with the RStudio IDE","text":"Select Tools top menu, select Modify Keyboard Shortcuts Screenshot shows find option modify keyboard shortcuts Search chattr adding writing “open chat”, search box Screenshot shows input addin search select key combination shortcut, click Shortcut box type press key combination keyboard. case, chose Ctrl+Shift+C Screenshot shows interface looks like shortcut selected","code":""},{"path":"https://mlverse.github.io/chattr/reference/ch_history.html","id":null,"dir":"Reference","previous_headings":"","what":"Displays the current session' chat history — ch_history","title":"Displays the current session' chat history — ch_history","text":"Displays current session' chat history","code":""},{"path":"https://mlverse.github.io/chattr/reference/ch_history.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Displays the current session' chat history — ch_history","text":"","code":"ch_history(x = NULL)"},{"path":"https://mlverse.github.io/chattr/reference/ch_history.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"Displays the current session' chat history — ch_history","text":"x list object contains chat history. Use argument override current history.","code":""},{"path":"https://mlverse.github.io/chattr/reference/ch_submit.html","id":null,"dir":"Reference","previous_headings":"","what":"Method to easily integrate to new LLM API's — ch_submit","title":"Method to easily integrate to new LLM API's — ch_submit","text":"Method easily integrate new LLM API's","code":""},{"path":"https://mlverse.github.io/chattr/reference/ch_submit.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Method to easily integrate to new LLM API's — ch_submit","text":"","code":"ch_submit( defaults, prompt = NULL, stream = NULL, prompt_build = TRUE, preview = FALSE, ... )"},{"path":"https://mlverse.github.io/chattr/reference/ch_submit.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"Method to easily integrate to new LLM API's — ch_submit","text":"defaults Defaults object, generally puled chattr_defaults() prompt prompt send LLM stream output response LLM happens, wait response complete. Defaults TRUE. prompt_build Include context additional prompt part request preview Primarily used debugging. indicates send prompt LLM (FALSE), print resulting prompt (TRUE) ... Optional arguments; currently unused.","code":""},{"path":"https://mlverse.github.io/chattr/reference/ch_submit.html","id":"details","dir":"Reference","previous_headings":"","what":"Details","title":"Method to easily integrate to new LLM API's — ch_submit","text":"Use function integrate LLM API. requirements get work properly: output function needs parsed response LLM support streaming, make sure use cat() function output response LLM API happening. preview set TRUE, send LLM API. Simply return resulting prompt. defaults argument controls method use. can use chattr_defaults() function, set provider. provider value creates R class name. pre-pend cl_ class name. See examples clarity.","code":""},{"path":"https://mlverse.github.io/chattr/reference/ch_submit.html","id":"ref-examples","dir":"Reference","previous_headings":"","what":"Examples","title":"Method to easily integrate to new LLM API's — ch_submit","text":"","code":"if (FALSE) { library(chattr) ch_submit.ch_my_llm <- function(defaults, prompt = NULL, stream = NULL, prompt_build = TRUE, preview = FALSE, ...) { # Use `prompt_build` to append the prompts you with to append if (prompt_build) prompt <- paste0(\"Use the tidyverse\\n\", prompt) # If `preview` is true, return the resulting prompt back if (preview) { return(prompt) } llm_response <- paste0(\"You said this: \\n\", prompt) if (stream) { cat(\"streaming:\\n\") for (i in seq_len(nchar(llm_response))) { # If `stream` is true, make sure to `cat()` the current output cat(substr(llm_response, i, i)) Sys.sleep(0.1) } } # Make sure to return the entire output from the LLM at the end llm_response } chattr_defaults(\"console\", provider = \"my llm\") chattr(\"hello\") chattr(\"hello\", stream = FALSE) chattr(\"hello\", prompt_build = FALSE) chattr(\"hello\", preview = TRUE) }"},{"path":"https://mlverse.github.io/chattr/reference/chattr.html","id":null,"dir":"Reference","previous_headings":"","what":"Submits prompt to LLM — chattr","title":"Submits prompt to LLM — chattr","text":"Submits prompt LLM","code":""},{"path":"https://mlverse.github.io/chattr/reference/chattr.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Submits prompt to LLM — chattr","text":"","code":"chattr(prompt = NULL, preview = FALSE, prompt_build = TRUE, stream = NULL)"},{"path":"https://mlverse.github.io/chattr/reference/chattr.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"Submits prompt to LLM — chattr","text":"prompt Request send LLM. Defaults NULL preview Primarily used debugging. indicates send prompt LLM (FALSE), print resulting prompt (TRUE) prompt_build Include context additional prompt part request stream output response LLM happens, wait response complete. Defaults TRUE.","code":""},{"path":"https://mlverse.github.io/chattr/reference/chattr.html","id":"value","dir":"Reference","previous_headings":"","what":"Value","title":"Submits prompt to LLM — chattr","text":"output LLM console, document script.","code":""},{"path":"https://mlverse.github.io/chattr/reference/chattr.html","id":"ref-examples","dir":"Reference","previous_headings":"","what":"Examples","title":"Submits prompt to LLM — chattr","text":"","code":"library(chattr) chattr_use(\"test\") #> #> ── chattr #> • Provider: test backend #> • Path/URL: #> • Model: Test model #> • Label: Test chattr(\"hello\") #> hello chattr(\"hello\", preview = TRUE) #> hello #> #> ── chattr ────────────────────────────────────────────────────────────────────── #> #> ── Preview for: Console #> • Provider: test backend #> • Path/URL: #> • Model: Test model #> • Label: Test #> • n_predict: 1000 #> #> ── Prompt: #> hello"},{"path":"https://mlverse.github.io/chattr/reference/chattr_app.html","id":null,"dir":"Reference","previous_headings":"","what":"Starts a Shiny app interface to the LLM — chattr_app","title":"Starts a Shiny app interface to the LLM — chattr_app","text":"Starts Shiny app interface LLM","code":""},{"path":"https://mlverse.github.io/chattr/reference/chattr_app.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Starts a Shiny app interface to the LLM — chattr_app","text":"","code":"chattr_app( viewer = c(\"viewer\", \"dialog\"), as_job = getOption(\"chattr.as_job\", FALSE), as_job_port = getOption(\"shiny.port\", 7788), as_job_host = getOption(\"shiny.host\", \"127.0.0.1\") )"},{"path":"https://mlverse.github.io/chattr/reference/chattr_app.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"Starts a Shiny app interface to the LLM — chattr_app","text":"viewer Specifies Shiny app going display as_job App runs RStudio IDE Job. Defaults FALSE. set TRUE, Shiny app able transfer code blocks directly document, console, IDE. as_job_port Port use Shiny app. Applicable as_job set TRUE. as_job_host Host IP use Shiny app. Applicable as_job set TRUE.","code":""},{"path":"https://mlverse.github.io/chattr/reference/chattr_app.html","id":"value","dir":"Reference","previous_headings":"","what":"Value","title":"Starts a Shiny app interface to the LLM — chattr_app","text":"chat interface inside 'RStudio' IDE","code":""},{"path":"https://mlverse.github.io/chattr/reference/chattr_defaults.html","id":null,"dir":"Reference","previous_headings":"","what":"Default arguments to use when making requests to the LLM — chattr_defaults","title":"Default arguments to use when making requests to the LLM — chattr_defaults","text":"Default arguments use making requests LLM","code":""},{"path":"https://mlverse.github.io/chattr/reference/chattr_defaults.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Default arguments to use when making requests to the LLM — chattr_defaults","text":"","code":"chattr_defaults( type = \"default\", prompt = NULL, max_data_files = NULL, max_data_frames = NULL, include_doc_contents = NULL, include_history = NULL, provider = NULL, path = NULL, model = NULL, model_arguments = NULL, system_msg = NULL, yaml_file = \"chattr.yml\", force = FALSE, label = NULL, ... )"},{"path":"https://mlverse.github.io/chattr/reference/chattr_defaults.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"Default arguments to use when making requests to the LLM — chattr_defaults","text":"type Entry point interact model. Accepted values: 'notebook', chat' prompt Request send LLM. Defaults NULL max_data_files Sets maximum number data files send model. defaults 20. send , set NULL max_data_frames Sets maximum number data frames loaded current R session send model. defaults 20. send , set NULL include_doc_contents Send current code document include_history Indicates whether include chat history every time new prompt submitted provider name provider LLM. Today, \"openai\" available path location model. URL file path. model name path model use. model_arguments Additional arguments pass model part request, requires list. Examples arguments: temperature, top_p, max_tokens system_msg OpenAI GPT 3.5 , system message send part request yaml_file path valid config YAML file contains defaults use session force Re-process base work space level file defaults label Label display Shiny app, locations ... Additional model arguments standard models/backends","code":""},{"path":"https://mlverse.github.io/chattr/reference/chattr_defaults.html","id":"value","dir":"Reference","previous_headings":"","what":"Value","title":"Default arguments to use when making requests to the LLM — chattr_defaults","text":"'ch_model' object contains current defaults used communicate LLM.","code":""},{"path":"https://mlverse.github.io/chattr/reference/chattr_defaults.html","id":"details","dir":"Reference","previous_headings":"","what":"Details","title":"Default arguments to use when making requests to the LLM — chattr_defaults","text":"idea use addin shortcut execute request, arguments can controlled via function. default, try load defaults config YAML file, none found, defaults GPT 3.5 used. defaults can modified calling function, even interactive session started.","code":""},{"path":"https://mlverse.github.io/chattr/reference/chattr_defaults_save.html","id":null,"dir":"Reference","previous_headings":"","what":"Saves the current defaults in a yaml file that is compatible with\nthe config package — chattr_defaults_save","title":"Saves the current defaults in a yaml file that is compatible with\nthe config package — chattr_defaults_save","text":"Saves current defaults yaml file compatible config package","code":""},{"path":"https://mlverse.github.io/chattr/reference/chattr_defaults_save.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Saves the current defaults in a yaml file that is compatible with\nthe config package — chattr_defaults_save","text":"","code":"chattr_defaults_save(path = \"chattr.yml\", overwrite = FALSE, type = NULL)"},{"path":"https://mlverse.github.io/chattr/reference/chattr_defaults_save.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"Saves the current defaults in a yaml file that is compatible with\nthe config package — chattr_defaults_save","text":"path Path file save configuration overwrite Indicates replace file exists type type UI save defaults . defaults NULL save whatever types used current R session","code":""},{"path":"https://mlverse.github.io/chattr/reference/chattr_defaults_save.html","id":"value","dir":"Reference","previous_headings":"","what":"Value","title":"Saves the current defaults in a yaml file that is compatible with\nthe config package — chattr_defaults_save","text":"creates YAML file defaults set current R session.","code":""},{"path":"https://mlverse.github.io/chattr/reference/chattr_test.html","id":null,"dir":"Reference","previous_headings":"","what":"Confirms connectivity to LLM interface — chattr_test","title":"Confirms connectivity to LLM interface — chattr_test","text":"Confirms connectivity LLM interface","code":""},{"path":"https://mlverse.github.io/chattr/reference/chattr_test.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Confirms connectivity to LLM interface — chattr_test","text":"","code":"chattr_test(defaults = NULL) ch_test(defaults = NULL)"},{"path":"https://mlverse.github.io/chattr/reference/chattr_test.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"Confirms connectivity to LLM interface — chattr_test","text":"defaults Defaults object, generally puled chattr_defaults()","code":""},{"path":"https://mlverse.github.io/chattr/reference/chattr_test.html","id":"value","dir":"Reference","previous_headings":"","what":"Value","title":"Confirms connectivity to LLM interface — chattr_test","text":"returns console massages status test.","code":""},{"path":"https://mlverse.github.io/chattr/reference/chattr_use.html","id":null,"dir":"Reference","previous_headings":"","what":"Sets the LLM model to use in your session — chattr_use","title":"Sets the LLM model to use in your session — chattr_use","text":"Sets LLM model use session","code":""},{"path":"https://mlverse.github.io/chattr/reference/chattr_use.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Sets the LLM model to use in your session — chattr_use","text":"","code":"chattr_use(model_label = NULL)"},{"path":"https://mlverse.github.io/chattr/reference/chattr_use.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"Sets the LLM model to use in your session — chattr_use","text":"model_label label LLM model use. Valid values 'copilot', 'gpt4', 'gpt35', 'llamagpt'. value 'test' also acceptable, meant package examples, internal testing.","code":""},{"path":"https://mlverse.github.io/chattr/reference/chattr_use.html","id":"value","dir":"Reference","previous_headings":"","what":"Value","title":"Sets the LLM model to use in your session — chattr_use","text":"returns console messages allow user select model use.","code":""},{"path":"https://mlverse.github.io/chattr/reference/chattr_use.html","id":"details","dir":"Reference","previous_headings":"","what":"Details","title":"Sets the LLM model to use in your session — chattr_use","text":"error \"model setup found\" returned, none expected setup Copilot, OpenAI LLama automatically detected. setup model: OpenAI - main thing chattr checks presence R user's OpenAI PAT (Personal Access Token). looks 'OPENAI_API_KEY' environment variable. Get PAT OpenAI website, save environment variable. restart R, try . GitHub Copilot - Setup GitHub Copilot RStudio IDE, restart R. chattr look default location RStudio saves Copilot authentication information. Use 'CHATTR_MODEL' environment variable set R session, create YAML file named 'chattr.yml' working directory control model, defaults use communicate model.","code":""}]