Update ChatGPT default temperature
Set the default temperature for ChatGPT queries from 1.0 to 0.2, aiming
for more deterministic and conservative responses from the model.
Jira-Id: IT-103
Change-Id: Id7e29dbb77aebe6a8804c1f72e2d249b29d800fd
Signed-off-by: Patrizio <patrizio.gelosi@amarulasolutions.com>
diff --git a/README.md b/README.md
index 02fcc5b..d159dd4 100644
--- a/README.md
+++ b/README.md
@@ -117,7 +117,7 @@
- `gptModel`: The default model is gpt-3.5-turbo. You can also configure it to gpt-3.5-turbo-16k, gpt-4 or gpt-4-32k.
- `gptDomain`: The default ChatGPT domain is `https://api.openai.com`.
- `gptSystemPrompt`: You can modify the default system prompt ("Act as a PatchSet Reviewer") to your preferred prompt.
-- `gptTemperature`: The default value is 1. What sampling temperature to use, between 0 and 2. Higher values like 0.8
+- `gptTemperature`: The default value is 0.2. What sampling temperature to use, between 0 and 2. Higher values like 0.8
will make the output more random, while lower values like 0.2 will make it more focused and deterministic.
- `gptReviewPatchSet`: Set to true by default. When switched to false, it disables the automatic review of Patch Sets as
they are created or updated.
diff --git a/src/main/java/com/googlesource/gerrit/plugins/chatgpt/config/Configuration.java b/src/main/java/com/googlesource/gerrit/plugins/chatgpt/config/Configuration.java
index 85b0a6f..2545376 100644
--- a/src/main/java/com/googlesource/gerrit/plugins/chatgpt/config/Configuration.java
+++ b/src/main/java/com/googlesource/gerrit/plugins/chatgpt/config/Configuration.java
@@ -26,7 +26,7 @@
// Default Config values
public static final String OPENAI_DOMAIN = "https://api.openai.com";
public static final String DEFAULT_GPT_MODEL = "gpt-3.5-turbo";
- private static final String DEFAULT_GPT_TEMPERATURE = "1";
+ private static final double DEFAULT_GPT_TEMPERATURE = 0.2;
private static final boolean DEFAULT_REVIEW_PATCH_SET = true;
private static final boolean DEFAULT_REVIEW_COMMIT_MESSAGES = false;
private static final boolean DEFAULT_FULL_FILE_REVIEW = true;
@@ -199,7 +199,7 @@
}
public double getGptTemperature() {
- return Double.parseDouble(getString(KEY_GPT_TEMPERATURE, DEFAULT_GPT_TEMPERATURE));
+ return Double.parseDouble(getString(KEY_GPT_TEMPERATURE, String.valueOf(DEFAULT_GPT_TEMPERATURE)));
}
public boolean getGptReviewPatchSet() {