fix: update tokenizer name and enhance text completion description in README; refactor think mode handling in OllamaDialect

This commit is contained in:
extio-de
2026-05-09 19:17:42 +02:00
parent 4ff231227e
commit 8c92e6fd7a
3 changed files with 7 additions and 10 deletions

View File

@@ -40,6 +40,7 @@ import de.extio.lmlib.client.ToolCall;
import de.extio.lmlib.client.ToolCallData;
import de.extio.lmlib.client.ToolDefinition;
import de.extio.lmlib.client.oai.completion.FinishReasons;
import de.extio.lmlib.client.ollama.OllamaDialect.ThinkMode;
import de.extio.lmlib.profile.ModelCategory;
import de.extio.lmlib.profile.ModelProfile;
import de.extio.lmlib.profile.ModelProfile.ModelProvider;
@@ -203,7 +204,7 @@ public class OllamaClient implements Client {
request.setStream(streaming);
final var think = this.createThinkRequestValue(modelProfile, modelDetails);
if (think != null) {
request.setThink(think);
request.setThink(think.getWireValue());
}
request.setOptions(this.createOptions(modelProfile));
if (toolCallData != null && toolCallData.hasTools()) {
@@ -217,9 +218,9 @@ public class OllamaClient implements Client {
return request;
}
private Object createThinkRequestValue(final ModelProfile modelProfile, final OllamaShowResponse modelDetails) {
private ThinkMode createThinkRequestValue(final ModelProfile modelProfile, final OllamaShowResponse modelDetails) {
final var thinkMode = this.getOllamaDialect().think(modelProfile);
if (thinkMode == null || !thinkMode.isEnabled()) {
if (thinkMode == null) {
return null;
}
if (!this.supportsThinkingCapability(modelDetails)) {

View File

@@ -23,10 +23,6 @@ public interface OllamaDialect {
this.wireValue = wireValue;
}
public boolean isEnabled() {
return (this.wireValue instanceof final Boolean val && val) || (this.wireValue instanceof final String str && !str.isBlank());
}
@JsonValue
public Object getWireValue() {
return this.wireValue;