Skip to content

Conversation

huiwengoh
Copy link
Collaborator

No description provided.



def _extract_perplexity(response: "ChatCompletion") -> Optional[float]:
response_logprobs = response.choices[0].logprobs
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this won't ever cause an error for any OpenAI LLM?
I'd imagine its safer to check if the key logprobs exists

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Afaik this always exists, I've encapsulated this entire function in a try / except block tho so even if something weird happens with extracting logprobs the entire call will not fail (it will just not include perplexity)

Copy link
Member

@jwmueller jwmueller left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

doublecheck ppl definition

@huiwengoh huiwengoh requested a review from jwmueller August 13, 2025 22:02
Copy link
Member

@jwmueller jwmueller left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Could you update the PR description to briefly state what tests you ran this code on (and results of those tests)?

Code looks right to me, but seeing test results would be more reassuring.

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

Successfully merging this pull request may close these issues.

2 participants