samterfa / openai Goto Github PK
View Code? Open in Web Editor NEWThis R package provides an SDK to the Open AI API
License: Other
This R package provides an SDK to the Open AI API
License: Other
library(openai)
library(purrr)
library(magrittr)
library(dplyr)
list_models() %>% pluck('data') %>% map_dfr(compact)
Show in New Window
Error in namespaceExport(ns, exports) :
undefined exports: %has_args%, %has_attr%, %has_name%, on_failure<-, are_equal, assert_that, has_args, has_attr, has_extension, has_name, is.count, is.date, is.dir, is.error, is.flag, is.number, is.readable, is.scalar, is.string, is.time, is.writeable, noNA, not_empty, on_failure, see_if, validate_that
Hi, I got this error trying to install the pkg from github. Is there any prob with the export of the function?
Downloading GitHub repo samterfa/openai@HEAD
── R CMD build ─────────────────────────────────────────────────────────────────────
✔ checking for file 'C:\Users\Luca\AppData\Local\Temp\RtmpM9cJU1\remotes205c280d3682\samterfa-openai-73480e9/DESCRIPTION'
─ preparing 'openai':
✔ checking DESCRIPTION meta-information ...
─ checking for LF line-endings in source and make files and shell scripts
─ checking for empty or unneeded directories
─ building 'openai_0.0.1.tar.gz'
Installing package into ‘C:/Users/Luca/Documents/2023.efsa_inventory/renv/library/R-4.3/x86_64-w64-mingw32’
(as ‘lib’ is unspecified)
- The project is out-of-sync -- use `renv::status()` for details.
* installing *source* package 'openai' ...
** using staged installation
** R
** inst
** byte-compile and prepare package for lazy loading
** help
*** installing help indices
** building package indices
** testing if installed package can be loaded from temporary location
Error: package or namespace load failed for 'openai' in namespaceExport(ns, exports):
undefined exports: create_chat_completions
Error: loading failed
Execution halted
ERROR: loading failed
* removing 'C:/Users/Luca/Documents/2023.efsa_inventory/renv/library/R-4.3/x86_64-w64-mingw32/openai'
Warning messages:
1: In untar2(tarfile, files, list, exdir, restore_times) :
skipping pax global extended headers
2: In untar2(tarfile, files, list, exdir, restore_times) :
skipping pax global extended headers
3: In i.p(...) :
installation of package ‘C:/Users/Luca/AppData/Local/Temp/RtmpM9cJU1/file205c5b137984/openai_0.0.1.tar.gz’ had non-zero exit status```
When typing the prompt "Load mtcars data and create boxplot" in the console, I receive the following return:
Here's how to load the mtcars
data and create a basic boxplot of the mpg
variable using R:
Error: unexpected symbol in "load mtcars"
I am using R 4.2.3 with most recent version of R studio and Windows 11
Error in map_chr()
:
ℹ In index: 1.
ℹ With name: text.
Caused by error in .x$text
:
! $ operator is invalid for atomic vectors
Run rlang::last_trace()
to see where the error occurred.
create_completion(
model = 'davinci',
max_tokens = 30,
temperature = .5,
top_p = 1,
n = 1,
stream = F,
prompt = 'Once upon a time') %>%
pluck('choices') %>%
map_chr(~ .x$text)
I have NO idea how to fix this.
Dear author,
Thanks a lot for your great tool!
May I have your guidance that how to make the add-in work? After library(openai), and then type # write some R code ..., no code is generated automatically, is it due to the addin content interactive: False?
Many thanks!
HI!
I am trying to use this very cool tool but get the following error when I try to add the addin.
Error in (function (prompt = rstudioapi::getConsoleEditorContext()$contents, :
list(message = "You exceeded your current quota, please check your plan and billing details.", type = "insufficient_quota", param = NULL, code = NULL)
list_models() %>%
pluck('data') %>%
map_dfr(compact)
Error in dplyr::bind_rows()
:
! Argument 1 must be a data frame or a named atomic vector.
Run rlang::last_trace()
to see where the error occurred.
Warning message:
Outer names are only allowed for unnamed scalar atomic inputs
chatgpt:::run_addin_ask_chatgpt()
Listening on http://127.0.0.1:3999
***** ChatGPT input:**
Please help:
list_models() %>%
pluck('data') %>%
map_dfr(compact)
Error in dplyr::bind_rows()
:
! Argument 1 must be a data frame or a named atomic vector.
Run rlang::last_trace()
to see where the error occurred.
Warning message:
Outer names are only allowed for unnamed scalar atomic inputs
***** ChatGPT output:**
This error is telling us that the object being passed to map_dfr()
is not a data frame or a named atomic vector. The issue could be with the compact()
function that is being used in map_dfr()
.
It's also possible that the data being passed to map_dfr()
is not in the correct format. It's hard to pinpoint the exact issue without knowing the details of list_models()
and compact()
.
You can try running rlang::last_trace()
to get more information about where the error occurred in your code. This may give you some clues as to what the issue might be.
MY SOLUTION:
DELETE " %>%
map_dfr(compact) "
Now it works.
Can I specify to use GPT 4 engine instead of GPT 3.5?
After following the installation and set-up steps (here), when I click on the XXX, I received this message:
Error in (function(prompt=rstudioapi::getConsoleEditorContext()$contents,:list(message = "You exceeded your current quota, please check your plan billing details", type = "insuficient_quota", param = NULL, code = NULL)
...
I was wondering if is mandatory to pay to use the API, is that the main problem?
Thanks!
Thank you so much for building and maintaining this!
I'm wondering if CRAN submission is on the roadmap.
And if you intend to make a reference website as well. Often handy for quickly sending around the function documentation.
Also wondering how we should think about this package in contrast with irudnyts's package?
Thank you 🙏
I get the following error, both as a dialog and on the shell.
Error in (function (prompt = rstudioapi::getConsoleEditorContext()$contents, :
list(message = "This model's maximum context length is 4097 tokens. However, you requested 4105 tokens (101 in the messages, 4004 in the completion). Please reduce the length of the messages or completion.", type = "invalid_request_error", param = "messages", code = "context_length_exceeded")
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.