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

Add frequencePenalty and presencePenalty parameters support for gener… #264

Merged
merged 5 commits into from
Sep 25, 2024

Conversation

junyanxu
Copy link
Collaborator

…ate content.

presencePenalty?: number
// Frequency penalty applied to the next token's logprobs, multiplied by the
// number of times each token has been seen in the respponse so far.
frequencePenalty?: number
Copy link
Collaborator

Choose a reason for hiding this comment

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

spelling: "frequency" - probably need to search/replace

Copy link
Collaborator

@hsubox76 hsubox76 left a comment

Choose a reason for hiding this comment

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

Looking pretty good, a couple comments.

@@ -31,6 +31,12 @@ import {
export interface BaseParams {
safetySettings?: SafetySetting[];
generationConfig?: GenerationConfig;
// Presence penalty applied to the next token's logprobs if the token has
Copy link
Collaborator

Choose a reason for hiding this comment

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

In order to show up in the documentation, comments need to be in block format, e.g.

/**
 * Presence penalty applied to the next token's logprobs if the token has
 * already been seen in the response.
 */

For reference: https://api-extractor.com/pages/tsdoc/doc_comment_syntax/

"@google/generative-ai": minor
---

Add frequencePenalty and presencePenalty parameters support for generate content.
Copy link
Collaborator

Choose a reason for hiding this comment

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

This will show up as a release note in the public changelog so we try to do our best to format it for public consumption. You can use backticks to format code literals and symbols. Suggestion:

Add `frequencyPenalty` and `presencePenalty` parameters support for `generateContent()`.

Copy link
Collaborator

@hsubox76 hsubox76 left a comment

Choose a reason for hiding this comment

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

LGTM! Thanks for adding doc comments for the new parameters, the old ones don't really have any, this will be helpful.

@junyanxu junyanxu merged commit dda0b5c into main Sep 25, 2024
8 of 9 checks passed
@junyanxu junyanxu deleted the rev_14_new_params branch September 25, 2024 23:53
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