pub struct HyperInferClient { /* private fields */ }Implementations§
Source§impl HyperInferClient
impl HyperInferClient
pub async fn new( redis_url: &str, config: Config, ) -> Result<Self, HyperInferError>
Sourcepub async fn set_mirror(&self, cfg: Option<MirrorConfig>)
pub async fn set_mirror(&self, cfg: Option<MirrorConfig>)
Configure traffic mirroring. Pass None to disable.
pub async fn inject_provider_registry( &self, external_registry: Arc<ProviderRegistry>, )
Sourcepub async fn load_deployments(&self, deployments: Vec<Deployment>)
pub async fn load_deployments(&self, deployments: Vec<Deployment>)
Load deployments into the router engine for deployment-based routing
Sourcepub async fn subscribe_config_updates<F, Fut>(
&self,
redis_url: &str,
fetcher: F,
) -> Result<(), HyperInferError>
pub async fn subscribe_config_updates<F, Fut>( &self, redis_url: &str, fetcher: F, ) -> Result<(), HyperInferError>
Subscribe to Redis Pub/Sub for live deployment config changes. When a message arrives on “hyperinfer:config_updates”, calls the provided fetcher function to re-fetch deployments and rebuilds the routing pool.
Sourcepub fn router_engine(&self) -> &Arc<RouterEngine> ⓘ
pub fn router_engine(&self) -> &Arc<RouterEngine> ⓘ
Get a reference to the router engine
pub async fn chat( &self, key: &str, request: ChatRequest, ) -> Result<ChatResponse, HyperInferError>
Sourcepub async fn chat_stream(
&self,
key: &str,
request: ChatRequest,
) -> Result<Pin<Box<dyn Stream<Item = Result<ChatChunk, HyperInferError>> + Send>>, HyperInferError>
pub async fn chat_stream( &self, key: &str, request: ChatRequest, ) -> Result<Pin<Box<dyn Stream<Item = Result<ChatChunk, HyperInferError>> + Send>>, HyperInferError>
Stream token chunks for a chat request.
Returns a Stream of ChatChunk items. The caller is responsible for
collecting delta fields and assembling the final text. The last chunk
in the stream has a non-None finish_reason and may carry usage.
Rate-limiting and routing follow the same logic as chat().
Auto Trait Implementations§
impl !RefUnwindSafe for HyperInferClient
impl !UnwindSafe for HyperInferClient
impl Freeze for HyperInferClient
impl Send for HyperInferClient
impl Sync for HyperInferClient
impl Unpin for HyperInferClient
impl UnsafeUnpin for HyperInferClient
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> FutureExt for T
impl<T> FutureExt for T
Source§fn with_context(self, otel_cx: Context) -> WithContext<Self>
fn with_context(self, otel_cx: Context) -> WithContext<Self>
Source§fn with_current_context(self) -> WithContext<Self>
fn with_current_context(self) -> WithContext<Self>
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