Class NaruModelProtocolOllamaNative
java.lang.Object
net.thevpc.naru.ext.models.NaruModelProtocolBase
net.thevpc.naru.ext.models.ollama.NaruModelProtocolOllamaNative
- All Implemented Interfaces:
NaruModelProtocol
-
Nested Class Summary
Nested classes/interfaces inherited from class net.thevpc.naru.ext.models.NaruModelProtocolBase
NaruModelProtocolBase.NonRetryableWebException -
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final StringRequest env key carrying thethinkflag sent to Ollama.Fields inherited from class net.thevpc.naru.ext.models.NaruModelProtocolBase
capabilities, chatPath, configPrefix, model, nElementReader, provider, serializer -
Constructor Summary
ConstructorsConstructorDescriptionNaruModelProtocolOllamaNative(NaruModelProvider provider, NaruModelConfig model, String configPrefix, NaruModelCapabilities capabilities) -
Method Summary
Modifier and TypeMethodDescriptionchatStream(NaruModelRequest request, NaruTask task, NaruStreamHandler handler) protected NaruModelRequestpreprocessRequest(NaruModelRequest mrequest, NaruTask task) Defaultsthinkfrom the model's declared capability, and lets an explicit request orollama.thinksetting win.Methods inherited from class net.thevpc.naru.ext.models.NaruModelProtocolBase
apiKey, apiKeyConfigKey, chat, chatPath, classifyStatus, commitCacheState, connectTimeout, getCapabilities, maxRetries, onResponseReceived, parseResponse, parseXmlLikeToolCall, prepareRequest, provider, providerName, readTimeout, retryPeriod, serialize, serialize, streamChat, url
-
Field Details
-
THINK_ENV
Request env key carrying thethinkflag sent to Ollama.Reading the request's
thinkfield is the only way to get reasoning out of a reasoning model: Ollama returns nomessage.thinkingat all unless the request asks for it. Sending it unasked, on the other hand, is worse than useless -- Ollama rejects a model that does not support thinking, so a default oftruewould break every non-reasoning model.- See Also:
-
-
Constructor Details
-
NaruModelProtocolOllamaNative
public NaruModelProtocolOllamaNative(NaruModelProvider provider, NaruModelConfig model, String configPrefix, NaruModelCapabilities capabilities)
-
-
Method Details
-
preprocessRequest
Defaultsthinkfrom the model's declared capability, and lets an explicit request orollama.thinksetting win.The capability is the answer, not a guess: Ollama reports a reasoning model in
/api/show, and that is the only thing that distinguishes a model which can be asked to think from one that will refuse the request.- Overrides:
preprocessRequestin classNaruModelProtocolBase
-
chatStream
-