Interface NaruStreamResponseParser
- All Known Implementing Classes:
NaruOllamaNativeStreamParser,NaruOpenApiStreamParser,NaruSseResponseParser
public interface NaruStreamResponseParser
Reads a successful HTTP response as a sequence of model events and returns the
assembled result.
Separate from the wire format so that the request lifecycle -- retries, audit logging, error classification, cache commit -- is written once and reused by every protocol, whether its stream arrives as SSE frames or as one JSON document per line.
-
Method Summary
Modifier and TypeMethodDescriptionbooleanWhether any user-visible output has already been delivered.read(net.thevpc.nuts.net.NHttpResponse response) Consumes the body incrementally and returns the assembled response.
-
Method Details
-
read
Consumes the body incrementally and returns the assembled response.Must deliver events as they arrive rather than reading the whole body first: the entire point is that a renderer sees text while the model is still generating it.
- Throws:
IOException
-
hasDeliveredContent
boolean hasDeliveredContent()Whether any user-visible output has already been delivered.Consulted by the caller before retrying. A stream that has delivered nothing can be retried invisibly; one that has cannot, because the tokens cannot be recalled.
-