Commit 6e23afc
feat(vertexai): Add repetition penalties to GenerationConfig (#17234)
* feat: Add presencePenalty and frequencyPenalty to GenerationConfig
This commit adds two new instance variables, and
, to the class. These variables
control the likelihood of repeating words or phrases in the generated text.
The implementation is based on the Swift SDK and includes corresponding
documentation.
Note: Unable to run tests due to unavailable test execution environment.
* Use Dartdoc formatting
* Add test for presencePenalty and frequencyPenalty
* Move new fields into `BaseGenerationConfig`
* Add `presencePenalty` and `frequencyPenalty` to `LiveGenerationConfig`
* Reword repetition penalties docs
* Link to Firebase docs instead of Cloud docs for repetition penalties
Both `presencePenalty` and `frequencyPenalty` have now been added to:
https://firebase.google.com/docs/vertex-ai/model-parameters?platform=flutter#configure-model-parameters-gemini
---------
Co-authored-by: google-labs-jules[bot] <161369871+google-labs-jules[bot]@users.noreply.github.com>1 parent a7a842e commit 6e23afc
3 files changed
Lines changed: 62 additions & 0 deletions
File tree
- packages/firebase_vertexai/firebase_vertexai
- lib/src
- test
Lines changed: 43 additions & 0 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
659 | 659 | | |
660 | 660 | | |
661 | 661 | | |
| 662 | + | |
| 663 | + | |
662 | 664 | | |
663 | 665 | | |
664 | 666 | | |
| |||
700 | 702 | | |
701 | 703 | | |
702 | 704 | | |
| 705 | + | |
| 706 | + | |
| 707 | + | |
| 708 | + | |
| 709 | + | |
| 710 | + | |
| 711 | + | |
| 712 | + | |
| 713 | + | |
| 714 | + | |
| 715 | + | |
| 716 | + | |
| 717 | + | |
| 718 | + | |
| 719 | + | |
| 720 | + | |
| 721 | + | |
| 722 | + | |
| 723 | + | |
| 724 | + | |
| 725 | + | |
| 726 | + | |
| 727 | + | |
| 728 | + | |
| 729 | + | |
| 730 | + | |
| 731 | + | |
| 732 | + | |
| 733 | + | |
| 734 | + | |
| 735 | + | |
| 736 | + | |
| 737 | + | |
| 738 | + | |
| 739 | + | |
703 | 740 | | |
704 | 741 | | |
705 | 742 | | |
| |||
709 | 746 | | |
710 | 747 | | |
711 | 748 | | |
| 749 | + | |
| 750 | + | |
| 751 | + | |
| 752 | + | |
712 | 753 | | |
713 | 754 | | |
714 | 755 | | |
| |||
722 | 763 | | |
723 | 764 | | |
724 | 765 | | |
| 766 | + | |
| 767 | + | |
725 | 768 | | |
726 | 769 | | |
727 | 770 | | |
| |||
Lines changed: 2 additions & 0 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
89 | 89 | | |
90 | 90 | | |
91 | 91 | | |
| 92 | + | |
| 93 | + | |
92 | 94 | | |
93 | 95 | | |
94 | 96 | | |
| |||
Lines changed: 17 additions & 0 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
176 | 176 | | |
177 | 177 | | |
178 | 178 | | |
| 179 | + | |
| 180 | + | |
| 181 | + | |
| 182 | + | |
| 183 | + | |
| 184 | + | |
| 185 | + | |
| 186 | + | |
| 187 | + | |
| 188 | + | |
| 189 | + | |
| 190 | + | |
| 191 | + | |
| 192 | + | |
| 193 | + | |
| 194 | + | |
| 195 | + | |
179 | 196 | | |
180 | 197 | | |
181 | 198 | | |
| |||
0 commit comments