pub fn complete_streaming_until(
profile_id: &str,
model_id: &str,
model_request: ModelRequest,
timeout: Duration,
on_event: &mut dyn FnMut(&StreamEvent),
stop: &(dyn Fn() -> bool + Sync),
) -> Result<ModelResponse, ClientError>Expand description
complete_streaming for a caller that may stop wanting the answer:
once stop says so (it is asked every STOP_POLL while the turn
runs), the gateway is told to stop the provider call, so
an abandoned turn is not paid for to its end and no longer holds the
process’s one gateway channel.
§Errors
As complete_streaming; a stopped turn fails as
ErrorKind::Cancelled,
and a gateway that cannot stop calls refuses the turn before any work.