pub struct ModelClient<T> { /* private fields */ }Expand description
A selected-model backend suitable for host-scoped installation. Selection travels as public profile/model identifiers; provider URLs and keys do not.
FdTransport negotiates cancellation before starting work and preserves its
launcher connection after a synchronized Stop. Older gateways fail closed;
corrupt or unresponsive connections require relaunch, never a socket fallback.
Implementations§
Source§impl<T: Transport> ModelClient<T>
impl<T: Transport> ModelClient<T>
Sourcepub async fn complete_once(
&self,
request: &ModelRequest,
) -> Result<ModelResponse, ModelError>
pub async fn complete_once( &self, request: &ModelRequest, ) -> Result<ModelResponse, ModelError>
A Send-safe single completion over this client’s selected route.
Sourcepub fn default_model(transport: T, timeout: Duration) -> Self
pub fn default_model(transport: T, timeout: Duration) -> Self
Resolve the gateway’s current deliberate default at each inference start.
Sourcepub async fn complete_streaming(
&self,
request: &ModelRequest,
event: &mut (dyn FnMut(&StreamEvent) -> bool + Send),
) -> Result<ModelResponse, ModelError>
pub async fn complete_streaming( &self, request: &ModelRequest, event: &mut (dyn FnMut(&StreamEvent) -> bool + Send), ) -> Result<ModelResponse, ModelError>
Presentation deltas survive terminal failure in the caller’s StreamState.
Returning false cancels the request; partial tools never authorize actions.
pub fn new( transport: T, profile_id: String, model_id: String, timeout: Duration, ) -> Self
Trait Implementations§
Source§impl<T: Transport> ModelBackend for ModelClient<T>
impl<T: Transport> ModelBackend for ModelClient<T>
Source§fn stream<'a>(
&'a self,
request: &'a ModelRequest,
sink: StreamSink<'a>,
) -> CompletionFuture<'a>
fn stream<'a>( &'a self, request: &'a ModelRequest, sink: StreamSink<'a>, ) -> CompletionFuture<'a>
Backends may override for live deltas. Dropping the future cancels the
local subscription. The returned response, not EOF, is authoritative.
fn complete<'a>(&'a self, request: &'a ModelRequest) -> CompletionFuture<'a>
Auto Trait Implementations§
impl<T> Forget for ModelClient<T>
impl<T> Freeze for ModelClient<T>where
T: Freeze,
impl<T> Move for ModelClient<T>
impl<T> RefUnwindSafe for ModelClient<T>where
T: RefUnwindSafe,
impl<T> Send for ModelClient<T>where
T: Send,
impl<T> Sync for ModelClient<T>where
T: Sync,
impl<T> Unpin for ModelClient<T>where
T: Unpin,
impl<T> UnsafeUnpin for ModelClient<T>where
T: UnsafeUnpin,
impl<T> UnwindSafe for ModelClient<T>where
T: UnwindSafe,
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self> ⓘ
fn instrument(self, span: Span) -> Instrumented<Self> ⓘ
Source§fn in_current_span(self) -> Instrumented<Self> ⓘ
fn in_current_span(self) -> Instrumented<Self> ⓘ
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
Converts
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
Converts
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more