Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -725,6 +725,9 @@ private GenerationConfig toGenerationConfig(VertexAiGeminiChatOptions options) {
if (options.getTopK() != null) {
generationConfigBuilder.setTopK(options.getTopK());
}
if (options.getSeed() != null) {
generationConfigBuilder.setSeed(options.getSeed());
}
if (options.getTopP() != null) {
generationConfigBuilder.setTopP(options.getTopP().floatValue());
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -88,6 +88,14 @@ public class VertexAiGeminiChatOptions implements ToolCallingChatOptions {
*/
private @JsonProperty("topK") Integer topK;

/**
* Optional. When seed is fixed to a specific value, the model makes a best effort to provide the same response for
* repeated requests. Deterministic output isn't guaranteed. Also, changing the model or parameter settings, such
* as the temperature, can cause variations in the response even when you use the same seed value.
* By default, a random seed value is used.
*/
private @JsonProperty("seed") Integer seed;

/**
* Optional. The maximum number of tokens to generate.
*/
Expand Down Expand Up @@ -183,6 +191,7 @@ public static VertexAiGeminiChatOptions fromOptions(VertexAiGeminiChatOptions fr
options.setToolContext(fromOptions.getToolContext());
options.setLogprobs(fromOptions.getLogprobs());
options.setResponseLogprobs(fromOptions.getResponseLogprobs());
options.setSeed(fromOptions.getSeed());
return options;
}

Expand Down Expand Up @@ -226,6 +235,14 @@ public void setTopK(Integer topK) {
this.topK = topK;
}

public Integer getSeed() {
return this.seed;
}

public void setSeed(Integer seed) {
this.seed = seed;
}

public Integer getCandidateCount() {
return this.candidateCount;
}
Expand Down Expand Up @@ -393,7 +410,7 @@ public boolean equals(Object o) {
&& Objects.equals(this.safetySettings, that.safetySettings)
&& Objects.equals(this.internalToolExecutionEnabled, that.internalToolExecutionEnabled)
&& Objects.equals(this.toolContext, that.toolContext) && Objects.equals(this.logprobs, that.logprobs)
&& Objects.equals(this.responseLogprobs, that.responseLogprobs);
&& Objects.equals(this.responseLogprobs, that.responseLogprobs) && Objects.equals(this.seed, that.seed);
}

@Override
Expand All @@ -402,7 +419,7 @@ public int hashCode() {
this.frequencyPenalty, this.presencePenalty, this.maxOutputTokens, this.model, this.responseMimeType,
this.responseSchema, this.toolCallbacks, this.toolNames, this.googleSearchRetrieval,
this.safetySettings, this.internalToolExecutionEnabled, this.toolContext, this.logprobs,
this.responseLogprobs);
this.responseLogprobs, this.seed);
}

@Override
Expand All @@ -414,7 +431,7 @@ public String toString() {
+ ", responseMimeType='" + this.responseMimeType + '\'' + ", responseSchema='" + this.responseSchema
+ ", toolCallbacks=" + this.toolCallbacks + ", toolNames=" + this.toolNames + ", googleSearchRetrieval="
+ this.googleSearchRetrieval + ", safetySettings=" + this.safetySettings + ", logProbs=" + this.logprobs
+ ", responseLogprobs=" + this.responseLogprobs + '}';
+ ", responseLogprobs=" + this.responseLogprobs + ", seed=" + this.seed + '}';
}

@Override
Expand Down Expand Up @@ -452,6 +469,11 @@ public Builder topK(Integer topK) {
return this;
}

public Builder seed(Integer seed) {
this.options.setSeed(seed);
return this;
}

public Builder frequencyPenalty(Double frequencyPenalty) {
this.options.setFrequencyPenalty(frequencyPenalty);
return this;
Expand Down