Skip to content

Commit b0b3a8b

Browse files
authored
[AI] Remove CandidateCount form LiveGenerationConfig (#7382)
The parameter is not only unused, but can cause an error in the backend if specified. Internal b/439861714
1 parent 9a18f74 commit b0b3a8b

File tree

4 files changed

+2
-23
lines changed

4 files changed

+2
-23
lines changed

firebase-ai/CHANGELOG.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,7 @@
11
# Unreleased
22

3+
- [changed] **Breaking Change**: Removed the `candidateCount` option from `LiveGenerationConfig`
4+
(#7382)
35
- [changed] Bumped internal dependencies.
46
- [feature] Added support for code execution.
57
- [changed] Marked the public constructors for `ExecutableCodePart` and `CodeExecutionResultPart` as
@@ -31,8 +33,6 @@
3133

3234
# 17.1.0
3335

34-
=======
35-
3636
- [feature] added support for Imagen Editing, including inpainting, outpainting, control, style
3737
transfer, and subject references (#7075)
3838

firebase-ai/api.txt

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -823,7 +823,6 @@ package com.google.firebase.ai.type {
823823
public static final class LiveGenerationConfig.Builder {
824824
ctor public LiveGenerationConfig.Builder();
825825
method public com.google.firebase.ai.type.LiveGenerationConfig build();
826-
method public com.google.firebase.ai.type.LiveGenerationConfig.Builder setCandidateCount(Integer? candidateCount);
827826
method public com.google.firebase.ai.type.LiveGenerationConfig.Builder setFrequencyPenalty(Float? frequencyPenalty);
828827
method public com.google.firebase.ai.type.LiveGenerationConfig.Builder setMaxOutputTokens(Integer? maxOutputTokens);
829828
method public com.google.firebase.ai.type.LiveGenerationConfig.Builder setPresencePenalty(Float? presencePenalty);
@@ -832,7 +831,6 @@ package com.google.firebase.ai.type {
832831
method public com.google.firebase.ai.type.LiveGenerationConfig.Builder setTemperature(Float? temperature);
833832
method public com.google.firebase.ai.type.LiveGenerationConfig.Builder setTopK(Integer? topK);
834833
method public com.google.firebase.ai.type.LiveGenerationConfig.Builder setTopP(Float? topP);
835-
field public Integer? candidateCount;
836834
field public Float? frequencyPenalty;
837835
field public Integer? maxOutputTokens;
838836
field public Float? presencePenalty;

firebase-ai/src/main/kotlin/com/google/firebase/ai/type/LiveGenerationConfig.kt

Lines changed: 0 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -40,13 +40,6 @@ import kotlinx.serialization.Serializable
4040
* and the topP value is 0.5, then the model will select either A or B as the next token by using
4141
* the `temperature` and exclude C as a candidate. Defaults to 0.95 if unset.
4242
*
43-
* @property candidateCount The maximum number of generated response messages to return. This value
44-
* must be between [1, 8], inclusive. If unset, this will default to 1.
45-
*
46-
* - Note: Only unique candidates are returned. Higher temperatures are more likely to produce
47-
* unique candidates. Setting `temperature` to 0 will always produce exactly one candidate
48-
* regardless of the `candidateCount`.
49-
*
5043
* @property presencePenalty Positive penalties.
5144
*
5245
* @property frequencyPenalty Frequency penalties.
@@ -70,7 +63,6 @@ private constructor(
7063
internal val temperature: Float?,
7164
internal val topK: Int?,
7265
internal val topP: Float?,
73-
internal val candidateCount: Int?,
7466
internal val maxOutputTokens: Int?,
7567
internal val presencePenalty: Float?,
7668
internal val frequencyPenalty: Float?,
@@ -94,8 +86,6 @@ private constructor(
9486
*
9587
* @property frequencyPenalty See [LiveGenerationConfig.frequencyPenalty]
9688
*
97-
* @property candidateCount See [LiveGenerationConfig.candidateCount].
98-
*
9989
* @property maxOutputTokens See [LiveGenerationConfig.maxOutputTokens].
10090
*
10191
* @property responseModality See [LiveGenerationConfig.responseModality]
@@ -106,7 +96,6 @@ private constructor(
10696
@JvmField public var temperature: Float? = null
10797
@JvmField public var topK: Int? = null
10898
@JvmField public var topP: Float? = null
109-
@JvmField public var candidateCount: Int? = null
11099
@JvmField public var maxOutputTokens: Int? = null
111100
@JvmField public var presencePenalty: Float? = null
112101
@JvmField public var frequencyPenalty: Float? = null
@@ -118,9 +107,6 @@ private constructor(
118107
}
119108
public fun setTopK(topK: Int?): Builder = apply { this.topK = topK }
120109
public fun setTopP(topP: Float?): Builder = apply { this.topP = topP }
121-
public fun setCandidateCount(candidateCount: Int?): Builder = apply {
122-
this.candidateCount = candidateCount
123-
}
124110
public fun setMaxOutputTokens(maxOutputTokens: Int?): Builder = apply {
125111
this.maxOutputTokens = maxOutputTokens
126112
}
@@ -143,7 +129,6 @@ private constructor(
143129
temperature = temperature,
144130
topK = topK,
145131
topP = topP,
146-
candidateCount = candidateCount,
147132
maxOutputTokens = maxOutputTokens,
148133
presencePenalty = presencePenalty,
149134
frequencyPenalty = frequencyPenalty,
@@ -157,7 +142,6 @@ private constructor(
157142
temperature = temperature,
158143
topP = topP,
159144
topK = topK,
160-
candidateCount = candidateCount,
161145
maxOutputTokens = maxOutputTokens,
162146
frequencyPenalty = frequencyPenalty,
163147
presencePenalty = presencePenalty,
@@ -172,7 +156,6 @@ private constructor(
172156
val temperature: Float?,
173157
@SerialName("top_p") val topP: Float?,
174158
@SerialName("top_k") val topK: Int?,
175-
@SerialName("candidate_count") val candidateCount: Int?,
176159
@SerialName("max_output_tokens") val maxOutputTokens: Int?,
177160
@SerialName("presence_penalty") val presencePenalty: Float? = null,
178161
@SerialName("frequency_penalty") val frequencyPenalty: Float? = null,
@@ -201,7 +184,6 @@ private constructor(
201184
* temperature = 0.75f
202185
* topP = 0.5f
203186
* topK = 30
204-
* candidateCount = 4
205187
* maxOutputTokens = 300
206188
* ...
207189
* }

firebase-ai/src/testUtil/java/com/google/firebase/ai/JavaCompileTests.java

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -141,7 +141,6 @@ private LiveGenerationConfig getLiveConfig() {
141141
.setTopK(10)
142142
.setTopP(11.0F)
143143
.setTemperature(32.0F)
144-
.setCandidateCount(1)
145144
.setMaxOutputTokens(0xCAFEBABE)
146145
.setFrequencyPenalty(1.0F)
147146
.setPresencePenalty(2.0F)

0 commit comments

Comments
 (0)