-
Notifications
You must be signed in to change notification settings - Fork 191
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add responseLogProbs and logProbs parameters to generateContentReq (#266
) * Add responseLogProbs and logProbs parameters to generateContentReq * update docs & test * Update docs and add avglogprobs and logprobsresult as output * update variable names in responses.ts * Move parameters to GenerationConfig * Update test cases for new parameters to test generationConfig * Updated generatecontentresponse testcase * Update case of logprobs * put back parameters in test case
- Loading branch information
1 parent
dda0b5c
commit b3d1e01
Showing
30 changed files
with
420 additions
and
68 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
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
13 changes: 13 additions & 0 deletions
13
docs/reference/main/generative-ai.generatecontentcandidate.avglogprobs.md
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,13 @@ | ||
<!-- Do not edit this file. It is automatically generated by API Documenter. --> | ||
|
||
[Home](./index.md) > [@google/generative-ai](./generative-ai.md) > [GenerateContentCandidate](./generative-ai.generatecontentcandidate.md) > [avgLogprobs](./generative-ai.generatecontentcandidate.avglogprobs.md) | ||
|
||
## GenerateContentCandidate.avgLogprobs property | ||
|
||
Average log probability score of the candidate. | ||
|
||
**Signature:** | ||
|
||
```typescript | ||
avgLogprobs?: number; | ||
``` |
13 changes: 13 additions & 0 deletions
13
docs/reference/main/generative-ai.generatecontentcandidate.logprobsresult.md
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,13 @@ | ||
<!-- Do not edit this file. It is automatically generated by API Documenter. --> | ||
|
||
[Home](./index.md) > [@google/generative-ai](./generative-ai.md) > [GenerateContentCandidate](./generative-ai.generatecontentcandidate.md) > [logprobsResult](./generative-ai.generatecontentcandidate.logprobsresult.md) | ||
|
||
## GenerateContentCandidate.logprobsResult property | ||
|
||
Log-likelihood scores for the response tokens and top tokens. | ||
|
||
**Signature:** | ||
|
||
```typescript | ||
logprobsResult?: LogprobsResult; | ||
``` |
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
4 changes: 2 additions & 2 deletions
4
...erative-ai.baseparams.frequencypenalty.md → ...e-ai.generationconfig.frequencypenalty.md
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
13 changes: 13 additions & 0 deletions
13
docs/reference/main/generative-ai.generationconfig.logprobs.md
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,13 @@ | ||
<!-- Do not edit this file. It is automatically generated by API Documenter. --> | ||
|
||
[Home](./index.md) > [@google/generative-ai](./generative-ai.md) > [GenerationConfig](./generative-ai.generationconfig.md) > [logprobs](./generative-ai.generationconfig.logprobs.md) | ||
|
||
## GenerationConfig.logprobs property | ||
|
||
Valid if responseLogProbs is set to True. This will set the number of top logprobs to return at each decoding step in the logprobsResult. | ||
|
||
**Signature:** | ||
|
||
```typescript | ||
logprobs?: number; | ||
``` |
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
4 changes: 2 additions & 2 deletions
4
...nerative-ai.baseparams.presencepenalty.md → ...ve-ai.generationconfig.presencepenalty.md
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
13 changes: 13 additions & 0 deletions
13
docs/reference/main/generative-ai.generationconfig.responselogprobs.md
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,13 @@ | ||
<!-- Do not edit this file. It is automatically generated by API Documenter. --> | ||
|
||
[Home](./index.md) > [@google/generative-ai](./generative-ai.md) > [GenerationConfig](./generative-ai.generationconfig.md) > [responseLogprobs](./generative-ai.generationconfig.responselogprobs.md) | ||
|
||
## GenerationConfig.responseLogprobs property | ||
|
||
If True, export the logprobs results in response. | ||
|
||
**Signature:** | ||
|
||
```typescript | ||
responseLogprobs?: boolean; | ||
``` |
11 changes: 0 additions & 11 deletions
11
docs/reference/main/generative-ai.generativemodel.frequencypenalty.md
This file was deleted.
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
11 changes: 0 additions & 11 deletions
11
docs/reference/main/generative-ai.generativemodel.presencepenalty.md
This file was deleted.
Oops, something went wrong.
13 changes: 13 additions & 0 deletions
13
docs/reference/main/generative-ai.logprobscandidate.logprobability.md
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,13 @@ | ||
<!-- Do not edit this file. It is automatically generated by API Documenter. --> | ||
|
||
[Home](./index.md) > [@google/generative-ai](./generative-ai.md) > [LogprobsCandidate](./generative-ai.logprobscandidate.md) > [logProbability](./generative-ai.logprobscandidate.logprobability.md) | ||
|
||
## LogprobsCandidate.logProbability property | ||
|
||
The candidate's log probability. | ||
|
||
**Signature:** | ||
|
||
```typescript | ||
logProbability: number; | ||
``` |
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,22 @@ | ||
<!-- Do not edit this file. It is automatically generated by API Documenter. --> | ||
|
||
[Home](./index.md) > [@google/generative-ai](./generative-ai.md) > [LogprobsCandidate](./generative-ai.logprobscandidate.md) | ||
|
||
## LogprobsCandidate interface | ||
|
||
Candidate for the logprobs token and score. | ||
|
||
**Signature:** | ||
|
||
```typescript | ||
export interface LogprobsCandidate | ||
``` | ||
|
||
## Properties | ||
|
||
| Property | Modifiers | Type | Description | | ||
| --- | --- | --- | --- | | ||
| [logProbability](./generative-ai.logprobscandidate.logprobability.md) | | number | The candidate's log probability. | | ||
| [token](./generative-ai.logprobscandidate.token.md) | | string | The candidate's token string value. | | ||
| [tokenID](./generative-ai.logprobscandidate.tokenid.md) | | number | The candidate's token id value. | | ||
|
13 changes: 13 additions & 0 deletions
13
docs/reference/main/generative-ai.logprobscandidate.token.md
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,13 @@ | ||
<!-- Do not edit this file. It is automatically generated by API Documenter. --> | ||
|
||
[Home](./index.md) > [@google/generative-ai](./generative-ai.md) > [LogprobsCandidate](./generative-ai.logprobscandidate.md) > [token](./generative-ai.logprobscandidate.token.md) | ||
|
||
## LogprobsCandidate.token property | ||
|
||
The candidate's token string value. | ||
|
||
**Signature:** | ||
|
||
```typescript | ||
token: string; | ||
``` |
13 changes: 13 additions & 0 deletions
13
docs/reference/main/generative-ai.logprobscandidate.tokenid.md
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,13 @@ | ||
<!-- Do not edit this file. It is automatically generated by API Documenter. --> | ||
|
||
[Home](./index.md) > [@google/generative-ai](./generative-ai.md) > [LogprobsCandidate](./generative-ai.logprobscandidate.md) > [tokenID](./generative-ai.logprobscandidate.tokenid.md) | ||
|
||
## LogprobsCandidate.tokenID property | ||
|
||
The candidate's token id value. | ||
|
||
**Signature:** | ||
|
||
```typescript | ||
tokenID: number; | ||
``` |
13 changes: 13 additions & 0 deletions
13
docs/reference/main/generative-ai.logprobsresult.chosencandidates.md
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,13 @@ | ||
<!-- Do not edit this file. It is automatically generated by API Documenter. --> | ||
|
||
[Home](./index.md) > [@google/generative-ai](./generative-ai.md) > [LogprobsResult](./generative-ai.logprobsresult.md) > [chosenCandidates](./generative-ai.logprobsresult.chosencandidates.md) | ||
|
||
## LogprobsResult.chosenCandidates property | ||
|
||
Length = total number of decoding steps. The chosen candidates may or may not be in topCandidates. | ||
|
||
**Signature:** | ||
|
||
```typescript | ||
chosenCandidates: LogprobsCandidate[]; | ||
``` |
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,21 @@ | ||
<!-- Do not edit this file. It is automatically generated by API Documenter. --> | ||
|
||
[Home](./index.md) > [@google/generative-ai](./generative-ai.md) > [LogprobsResult](./generative-ai.logprobsresult.md) | ||
|
||
## LogprobsResult interface | ||
|
||
Logprobs Result | ||
|
||
**Signature:** | ||
|
||
```typescript | ||
export interface LogprobsResult | ||
``` | ||
|
||
## Properties | ||
|
||
| Property | Modifiers | Type | Description | | ||
| --- | --- | --- | --- | | ||
| [chosenCandidates](./generative-ai.logprobsresult.chosencandidates.md) | | [LogprobsCandidate](./generative-ai.logprobscandidate.md)<!-- -->\[\] | Length = total number of decoding steps. The chosen candidates may or may not be in topCandidates. | | ||
| [topCandidates](./generative-ai.logprobsresult.topcandidates.md) | | [TopCandidates](./generative-ai.topcandidates.md)<!-- -->\[\] | Length = total number of decoding steps. | | ||
|
13 changes: 13 additions & 0 deletions
13
docs/reference/main/generative-ai.logprobsresult.topcandidates.md
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,13 @@ | ||
<!-- Do not edit this file. It is automatically generated by API Documenter. --> | ||
|
||
[Home](./index.md) > [@google/generative-ai](./generative-ai.md) > [LogprobsResult](./generative-ai.logprobsresult.md) > [topCandidates](./generative-ai.logprobsresult.topcandidates.md) | ||
|
||
## LogprobsResult.topCandidates property | ||
|
||
Length = total number of decoding steps. | ||
|
||
**Signature:** | ||
|
||
```typescript | ||
topCandidates: TopCandidates[]; | ||
``` |
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
13 changes: 13 additions & 0 deletions
13
docs/reference/main/generative-ai.topcandidates.candidates.md
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,13 @@ | ||
<!-- Do not edit this file. It is automatically generated by API Documenter. --> | ||
|
||
[Home](./index.md) > [@google/generative-ai](./generative-ai.md) > [TopCandidates](./generative-ai.topcandidates.md) > [candidates](./generative-ai.topcandidates.candidates.md) | ||
|
||
## TopCandidates.candidates property | ||
|
||
Sorted by log probability in descending order. | ||
|
||
**Signature:** | ||
|
||
```typescript | ||
candidates: LogprobsCandidate[]; | ||
``` |
Oops, something went wrong.