Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

logprobs for chat completions only in python ver #56

Open
csterbenz1 opened this issue Jan 3, 2024 · 1 comment
Open

logprobs for chat completions only in python ver #56

csterbenz1 opened this issue Jan 3, 2024 · 1 comment

Comments

@csterbenz1
Copy link

API was recently updated to return logprobs for chat completions but the change appears to be only present in the python version and not the R version. Would really appreciate everything up to date and ported over!

@irudnyts
Copy link
Owner

irudnyts commented Jan 9, 2024

Hi @csterbenz1, I totally agree! @openai should start contributing to this package and keep "everything up to date and ported over" 😂

Jokes aside, here is the feature you were looking for in the development version (do not forget to install it first):

remotes::install_github("irudnyts/openai", ref = "r6")
library(openai)

client <- OpenAI()
completion <- client$chat$completions$create(
    model = "gpt-3.5-turbo",
    messages = list(list("role" = "user", "content" = "What's up?")),
    logprobs = TRUE,
    top_logprobs = 2
)

completion$choices[[1]]$logprobs

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants