-
Notifications
You must be signed in to change notification settings - Fork 3.3k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat(api): add token logprobs to chat completions (#980)
- Loading branch information
1 parent
215476a
commit f50e962
Showing
14 changed files
with
255 additions
and
61 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Large diffs are not rendered by default.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,47 @@ | ||
# File generated from our OpenAPI spec by Stainless. | ||
|
||
from typing import List, Optional | ||
|
||
from ..._models import BaseModel | ||
|
||
__all__ = ["ChatCompletionTokenLogprob", "TopLogprob"] | ||
|
||
|
||
class TopLogprob(BaseModel): | ||
token: str | ||
"""The token.""" | ||
|
||
bytes: Optional[List[int]] | ||
"""A list of integers representing the UTF-8 bytes representation of the token. | ||
Useful in instances where characters are represented by multiple tokens and | ||
their byte representations must be combined to generate the correct text | ||
representation. Can be `null` if there is no bytes representation for the token. | ||
""" | ||
|
||
logprob: float | ||
"""The log probability of this token.""" | ||
|
||
|
||
class ChatCompletionTokenLogprob(BaseModel): | ||
token: str | ||
"""The token.""" | ||
|
||
bytes: Optional[List[int]] | ||
"""A list of integers representing the UTF-8 bytes representation of the token. | ||
Useful in instances where characters are represented by multiple tokens and | ||
their byte representations must be combined to generate the correct text | ||
representation. Can be `null` if there is no bytes representation for the token. | ||
""" | ||
|
||
logprob: float | ||
"""The log probability of this token.""" | ||
|
||
top_logprobs: List[TopLogprob] | ||
"""List of the most likely tokens and their log probability, at this token | ||
position. | ||
In rare cases, there may be fewer than the number of requested `top_logprobs` | ||
returned. | ||
""" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.