Interface NaruModelProtocol
-
Method Summary
Modifier and TypeMethodDescriptionchat(NaruModelRequest request, NaruTask task) Send a chat request with optional tool definitions.default NaruResponsechatStream(NaruModelRequest request, NaruTask task, NaruStreamHandler handler) Send a chat request, delivering output as it is produced.default StringThis protocol's provider name, stamped onto chunks for provenance.static voidreplayAsChunks(String provider, NaruResponse response, NaruStreamHandler handler) Feeds an already-complete response through the chunk pipeline.
-
Method Details
-
chat
Send a chat request with optional tool definitions.- Returns:
- the model's response
-
getCapabilities
NaruModelCapabilities getCapabilities() -
chatStream
Send a chat request, delivering output as it is produced.The contract is deliberately the same for every protocol: the handler receives
NaruStreamChunks and the call still returns one assembledNaruResponse. A protocol with no incremental transport therefore does not need to implement this at all -- the default replays a complete response as a short chunk sequence, so nothing downstream has to know whether the bytes actually arrived progressively.That is what lets a renderer, the transcript and the budget meter be written once against the streamed shape and work for a provider that cannot stream. The alternative, a separate code path per capability, is what this avoids.
- Parameters:
handler- receives chunks as they arrive; may benullto stream purely for the assembled response- Returns:
- the same response a non-streaming call would have produced
-
providerName
This protocol's provider name, stamped onto chunks for provenance.May be
nullfor a protocol that does not know it, in which case its chunks carry no provider rather than a fabricated one. -
replayAsChunks
Feeds an already-complete response through the chunk pipeline.Deliberately configured with no thinking delimiters: this protocol has already separated reasoning from the answer by whatever means it had, so rescanning the text for tags here could only re-interpret a decision that was already made -- and a model that merely mentions
<think>in a legitimate answer would have its answer truncated.
-