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

[OpenAI] Support Top Logprob in Chat Completions #29432

Open
wants to merge 5 commits into
base: main
Choose a base branch
from

Conversation

minhanh-phan
Copy link
Contributor

@minhanh-phan minhanh-phan commented Apr 25, 2024

Packages impacted by this PR

@azure/openai

Issues associated with this PR

#29199

Describe the problem that is addressed by this PR

What are the possible designs available to address the problem? If there are more than one possible design, why was the one in this PR chosen?

Are there test cases added in this PR? (If not, why?)

Provide a list of related PRs (if any)

Command used to generate this PR:**(Applicable only to SDK release request PRs)

Checklists

  • Added impacted package name to the issue description
  • Does this PR needs any fixes in the SDK Generator?** (If so, create an Issue in the Autorest/typescript repository and link it here)
  • Added a changelog (if necessary)

@azure-sdk
Copy link
Collaborator

API change check

APIView has identified API level changes in this PR and created following API reviews.

@azure/openai

sdk/openai/openai/tst.txt Outdated Show resolved Hide resolved
sdk/openai/openai/test/public/completions.spec.ts Outdated Show resolved Hide resolved
sdk/openai/openai/src/models/options.ts Outdated Show resolved Hide resolved
sdk/openai/openai/src/models/options.ts Outdated Show resolved Hide resolved
Comment on lines +240 to +245
logprobs?: boolean;
/**
* An integer between 0 and 5 specifying the number of most likely tokens to return at each token position,
* each with an associated log probability. `logprobs` must be set to `true` if this parameter is used.
*/
topLogprobs?: number;
Copy link
Member

Choose a reason for hiding this comment

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

I wonder do we need two knobs to control this feature? can't we just do with topLogprobs? Perhaps it is more of a question to the architects.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

This is a pattern in OpenAI API, so seems like most languages are surfacing the pattern. In .NET, they rename logprobs as EnableLogProbabilities and topLogprobs as LogProbabilitiesPerToken.

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

Successfully merging this pull request may close these issues.

None yet

3 participants