chattr icon indicating copy to clipboard operation
chattr copied to clipboard

`include_history = TRUE` doesn't work

Open boranhao2 opened this issue 1 year ago • 1 comments

Hi, it looks like the conversation history is only loaded in console mode, but not in chat (i.e., Shiny app) mode. Could you check and resolve this? I already set include_history = TRUE for both modes

Console mode is fine: image

Shiny app is not good: image

boranhao2 avatar May 21 '24 02:05 boranhao2

Hi, if you use preview = TRUE you can see exactly what's being sent to OpenAI, could this be the LLM not acknowledging or recognizing how we send the history?

> library(chattr)
> chattr_use("gpt4", include_history = TRUE)

── chattr 
• Provider: OpenAI - Chat Completions
• Path/URL: https://api.openai.com/v1/chat/completions
• Model: gpt-4
• Label: GPT 4 (OpenAI)

> chattr("hello")
Hello! How can I assist you with your R coding today?

> chattr("hello again", 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: hello
role: assistant
content: Hello! How can I assist you with your R coding today?
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
hello again

edgararuiz avatar Jul 29 '24 13:07 edgararuiz