Replies: 1 comment
|
For Chat Completions, pass logprobs=True and optionally top_logprobs: response = client.chat.completions.create(
model="gpt-4o-mini",
messages=[{"role": "user", "content": "hi"}],
logprobs=True,
top_logprobs=5,
)
print(response.choices[0].logprobs)Note: not every model/endpoint supports logprobs. If you are on the older Completions API, the param is still logprobs / top_logprobs there as well. |
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
I want to log top-k probabilities when using the API of completion, but I can't find any introductions to relevant APIs.
All reactions