diff --git a/README.md b/README.md index 07b9bb8..856d106 100644 --- a/README.md +++ b/README.md @@ -45,6 +45,7 @@ Use these tokens in app arguments: - `TOP_P` - `TOP_K` - `MIN_P` +- `REASONING_EFFORT` - `REASONING_STOP` Example: @@ -53,6 +54,11 @@ Example: -m MODEL -c CONTEXT_SIZE -t THREADS -ngl GPU_LAYERS --temp TEMP --top-p TOP_P --top-k TOP_K --min-p MIN_P ``` +For llama-server reasoning controls, configure `--chat-template-kwargs REASONING_EFFORT`. +The placeholder expands to a single JSON argument such as `{"reasoning_effort": "medium"}`. +When this placeholder is selected for the current app and model, the model options panel provides +the presets `none`, `low`, `medium`, `high`, and `xhigh`. + ## Setup ### lm-launcher.properties diff --git a/apps.json b/apps.json index f1142e6..44fbbe4 100644 --- a/apps.json +++ b/apps.json @@ -1,663 +1 @@ -{ - "apps": [ - { - "path": "file:///home/sb/lm/llama.cpp/build/bin/llama-server", - "interpreter": null, - "arguments": [], - "appArguments": [ - { - "argument": "-nkvo", - "optional": true, - "default_": false - }, - { - "argument": "--parallel", - "optional": true, - "default_": false - }, - { - "argument": "3", - "optional": true, - "default_": false - }, - { - "argument": "--reasoning", - "optional": true, - "default_": false - }, - { - "argument": "off", - "optional": true, - "default_": false - }, - { - "argument": "--spec-type", - "optional": true, - "default_": false - }, - { - "argument": "draft-mtp", - "optional": true, - "default_": false - }, - { - "argument": "--spec-draft-n-max", - "optional": true, - "default_": false - }, - { - "argument": "2", - "optional": true, - "default_": false - }, - { - "argument": "-ts", - "optional": true, - "default_": true - }, - { - "argument": "3,2", - "optional": true, - "default_": true - }, - { - "argument": "--no-mmap", - "optional": true, - "default_": false - }, - { - "argument": "--jinja", - "optional": true, - "default_": true - }, - { - "argument": "--reasoning-budget", - "optional": true, - "default_": true - }, - { - "argument": "5000", - "optional": true, - "default_": true - }, - { - "argument": "--device", - "optional": true, - "default_": false - }, - { - "argument": "ROCm0", - "optional": true, - "default_": false - }, - { - "argument": "--split-mode", - "optional": true, - "default_": false - }, - { - "argument": "layer", - "optional": true, - "default_": false - }, - { - "argument": "row", - "optional": true, - "default_": false - }, - { - "argument": "tensor", - "optional": true, - "default_": false - }, - { - "argument": "--host", - "optional": true, - "default_": true - }, - { - "argument": "0.0.0.0", - "optional": true, - "default_": true - }, - { - "argument": "--port", - "optional": false, - "default_": true - }, - { - "argument": "5001", - "optional": false, - "default_": true - }, - { - "argument": "-t", - "optional": false, - "default_": true - }, - { - "argument": "THREADS", - "optional": false, - "default_": true - }, - { - "argument": "-ngl", - "optional": true, - "default_": true - }, - { - "argument": "GPU_LAYERS", - "optional": true, - "default_": true - }, - { - "argument": "--ctx-size", - "optional": true, - "default_": true - }, - { - "argument": "CONTEXT_SIZE", - "optional": true, - "default_": true - }, - { - "argument": "-m", - "optional": false, - "default_": true - }, - { - "argument": "MODEL", - "optional": false, - "default_": true - }, - { - "argument": "--temp", - "optional": false, - "default_": true - }, - { - "argument": "TEMP", - "optional": false, - "default_": true - }, - { - "argument": "--top-p", - "optional": false, - "default_": true - }, - { - "argument": "TOP_P", - "optional": false, - "default_": true - }, - { - "argument": "--top-k", - "optional": false, - "default_": true - }, - { - "argument": "TOP_K", - "optional": false, - "default_": true - }, - { - "argument": "--min-p", - "optional": false, - "default_": true - }, - { - "argument": "MIN_P", - "optional": false, - "default_": true - } - ], - "modelSettings": [ - { - "modelPath": "/mnt/data/data/lm/models/gguf/xl/MiniMax-M2.7-UD-IQ4_XS-00001-of-00004.gguf", - "appArguments": [ - { - "argument": "-nkvo", - "optional": true, - "default_": false - }, - { - "argument": "--parallel", - "optional": true, - "default_": false - }, - { - "argument": "3", - "optional": true, - "default_": false - }, - { - "argument": "--reasoning", - "optional": true, - "default_": false - }, - { - "argument": "off", - "optional": true, - "default_": false - }, - { - "argument": "--spec-type", - "optional": true, - "default_": false - }, - { - "argument": "draft-mtp", - "optional": true, - "default_": false - }, - { - "argument": "--spec-draft-n-max", - "optional": true, - "default_": false - }, - { - "argument": "2", - "optional": true, - "default_": false - }, - { - "argument": "-ts", - "optional": true, - "default_": false - }, - { - "argument": "3,2", - "optional": true, - "default_": false - }, - { - "argument": "--no-mmap", - "optional": true, - "default_": false - }, - { - "argument": "--jinja", - "optional": true, - "default_": true - }, - { - "argument": "--reasoning-budget", - "optional": true, - "default_": true - }, - { - "argument": "5000", - "optional": true, - "default_": true - }, - { - "argument": "--device", - "optional": true, - "default_": false - }, - { - "argument": "ROCm0", - "optional": true, - "default_": false - }, - { - "argument": "--split-mode", - "optional": true, - "default_": true - }, - { - "argument": "layer", - "optional": true, - "default_": false - }, - { - "argument": "row", - "optional": true, - "default_": false - }, - { - "argument": "tensor", - "optional": true, - "default_": true - }, - { - "argument": "--host", - "optional": true, - "default_": true - }, - { - "argument": "0.0.0.0", - "optional": true, - "default_": true - }, - { - "argument": "--port", - "optional": false, - "default_": true - }, - { - "argument": "5001", - "optional": false, - "default_": true - }, - { - "argument": "-t", - "optional": false, - "default_": true - }, - { - "argument": "THREADS", - "optional": false, - "default_": true - }, - { - "argument": "-ngl", - "optional": true, - "default_": true - }, - { - "argument": "GPU_LAYERS", - "optional": true, - "default_": true - }, - { - "argument": "--ctx-size", - "optional": true, - "default_": true - }, - { - "argument": "CONTEXT_SIZE", - "optional": true, - "default_": true - }, - { - "argument": "-m", - "optional": false, - "default_": true - }, - { - "argument": "MODEL", - "optional": false, - "default_": true - }, - { - "argument": "--temp", - "optional": false, - "default_": true - }, - { - "argument": "TEMP", - "optional": false, - "default_": true - }, - { - "argument": "--top-p", - "optional": false, - "default_": true - }, - { - "argument": "TOP_P", - "optional": false, - "default_": true - }, - { - "argument": "--top-k", - "optional": false, - "default_": true - }, - { - "argument": "TOP_K", - "optional": false, - "default_": true - }, - { - "argument": "--min-p", - "optional": false, - "default_": true - }, - { - "argument": "MIN_P", - "optional": false, - "default_": true - } - ] - }, - { - "modelPath": "/mnt/data/data/lm/models/gguf/m/Qwen3.6-35B-A3B-UD-Q5_K_XL-mtp.gguf", - "appArguments": [ - { - "argument": "-nkvo", - "optional": true, - "default_": false - }, - { - "argument": "--parallel", - "optional": true, - "default_": false - }, - { - "argument": "3", - "optional": true, - "default_": false - }, - { - "argument": "--reasoning", - "optional": true, - "default_": false - }, - { - "argument": "off", - "optional": true, - "default_": false - }, - { - "argument": "--spec-type", - "optional": true, - "default_": true - }, - { - "argument": "draft-mtp", - "optional": true, - "default_": true - }, - { - "argument": "--spec-draft-n-max", - "optional": true, - "default_": true - }, - { - "argument": "2", - "optional": true, - "default_": true - }, - { - "argument": "-ts", - "optional": true, - "default_": true - }, - { - "argument": "3,2", - "optional": true, - "default_": true - }, - { - "argument": "--no-mmap", - "optional": true, - "default_": false - }, - { - "argument": "--jinja", - "optional": true, - "default_": true - }, - { - "argument": "--reasoning-budget", - "optional": true, - "default_": true - }, - { - "argument": "5000", - "optional": true, - "default_": true - }, - { - "argument": "--device", - "optional": true, - "default_": false - }, - { - "argument": "ROCm0", - "optional": true, - "default_": false - }, - { - "argument": "--split-mode", - "optional": true, - "default_": false - }, - { - "argument": "layer", - "optional": true, - "default_": false - }, - { - "argument": "row", - "optional": true, - "default_": false - }, - { - "argument": "tensor", - "optional": true, - "default_": false - }, - { - "argument": "--host", - "optional": true, - "default_": true - }, - { - "argument": "0.0.0.0", - "optional": true, - "default_": true - }, - { - "argument": "--port", - "optional": false, - "default_": true - }, - { - "argument": "5001", - "optional": false, - "default_": true - }, - { - "argument": "-t", - "optional": false, - "default_": true - }, - { - "argument": "THREADS", - "optional": false, - "default_": true - }, - { - "argument": "-ngl", - "optional": true, - "default_": true - }, - { - "argument": "GPU_LAYERS", - "optional": true, - "default_": true - }, - { - "argument": "--ctx-size", - "optional": true, - "default_": true - }, - { - "argument": "CONTEXT_SIZE", - "optional": true, - "default_": true - }, - { - "argument": "-m", - "optional": false, - "default_": true - }, - { - "argument": "MODEL", - "optional": false, - "default_": true - }, - { - "argument": "--temp", - "optional": false, - "default_": true - }, - { - "argument": "TEMP", - "optional": false, - "default_": true - }, - { - "argument": "--top-p", - "optional": false, - "default_": true - }, - { - "argument": "TOP_P", - "optional": false, - "default_": true - }, - { - "argument": "--top-k", - "optional": false, - "default_": true - }, - { - "argument": "TOP_K", - "optional": false, - "default_": true - }, - { - "argument": "--min-p", - "optional": false, - "default_": true - }, - { - "argument": "MIN_P", - "optional": false, - "default_": true - } - ] - } - ] - }, - { - "path": "file:///home/sb/lm/SillyTavern/start.sh", - "interpreter": null, - "arguments": [], - "appArguments": [], - "modelSettings": [ - { - "modelPath": "/mnt/data/data/lm/models/gguf/xl/MiniMax-M2.7-UD-IQ4_XS-00001-of-00004.gguf", - "appArguments": [] - } - ] - }, - { - "path": "file:///home/sb/lm/ollama-oai-bridge/start.sh", - "interpreter": null, - "arguments": [], - "appArguments": [ - { - "argument": "-Dbridge.reported-context-offset=30000", - "optional": false, - "default_": true - } - ], - "modelSettings": [] - } - ] -} +{"apps":[{"path":"file:///home/sb/lm/llama.cpp/build/bin/llama-server","interpreter":null,"arguments":[],"appArguments":[{"argument":"-nkvo","optional":true,"default_":false},{"argument":"--parallel","optional":true,"default_":false},{"argument":"3","optional":true,"default_":false},{"argument":"--reasoning","optional":true,"default_":false},{"argument":"off","optional":true,"default_":false},{"argument":"--chat-template-kwargs","optional":true,"default_":false},{"argument":"REASONING_EFFORT","optional":true,"default_":false},{"argument":"--spec-type","optional":true,"default_":false},{"argument":"draft-mtp","optional":true,"default_":false},{"argument":"--spec-draft-n-max","optional":true,"default_":false},{"argument":"2","optional":true,"default_":false},{"argument":"-ts","optional":true,"default_":true},{"argument":"3,2","optional":true,"default_":true},{"argument":"--no-mmap","optional":true,"default_":false},{"argument":"--jinja","optional":true,"default_":true},{"argument":"--reasoning-budget","optional":true,"default_":true},{"argument":"5000","optional":true,"default_":true},{"argument":"--device","optional":true,"default_":false},{"argument":"ROCm0","optional":true,"default_":false},{"argument":"--split-mode","optional":true,"default_":false},{"argument":"layer","optional":true,"default_":false},{"argument":"row","optional":true,"default_":false},{"argument":"tensor","optional":true,"default_":false},{"argument":"--host","optional":true,"default_":true},{"argument":"0.0.0.0","optional":true,"default_":true},{"argument":"--port","optional":false,"default_":true},{"argument":"5001","optional":false,"default_":true},{"argument":"-t","optional":false,"default_":true},{"argument":"THREADS","optional":false,"default_":true},{"argument":"-ngl","optional":true,"default_":true},{"argument":"GPU_LAYERS","optional":true,"default_":true},{"argument":"--ctx-size","optional":true,"default_":true},{"argument":"CONTEXT_SIZE","optional":true,"default_":true},{"argument":"-m","optional":false,"default_":true},{"argument":"MODEL","optional":false,"default_":true},{"argument":"--temp","optional":false,"default_":true},{"argument":"TEMP","optional":false,"default_":true},{"argument":"--top-p","optional":false,"default_":true},{"argument":"TOP_P","optional":false,"default_":true},{"argument":"--top-k","optional":false,"default_":true},{"argument":"TOP_K","optional":false,"default_":true},{"argument":"--min-p","optional":false,"default_":true},{"argument":"MIN_P","optional":false,"default_":true}],"modelSettings":[{"modelPath":"/mnt/data/data/lm/models/gguf/xl/MiniMax-M2.7-UD-IQ4_XS-00001-of-00004.gguf","appArguments":[{"argument":"-nkvo","optional":true,"default_":false},{"argument":"--parallel","optional":true,"default_":false},{"argument":"3","optional":true,"default_":false},{"argument":"--reasoning","optional":true,"default_":false},{"argument":"off","optional":true,"default_":false},{"argument":"--spec-type","optional":true,"default_":false},{"argument":"draft-mtp","optional":true,"default_":false},{"argument":"--spec-draft-n-max","optional":true,"default_":false},{"argument":"2","optional":true,"default_":false},{"argument":"-ts","optional":true,"default_":false},{"argument":"3,2","optional":true,"default_":false},{"argument":"--no-mmap","optional":true,"default_":false},{"argument":"--jinja","optional":true,"default_":true},{"argument":"--reasoning-budget","optional":true,"default_":true},{"argument":"5000","optional":true,"default_":true},{"argument":"--device","optional":true,"default_":false},{"argument":"ROCm0","optional":true,"default_":false},{"argument":"--split-mode","optional":true,"default_":true},{"argument":"layer","optional":true,"default_":false},{"argument":"row","optional":true,"default_":false},{"argument":"tensor","optional":true,"default_":true},{"argument":"--host","optional":true,"default_":true},{"argument":"0.0.0.0","optional":true,"default_":true},{"argument":"--port","optional":false,"default_":true},{"argument":"5001","optional":false,"default_":true},{"argument":"-t","optional":false,"default_":true},{"argument":"THREADS","optional":false,"default_":true},{"argument":"-ngl","optional":true,"default_":true},{"argument":"GPU_LAYERS","optional":true,"default_":true},{"argument":"--ctx-size","optional":true,"default_":true},{"argument":"CONTEXT_SIZE","optional":true,"default_":true},{"argument":"-m","optional":false,"default_":true},{"argument":"MODEL","optional":false,"default_":true},{"argument":"--temp","optional":false,"default_":true},{"argument":"TEMP","optional":false,"default_":true},{"argument":"--top-p","optional":false,"default_":true},{"argument":"TOP_P","optional":false,"default_":true},{"argument":"--top-k","optional":false,"default_":true},{"argument":"TOP_K","optional":false,"default_":true},{"argument":"--min-p","optional":false,"default_":true},{"argument":"MIN_P","optional":false,"default_":true}]},{"modelPath":"/mnt/data/data/lm/models/gguf/m/Qwen3.6-35B-A3B-UD-Q5_K_XL-mtp.gguf","appArguments":[{"argument":"-nkvo","optional":true,"default_":false},{"argument":"--parallel","optional":true,"default_":false},{"argument":"3","optional":true,"default_":false},{"argument":"--reasoning","optional":true,"default_":false},{"argument":"off","optional":true,"default_":false},{"argument":"--spec-type","optional":true,"default_":true},{"argument":"draft-mtp","optional":true,"default_":true},{"argument":"--spec-draft-n-max","optional":true,"default_":true},{"argument":"2","optional":true,"default_":true},{"argument":"-ts","optional":true,"default_":true},{"argument":"3,2","optional":true,"default_":true},{"argument":"--no-mmap","optional":true,"default_":false},{"argument":"--jinja","optional":true,"default_":true},{"argument":"--reasoning-budget","optional":true,"default_":true},{"argument":"5000","optional":true,"default_":true},{"argument":"--device","optional":true,"default_":false},{"argument":"ROCm0","optional":true,"default_":false},{"argument":"--split-mode","optional":true,"default_":false},{"argument":"layer","optional":true,"default_":false},{"argument":"row","optional":true,"default_":false},{"argument":"tensor","optional":true,"default_":false},{"argument":"--host","optional":true,"default_":true},{"argument":"0.0.0.0","optional":true,"default_":true},{"argument":"--port","optional":false,"default_":true},{"argument":"5001","optional":false,"default_":true},{"argument":"-t","optional":false,"default_":true},{"argument":"THREADS","optional":false,"default_":true},{"argument":"-ngl","optional":true,"default_":true},{"argument":"GPU_LAYERS","optional":true,"default_":true},{"argument":"--ctx-size","optional":true,"default_":true},{"argument":"CONTEXT_SIZE","optional":true,"default_":true},{"argument":"-m","optional":false,"default_":true},{"argument":"MODEL","optional":false,"default_":true},{"argument":"--temp","optional":false,"default_":true},{"argument":"TEMP","optional":false,"default_":true},{"argument":"--top-p","optional":false,"default_":true},{"argument":"TOP_P","optional":false,"default_":true},{"argument":"--top-k","optional":false,"default_":true},{"argument":"TOP_K","optional":false,"default_":true},{"argument":"--min-p","optional":false,"default_":true},{"argument":"MIN_P","optional":false,"default_":true}]}]},{"path":"file:///home/sb/lm/SillyTavern/start.sh","interpreter":null,"arguments":[],"appArguments":[],"modelSettings":[{"modelPath":"/mnt/data/data/lm/models/gguf/xl/MiniMax-M2.7-UD-IQ4_XS-00001-of-00004.gguf","appArguments":[]}]},{"path":"file:///home/sb/lm/ollama-oai-bridge/start.sh","interpreter":null,"arguments":[],"appArguments":[{"argument":"-Dbridge.reported-context-offset=30000","optional":false,"default_":true}],"modelSettings":[]}]} \ No newline at end of file diff --git a/lm-launcher.jar b/lm-launcher.jar index f5144be..88165f4 100644 Binary files a/lm-launcher.jar and b/lm-launcher.jar differ diff --git a/src/de/extio/lm_launcher/App.java b/src/de/extio/lm_launcher/App.java index 1c46e4c..1cce647 100644 --- a/src/de/extio/lm_launcher/App.java +++ b/src/de/extio/lm_launcher/App.java @@ -27,6 +27,7 @@ record App(Path path, Path interpreter, @Deprecated List arguments, List "TOP_P", Model::topPDisplay, "TOP_K", Model::topKDisplay, "MIN_P", Model::minPDisplay, + "REASONING_EFFORT", Model::reasoningEffortArgument, "REASONING_STOP", m -> "... thinking budget exceeded, let's answer now.\n"); String argumentsToString(final boolean showAll) { diff --git a/src/de/extio/lm_launcher/Data.java b/src/de/extio/lm_launcher/Data.java index 516e96a..a53f77e 100644 --- a/src/de/extio/lm_launcher/Data.java +++ b/src/de/extio/lm_launcher/Data.java @@ -46,9 +46,9 @@ public class Data { for (int i = 0; i < modelData.models().size(); i++) { final Model model = modelData.models.get(i); if (model.maxContextSize() < model.contextSize() || model.promptTemplate() == null || model.temperature() == null || model.topP() == null || model.topK() == null - || model.minP() == null) { + || model.minP() == null || model.reasoningEffort() == null) { modelData.models.set(i, new Model(model.path(), model.contextSize(), model.maxContextSize(), model.gpuLayers(), model.threads(), model.temperature(), model.topP(), model.topK(), - model.minP(), model.promptTemplate(), model.ctime())); + model.minP(), model.promptTemplate(), model.reasoningEffort(), model.ctime())); } } sortModels(); @@ -168,7 +168,7 @@ public class Data { catch (final IOException e) { // Use 0 as fallback } - return new Model(path, 16000, 128000, 99, 6, Model.DEFAULT_TEMPERATURE, Model.DEFAULT_TOP_P, Model.DEFAULT_TOP_K, Model.DEFAULT_MIN_P, "", ctime); + return new Model(path, 16000, 128000, 99, 6, Model.DEFAULT_TEMPERATURE, Model.DEFAULT_TOP_P, Model.DEFAULT_TOP_K, Model.DEFAULT_MIN_P, "", Model.DEFAULT_REASONING_EFFORT, ctime); } static record ModelData(List models) { diff --git a/src/de/extio/lm_launcher/LaunchFrame.java b/src/de/extio/lm_launcher/LaunchFrame.java index c17321f..471bed6 100644 --- a/src/de/extio/lm_launcher/LaunchFrame.java +++ b/src/de/extio/lm_launcher/LaunchFrame.java @@ -21,6 +21,7 @@ import javax.swing.DefaultListModel; import javax.swing.DefaultListSelectionModel; import javax.swing.JButton; import javax.swing.JCheckBox; +import javax.swing.JComboBox; import javax.swing.JFileChooser; import javax.swing.JFrame; import javax.swing.JLabel; @@ -152,6 +153,10 @@ public class LaunchFrame extends JFrame { JSlider slider_minP; JLabel lblMinPValue; + + JLabel lblReasoningEffort; + + JComboBox comboReasoningEffort; /** * Create the frame. @@ -431,6 +436,16 @@ public class LaunchFrame extends JFrame { this.lblMinPValue.setHorizontalAlignment(SwingConstants.CENTER); this.panel_3.add(this.lblMinPValue); } + { + this.lblReasoningEffort = new JLabel("Reasoning Effort"); + this.lblReasoningEffort.setHorizontalAlignment(SwingConstants.CENTER); + this.panel_3.add(this.lblReasoningEffort); + } + { + this.comboReasoningEffort = new JComboBox<>(Model.REASONING_EFFORTS); + this.comboReasoningEffort.setSelectedItem(Model.DEFAULT_REASONING_EFFORT); + this.panel_3.add(this.comboReasoningEffort); + } { this.verticalStrut = Box.createVerticalStrut(20); this.panel_3.add(this.verticalStrut); @@ -571,6 +586,7 @@ public class LaunchFrame extends JFrame { LaunchFrame.this.slider_topK.getValue(), LaunchFrame.this.sliderValue(LaunchFrame.this.slider_minP), template.promptTemplate(), + (String) LaunchFrame.this.comboReasoningEffort.getSelectedItem(), template.ctime()); } @@ -639,10 +655,12 @@ public class LaunchFrame extends JFrame { this.appArgumentsTableModel.setRowCount(0); final App selectedApp = this.getSelectedApp(); if (selectedApp == null) { + this.updateReasoningEffortVisibility(); return; } selectedApp.argumentsForModel(this.getSelectedModelPath()) .forEach(argument -> this.appArgumentsTableModel.addRow(new Object[] { argument })); + this.updateReasoningEffortVisibility(); } private List currentTableArguments() { @@ -671,9 +689,25 @@ public class LaunchFrame extends JFrame { this.slider_topP.setValue(LaunchFrame.doubleToSlider(model.topPValue())); this.slider_topK.setValue(model.topKValue()); this.slider_minP.setValue(LaunchFrame.doubleToSlider(model.minPValue())); + this.comboReasoningEffort.setSelectedItem(model.reasoningEffort()); this.lblPromptTemplate_1.setText(model.promptTemplate() != null && !model.promptTemplate().isEmpty() ? model.promptTemplate() : "-"); this.updateSamplingValueLabels(); } + + private void updateReasoningEffortVisibility() { + boolean selected = false; + for (int i = 0; i < this.appArgumentsTableModel.getRowCount(); i++) { + final AppArgument argument = (AppArgument) this.appArgumentsTableModel.getValueAt(i, 0); + if ("REASONING_EFFORT".equals(argument.argument()) && (!argument.optional() || argument.default_())) { + selected = true; + break; + } + } + this.lblReasoningEffort.setVisible(selected); + this.comboReasoningEffort.setVisible(selected); + this.panel_3.revalidate(); + this.panel_3.repaint(); + } private void updateSamplingValueLabels() { this.lblTemperatureValue.setText(Model.formatDecimal(this.sliderValue(this.slider_temperature))); diff --git a/src/de/extio/lm_launcher/Model.java b/src/de/extio/lm_launcher/Model.java index c33f45a..de82197 100644 --- a/src/de/extio/lm_launcher/Model.java +++ b/src/de/extio/lm_launcher/Model.java @@ -3,7 +3,11 @@ package de.extio.lm_launcher; import java.math.BigDecimal; record Model(String path, int contextSize, int maxContextSize, int gpuLayers, int threads, Double temperature, Double topP, - Integer topK, Double minP, String promptTemplate, long ctime) { + Integer topK, Double minP, String promptTemplate, String reasoningEffort, long ctime) { + + static final String[] REASONING_EFFORTS = { "none", "low", "medium", "high", "xhigh" }; + + static final String DEFAULT_REASONING_EFFORT = "medium"; static final double DEFAULT_TEMPERATURE = 0.8d; @@ -39,6 +43,20 @@ record Model(String path, int contextSize, int maxContextSize, int gpuLayers, in topK = sanitizeInt(topK, DEFAULT_TOP_K, MIN_TOP_K, MAX_TOP_K); minP = sanitizeDouble(minP, DEFAULT_MIN_P, MIN_MIN_P, MAX_MIN_P); promptTemplate = promptTemplate == null ? "" : promptTemplate; + reasoningEffort = isValidReasoningEffort(reasoningEffort) ? reasoningEffort : DEFAULT_REASONING_EFFORT; + } + + String reasoningEffortArgument() { + return "{\"reasoning_effort\": \"" + this.reasoningEffort + "\"}"; + } + + private static boolean isValidReasoningEffort(final String value) { + for (final String effort : REASONING_EFFORTS) { + if (effort.equals(value)) { + return true; + } + } + return false; } double temperatureValue() { diff --git a/src/de/extio/lm_launcher/ModelPropertiesDialog.java b/src/de/extio/lm_launcher/ModelPropertiesDialog.java index e573958..301b930 100644 --- a/src/de/extio/lm_launcher/ModelPropertiesDialog.java +++ b/src/de/extio/lm_launcher/ModelPropertiesDialog.java @@ -184,7 +184,7 @@ public class ModelPropertiesDialog extends JDialog { ModelPropertiesDialog.this.setVisible(false); modelConsumer.accept( new Model(modelPath, contextSize, maxContextSize, gpuLayers, threads, temperature, topP, topK, minP, ModelPropertiesDialog.this.txtPrompttemplate.getText(), - modelToEdit.ctime())); + modelToEdit.reasoningEffort(), modelToEdit.ctime())); ModelPropertiesDialog.this.dispose(); } catch (final NumberFormatException nfe) {