mirror of
https://github.com/carlrobertoh/ProxyAI.git
synced 2026-05-11 13:10:50 +00:00
Add support for some extended parameters of llama.cpp(top_k, top_p, min_p, and repeat_penalty) (#311)
* Add support for some extended parameters of llama.cpp(top_k, top_p, min_p, and repeat_penalty) Added 'top_k,' 'top_p,' 'min_p,' and 'repeat_penalty' fields to the llama.cpp request configuration. The default values for these fields match the defaults of llama.cpp. If left untouched, they do not affect the model's response to the request. * Bump llm-client --------- Co-authored-by: Carl-Robert Linnupuu <carlrobertoh@gmail.com>
This commit is contained in:
parent
52c1b5d68c
commit
9d83107dd5
6 changed files with 142 additions and 1 deletions
|
|
@ -50,6 +50,10 @@ public class ConfigurationComponent {
|
|||
private final JTextArea commitMessagePromptTextArea;
|
||||
private final IntegerField maxTokensField;
|
||||
private final JBTextField temperatureField;
|
||||
private final IntegerField topKField;
|
||||
private final JBTextField topPField;
|
||||
private final JBTextField minPField;
|
||||
private final JBTextField repeatPenaltyField;
|
||||
|
||||
public ConfigurationComponent(Disposable parentDisposable, ConfigurationState configuration) {
|
||||
table = new JBTable(new DefaultTableModel(
|
||||
|
|
@ -68,6 +72,19 @@ public class ConfigurationComponent {
|
|||
temperatureField = new JBTextField(12);
|
||||
temperatureField.setText(String.valueOf(configuration.getTemperature()));
|
||||
|
||||
topKField = new IntegerField();
|
||||
topKField.setColumns(12);
|
||||
topKField.setValue(configuration.getTopK());
|
||||
|
||||
topPField = new JBTextField(12);
|
||||
topPField.setText(String.valueOf(configuration.getTopP()));
|
||||
|
||||
minPField = new JBTextField(12);
|
||||
minPField.setText(String.valueOf(configuration.getMinP()));
|
||||
|
||||
repeatPenaltyField = new JBTextField(12);
|
||||
repeatPenaltyField.setText(String.valueOf(configuration.getRepeatPenalty()));
|
||||
|
||||
var temperatureFieldValidator = createInputValidator(parentDisposable, temperatureField);
|
||||
temperatureField.getDocument().addDocumentListener(new DocumentListener() {
|
||||
@Override
|
||||
|
|
@ -131,6 +148,9 @@ public class ConfigurationComponent {
|
|||
CodeGPTBundle.get("configurationConfigurable.section.assistant.title")))
|
||||
.addComponent(createAssistantConfigurationForm())
|
||||
.addComponentFillVertically(new JPanel(), 0)
|
||||
.addComponent(new TitledSeparator(
|
||||
CodeGPTBundle.get("configurationConfigurable.section.assistant.llamacppParams.title")))
|
||||
.addComponent(createLlamaAssistantConfigurationForm())
|
||||
.addComponent(new TitledSeparator(
|
||||
CodeGPTBundle.get("configurationConfigurable.section.commitMessage.title")))
|
||||
.addComponent(createCommitMessageConfigurationForm())
|
||||
|
|
@ -210,6 +230,34 @@ public class ConfigurationComponent {
|
|||
return form;
|
||||
}
|
||||
|
||||
private JPanel createLlamaAssistantConfigurationForm() {
|
||||
var formBuilder = FormBuilder.createFormBuilder();
|
||||
addAssistantFormLabeledComponent(
|
||||
formBuilder,
|
||||
"configurationConfigurable.section.assistant.topKField.label",
|
||||
"configurationConfigurable.section.assistant.topKField.comment",
|
||||
topKField);
|
||||
addAssistantFormLabeledComponent(
|
||||
formBuilder,
|
||||
"configurationConfigurable.section.assistant.topPField.label",
|
||||
"configurationConfigurable.section.assistant.topPField.comment",
|
||||
topPField);
|
||||
addAssistantFormLabeledComponent(
|
||||
formBuilder,
|
||||
"configurationConfigurable.section.assistant.minPField.label",
|
||||
"configurationConfigurable.section.assistant.minPField.comment",
|
||||
minPField);
|
||||
addAssistantFormLabeledComponent(
|
||||
formBuilder,
|
||||
"configurationConfigurable.section.assistant.repeatPenaltyField.label",
|
||||
"configurationConfigurable.section.assistant.repeatPenaltyField.comment",
|
||||
repeatPenaltyField);
|
||||
|
||||
var form = formBuilder.getPanel();
|
||||
form.setBorder(JBUI.Borders.emptyLeft(16));
|
||||
return form;
|
||||
}
|
||||
|
||||
private JPanel createCommitMessageConfigurationForm() {
|
||||
var formBuilder = FormBuilder.createFormBuilder();
|
||||
addAssistantFormLabeledComponent(
|
||||
|
|
@ -296,6 +344,38 @@ public class ConfigurationComponent {
|
|||
maxTokensField.setValue(maxTokens);
|
||||
}
|
||||
|
||||
public int getTopK() {
|
||||
return topKField.getValue();
|
||||
}
|
||||
|
||||
public void setTopK(int topK) {
|
||||
topKField.setValue(topK);
|
||||
}
|
||||
|
||||
public double getTopP() {
|
||||
return Double.parseDouble(topPField.getText());
|
||||
}
|
||||
|
||||
public void setTopP(double topP) {
|
||||
topPField.setText(String.valueOf(topP));
|
||||
}
|
||||
|
||||
public double getMinP() {
|
||||
return Double.parseDouble(minPField.getText());
|
||||
}
|
||||
|
||||
public void setMinP(double minP) {
|
||||
minPField.setText(String.valueOf(minP));
|
||||
}
|
||||
|
||||
public double getRepeatPenalty() {
|
||||
return Double.parseDouble(repeatPenaltyField.getText());
|
||||
}
|
||||
|
||||
public void setRepeatPenalty(double repeatPenalty) {
|
||||
repeatPenaltyField.setText(String.valueOf(repeatPenalty));
|
||||
}
|
||||
|
||||
public boolean isCheckForPluginUpdates() {
|
||||
return checkForPluginUpdatesCheckBox.isSelected();
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue