Skip to content
Closed
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 @@ -18,6 +18,10 @@

public class VertexAiGeminiSafetySetting {

public static Builder builder() {
return new Builder();
}

/**
* Enum representing different threshold levels for blocking harmful content.
*/
Expand Down Expand Up @@ -77,51 +81,30 @@ public int getValue() {

}

private HarmCategory category;
private final HarmCategory category;

private HarmBlockThreshold threshold;
private final HarmBlockThreshold threshold;

private HarmBlockMethod method;

// Default constructor
public VertexAiGeminiSafetySetting() {
this.category = HarmCategory.HARM_CATEGORY_UNSPECIFIED;
this.threshold = HarmBlockThreshold.HARM_BLOCK_THRESHOLD_UNSPECIFIED;
this.method = HarmBlockMethod.HARM_BLOCK_METHOD_UNSPECIFIED;
}
private final HarmBlockMethod method;

// Constructor with all fields
public VertexAiGeminiSafetySetting(HarmCategory category, HarmBlockThreshold threshold, HarmBlockMethod method) {
private VertexAiGeminiSafetySetting(HarmCategory category, HarmBlockThreshold threshold, HarmBlockMethod method) {
this.category = category;
this.threshold = threshold;
this.method = method;
}

// Getters and setters
public HarmCategory getCategory() {
return this.category;
}

public void setCategory(HarmCategory category) {
this.category = category;
}

public HarmBlockThreshold getThreshold() {
return this.threshold;
}

public void setThreshold(HarmBlockThreshold threshold) {
this.threshold = threshold;
}

public HarmBlockMethod getMethod() {
return this.method;
}

public void setMethod(HarmBlockMethod method) {
this.method = method;
}

@Override
public String toString() {
return "SafetySetting{" + "category=" + this.category + ", threshold=" + this.threshold + ", method="
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -117,7 +117,7 @@ void googleSearchToolFlash() {
@Test
@Disabled
void testSafetySettings() {
List<VertexAiGeminiSafetySetting> safetySettings = List.of(new VertexAiGeminiSafetySetting.Builder()
List<VertexAiGeminiSafetySetting> safetySettings = List.of(VertexAiGeminiSafetySetting.builder()
.withCategory(VertexAiGeminiSafetySetting.HarmCategory.HARM_CATEGORY_DANGEROUS_CONTENT)
.withThreshold(VertexAiGeminiSafetySetting.HarmBlockThreshold.BLOCK_LOW_AND_ABOVE)
.build());
Expand Down