stream method
Streams the output of invoking the Runnable
on the given input
.
input
- the input to invoke theRunnable
on.options
- the options to use when invoking theRunnable
.
Implementation
@override
Stream<ChatResult> stream(
final PromptValue input, {
final ChatOllamaOptions? options,
}) {
final id = _uuid.v4();
return _client
.generateChatCompletionStream(
request: generateChatCompletionRequest(
input.toChatMessages(),
options: options,
defaultOptions: defaultOptions,
stream: true,
),
)
.map(
(final completion) => completion.toChatResult(id, streaming: true),
);
}