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

feat: Include logprobs in result metadata from ChatOpenAI #535

Merged
merged 1 commit into from
Aug 21, 2024

Conversation

davidmigloz
Copy link
Owner

@davidmigloz davidmigloz commented Aug 21, 2024

Include log probability information for the generation (result.metadata.logprobs).

  • token: The token.
  • logprob: The log probability of this token, if it is within the top 20 most likely tokens. Otherwise, the value -9999.0 is used to signify that the token is very unlikely.
  • bytes: 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.
    required List? bytes,
  • topLogprobs: 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.

@davidmigloz davidmigloz self-assigned this Aug 21, 2024
@davidmigloz davidmigloz added t:enhancement New feature or request c:chat-models Chat models. p:langchain_openai langchain_openai package. labels Aug 21, 2024
@davidmigloz davidmigloz added this to the v0.8.0 milestone Aug 21, 2024
@davidmigloz davidmigloz merged commit 1834b3a into main Aug 21, 2024
1 check passed
@davidmigloz davidmigloz deleted the logprobs branch August 21, 2024 21:09
KennethKnudsen97 pushed a commit to KennethKnudsen97/langchain_dart that referenced this pull request Oct 1, 2024
KennethKnudsen97 pushed a commit to KennethKnudsen97/langchain_dart that referenced this pull request Oct 1, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
c:chat-models Chat models. p:langchain_openai langchain_openai package. t:enhancement New feature or request
Projects
Status: Done
Development

Successfully merging this pull request may close these issues.

1 participant