Default model/temperature

pull/215/head
M66B 8 months ago
parent 5c7f366e30
commit 8733388ce7

@ -2702,8 +2702,8 @@ public class FragmentCompose extends FragmentBase {
return null;
SharedPreferences prefs = PreferenceManager.getDefaultSharedPreferences(context);
String model = prefs.getString("openai_model", "gpt-3.5-turbo");
float temperature = prefs.getFloat("openai_temperature", 0.5f);
String model = prefs.getString("openai_model", OpenAI.DEFAULT_MODEL);
float temperature = prefs.getFloat("openai_temperature", OpenAI.DEFAULT_TEMPERATURE);
boolean moderation = prefs.getBoolean("openai_moderation", false);
if (moderation)
@ -2800,8 +2800,8 @@ public class FragmentCompose extends FragmentBase {
boolean selection = args.getBoolean("selection");
SharedPreferences prefs = PreferenceManager.getDefaultSharedPreferences(context);
String model = prefs.getString("gemini_model", "gemini-pro");
float temperature = prefs.getFloat("gemini_temperature", 0.9f);
String model = prefs.getString("gemini_model", Gemini.DEFAULT_MODEL);
float temperature = prefs.getFloat("gemini_temperature", Gemini.DEFAULT_TEMPERATURE);
Gemini.Message message = new Gemini.Message(Gemini.USER, new String[]{Gemini.truncateParagraphs(body)});

@ -109,8 +109,8 @@ public class FragmentDialogSummarize extends FragmentDialogBase {
return null;
if (OpenAI.isAvailable(context)) {
String model = prefs.getString("openai_model", "gpt-3.5-turbo");
float temperature = prefs.getFloat("openai_temperature", 0.5f);
String model = prefs.getString("openai_model", OpenAI.DEFAULT_MODEL);
float temperature = prefs.getFloat("openai_temperature", OpenAI.DEFAULT_TEMPERATURE);
String prompt = prefs.getString("openai_summarize", OpenAI.SUMMARY_PROMPT);
List<OpenAI.Message> result = new ArrayList<>();
@ -130,8 +130,8 @@ public class FragmentDialogSummarize extends FragmentDialogBase {
}
return sb.toString();
} else if (Gemini.isAvailable(context)) {
String model = prefs.getString("gemini_model", "gemini-pro");
float temperature = prefs.getFloat("gemini_temperature", 0.9f);
String model = prefs.getString("gemini_model", Gemini.DEFAULT_MODEL);
float temperature = prefs.getFloat("gemini_temperature", Gemini.DEFAULT_TEMPERATURE);
String prompt = prefs.getString("gemini_summarize", Gemini.SUMMARY_PROMPT);
Gemini.Message message = new Gemini.Message(Gemini.USER, new String[]{prompt, text});

@ -480,6 +480,7 @@ public class FragmentOptionsIntegrations extends FragmentBase implements SharedP
}
});
etOpenAiModel.setHint(OpenAI.DEFAULT_MODEL);
etOpenAiModel.addTextChangedListener(new TextWatcher() {
@Override
public void beforeTextChanged(CharSequence s, int start, int count, int after) {
@ -618,6 +619,7 @@ public class FragmentOptionsIntegrations extends FragmentBase implements SharedP
}
});
etGeminiModel.setHint(Gemini.DEFAULT_MODEL);
etGeminiModel.addTextChangedListener(new TextWatcher() {
@Override
public void beforeTextChanged(CharSequence s, int start, int count, int after) {
@ -787,7 +789,7 @@ public class FragmentOptionsIntegrations extends FragmentBase implements SharedP
etOpenAiModel.setText(prefs.getString("openai_model", null));
etOpenAiModel.setEnabled(swOpenAi.isChecked());
float temperature = prefs.getFloat("openai_temperature", 0.5f);
float temperature = prefs.getFloat("openai_temperature", OpenAI.DEFAULT_TEMPERATURE);
tvOpenAiTemperature.setText(getString(R.string.title_advanced_openai_temperature, NF.format(temperature)));
sbOpenAiTemperature.setProgress(Math.round(temperature * 10));
sbOpenAiTemperature.setEnabled(swOpenAi.isChecked());
@ -804,7 +806,7 @@ public class FragmentOptionsIntegrations extends FragmentBase implements SharedP
etGeminiModel.setText(prefs.getString("gemini_model", null));
etGeminiModel.setEnabled(swGemini.isChecked());
temperature = prefs.getFloat("gemini_temperature", 0.9f);
temperature = prefs.getFloat("gemini_temperature", Gemini.DEFAULT_TEMPERATURE);
tvGeminiTemperature.setText(getString(R.string.title_advanced_openai_temperature, NF.format(temperature)));
sbGeminiTemperature.setProgress(Math.round(temperature * 10));
sbGeminiTemperature.setEnabled(swGemini.isChecked());

@ -42,6 +42,8 @@ import java.util.Objects;
public class Gemini {
// https://ai.google.dev/models/gemini
static final String DEFAULT_MODEL = "gemini-pro";
static final float DEFAULT_TEMPERATURE = 0.9f;
static final String MODEL = "model";
static final String USER = "user";
static final String SUMMARY_PROMPT = "Summarize the following text:";

@ -42,6 +42,8 @@ import java.util.List;
import java.util.Objects;
public class OpenAI {
static final String DEFAULT_MODEL = "gpt-4o";
static final float DEFAULT_TEMPERATURE = 0.5f;
static final String ASSISTANT = "assistant";
static final String USER = "user";
static final String SUMMARY_PROMPT = "Summarize the following text:";

@ -558,7 +558,6 @@
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_marginStart="12dp"
android:hint="gpt-3.5-turbo"
android:inputType="text"
android:textAppearance="@style/TextAppearance.AppCompat.Small"
app:layout_constraintEnd_toEndOf="parent"
@ -743,7 +742,6 @@
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_marginStart="12dp"
android:hint="gemini-pro"
android:inputType="text"
android:textAppearance="@style/TextAppearance.AppCompat.Small"
app:layout_constraintEnd_toEndOf="parent"

Loading…
Cancel
Save