Closed pvsundar closed 1 year ago
I'm not sure why things didn't work for you. Can you tell me what version of dplyr and purrr you have installed? Regardless, the demo is really to showcase the function openai::list_models()
. Does that seem to run correctly for you?
Everything works great now. Thank you. ‘dplyr’ version 1.1.0 A great service. Here is my code:
library(openai) library(purrr) library(remotes) remotes::install_github("jcrodriguez1989/chatgpt")
install.packages("devtools") devtools::install_github("samterfa/openai")
Sys.setenv(OPENAI_API_KEY = " API-KEY-HERE ")
Sys.setenv(openai_secret_key = {"API-KEY-HERE"})
list_models() %>% pluck('data')
list_models() %>% pluck('data') %>% map_dfr(compact)
create_image( prompt = "A male Professor and a female Professor having a discussion at I.I.T. Delhi campus", n = 1, response_format = "url")
create_completion( model = 'davinci', max_tokens = 30, temperature = .5, top_p = 1, n = 1, stream = F, prompt = 'Once upon a time')
create_completion( model = 'davinci', max_tokens = 30, temperature = .5, top_p = 1, n = 1, stream = F, prompt = 'Once there was a pink giant') %>% pluck('choices') %>% map_chr(~ .x$text)
I'm not sure why things didn't work for you. Can you tell me what version of dplyr and purrr you have installed? Regardless, the demo is really to showcase the function r list_models(). Does that seem to run correctly for you?
YES
— Reply to this email directly, view it on GitHubhttps://urldefense.com/v3/__https:/github.com/samterfa/openai/issues/1*issuecomment-1477201375__;Iw!!K-Hz7m0Vt54!m8hE3eIly769JN1RovHCVN7e4Qrb2WDKiLiDyoOalaZOOxPT30d2Ojh08NSfuujZoa235lZ0_LI3Fjl01bqjfg$, or unsubscribehttps://urldefense.com/v3/__https:/github.com/notifications/unsubscribe-auth/AY6SFRP73GXR53LE2NQC4LDW5EIAZANCNFSM6AAAAAAWBXM65Y__;!!K-Hz7m0Vt54!m8hE3eIly769JN1RovHCVN7e4Qrb2WDKiLiDyoOalaZOOxPT30d2Ojh08NSfuujZoa235lZ0_LI3Fjm-JQc6vw$. You are receiving this because you authored the thread.Message ID: @.**@.>>
list_models() %>% pluck('data') %>% map_dfr(compact) Error in
dplyr::bind_rows()
: ! Argument 1 must be a data frame or a named atomic vector. Runrlang::last_trace()
to see where the error occurred. Warning message: Outer names are only allowed for unnamed scalar atomic inputsListening 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. Runrlang::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 thecompact()
function that is being used inmap_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 oflist_models()
andcompact()
.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.