pub struct InferenceClient { /* private fields */ }Expand description
Auto-generated client for the Inference service.
Implementations§
Source§impl InferenceClient
impl InferenceClient
Sourcepub const SERVICE_NAME: &'static str = "inference"
pub const SERVICE_NAME: &'static str = "inference"
Canonical service/destination domain used for cryptographic RPC binding.
Sourcepub fn from_provider(
provider: &dyn RpcClientProvider,
signing_key: SigningKey,
token: Option<String>,
) -> Result<Self>
pub fn from_provider( provider: &dyn RpcClientProvider, signing_key: SigningKey, token: Option<String>, ) -> Result<Self>
Construct this typed client through an application-supplied
hyprstream_rpc::RpcClientProvider. Resolver authority and
endpoint policy stay outside the portable contract crate.
pub fn with_delegated_bearer(self, token: impl Into<String>) -> Self
Sourcepub fn with_bearer(self, token: impl Into<String>) -> Self
pub fn with_bearer(self, token: impl Into<String>) -> Self
Set this client’s DIRECT bearer for every call.
Unlike Self::with_delegated_bearer, the token travels as the
envelope’s own JWT — the caller is asserting the token as ITS
verified credential, and the receiving service’s holder/cnf
binding applies against this client’s signing key. Used for
caller-authored credentials (e.g. the Model→Inference
iw+jwt internal work order); never for relaying a foreign
holder’s token.
Sourcepub fn request(&self) -> RequestBuilder<'_>
pub fn request(&self) -> RequestBuilder<'_>
Create a per-call request builder for custom authentication options.
The builder is Send+Sync and idempotent — it stores per-call auth context without mutating the shared client. Safe for use with connection pooling.
Sourcepub async fn call(&self, payload: Vec<u8>) -> Result<Vec<u8>>
pub async fn call(&self, payload: Vec<u8>) -> Result<Vec<u8>>
Send a raw request and return the raw response bytes.
Sourcepub async fn call_with_method(
&self,
method_discriminator: u16,
payload: Vec<u8>,
) -> Result<Vec<u8>>
pub async fn call_with_method( &self, method_discriminator: u16, payload: Vec<u8>, ) -> Result<Vec<u8>>
Send a generated request with its canonical schema method id.
Sourcepub async fn call_streaming(
&self,
payload: Vec<u8>,
ephemeral_pubkey: [u8; 32],
) -> Result<Vec<u8>>
pub async fn call_streaming( &self, payload: Vec<u8>, ephemeral_pubkey: [u8; 32], ) -> Result<Vec<u8>>
Send a streaming request with ephemeral DH pubkey.
Sourcepub async fn call_streaming_with_method(
&self,
method_discriminator: u16,
payload: Vec<u8>,
ephemeral_pubkey: [u8; 32],
) -> Result<Vec<u8>>
pub async fn call_streaming_with_method( &self, method_discriminator: u16, payload: Vec<u8>, ephemeral_pubkey: [u8; 32], ) -> Result<Vec<u8>>
Send a generated streaming request with its schema method id.
Sourcepub async fn generate_stream(
&self,
__request: &GenerationRequest,
ephemeral_pubkey: [u8; 32],
) -> Result<StreamInfo>
pub async fn generate_stream( &self, __request: &GenerationRequest, ephemeral_pubkey: [u8; 32], ) -> Result<StreamInfo>
generate_stream (GenerationRequest variant)
Sourcepub async fn model_info(&self) -> Result<ModelInfo>
pub async fn model_info(&self) -> Result<ModelInfo>
model_info (Void variant)
Sourcepub async fn apply_chat_template(
&self,
__request: &ChatTemplateRequest,
) -> Result<String>
pub async fn apply_chat_template( &self, __request: &ChatTemplateRequest, ) -> Result<String>
apply_chat_template (ChatTemplateRequest variant)
Sourcepub async fn create_lora(&self, __request: &LoraConfig) -> Result<()>
pub async fn create_lora(&self, __request: &LoraConfig) -> Result<()>
create_lora (LoraConfig variant)
Sourcepub async fn unload_lora(&self) -> Result<()>
pub async fn unload_lora(&self) -> Result<()>
unload_lora (Void variant)
Sourcepub async fn set_session(&self, value: &str) -> Result<()>
pub async fn set_session(&self, value: &str) -> Result<()>
set_session (Text variant)
Sourcepub async fn clear_session(&self) -> Result<()>
pub async fn clear_session(&self) -> Result<()>
clear_session (Void variant)
Sourcepub async fn release_session(&self, value: &str) -> Result<()>
pub async fn release_session(&self, value: &str) -> Result<()>
release_session (Text variant)
Sourcepub async fn health_check(&self) -> Result<HealthStatus>
pub async fn health_check(&self) -> Result<HealthStatus>
health_check (Void variant)
Sourcepub async fn shutdown(&self) -> Result<InferenceResponseVariant>
pub async fn shutdown(&self) -> Result<InferenceResponseVariant>
shutdown (Void variant)
Sourcepub async fn ttt_writeback(&self) -> Result<()>
pub async fn ttt_writeback(&self) -> Result<()>
ttt_writeback (Void variant)
Sourcepub async fn train_step(
&self,
__request: &TrainStepRequest,
) -> Result<TrainStepResult>
pub async fn train_step( &self, __request: &TrainStepRequest, ) -> Result<TrainStepResult>
train_step (TrainStepRequest variant)
Sourcepub async fn get_delta_status(&self) -> Result<DeltaStatusResult>
pub async fn get_delta_status(&self) -> Result<DeltaStatusResult>
get_delta_status (Void variant)
Sourcepub async fn save_adaptation(
&self,
__request: &SaveAdaptationRequest,
) -> Result<SaveAdaptationResult>
pub async fn save_adaptation( &self, __request: &SaveAdaptationRequest, ) -> Result<SaveAdaptationResult>
save_adaptation (SaveAdaptationRequest variant)
Sourcepub async fn snapshot_delta(&self) -> Result<SnapshotDeltaResult>
pub async fn snapshot_delta(&self) -> Result<SnapshotDeltaResult>
snapshot_delta (Void variant)
Sourcepub async fn train_step_stream(
&self,
__request: &TrainStepRequest,
ephemeral_pubkey: [u8; 32],
) -> Result<StreamInfo>
pub async fn train_step_stream( &self, __request: &TrainStepRequest, ephemeral_pubkey: [u8; 32], ) -> Result<StreamInfo>
train_step_stream (TrainStepRequest variant)
Sourcepub async fn export_peft_adapter(
&self,
__request: &ExportPeftRequest,
) -> Result<ExportPeftResult>
pub async fn export_peft_adapter( &self, __request: &ExportPeftRequest, ) -> Result<ExportPeftResult>
export_peft_adapter (ExportPeftRequest variant)
Sourcepub async fn merge_lora(&self, __request: &MergeLoraRequest) -> Result<()>
pub async fn merge_lora(&self, __request: &MergeLoraRequest) -> Result<()>
merge_lora (MergeLoraRequest variant)
Sourcepub async fn create_lora_stream(
&self,
__request: &LoraConfig,
ephemeral_pubkey: [u8; 32],
) -> Result<StreamInfo>
pub async fn create_lora_stream( &self, __request: &LoraConfig, ephemeral_pubkey: [u8; 32], ) -> Result<StreamInfo>
create_lora_stream (LoraConfig variant)
Sourcepub async fn load_lora_stream(
&self,
value: &str,
ephemeral_pubkey: [u8; 32],
) -> Result<StreamInfo>
pub async fn load_lora_stream( &self, value: &str, ephemeral_pubkey: [u8; 32], ) -> Result<StreamInfo>
load_lora_stream (Text variant)
Sourcepub async fn save_lora_stream(
&self,
value: &str,
ephemeral_pubkey: [u8; 32],
) -> Result<StreamInfo>
pub async fn save_lora_stream( &self, value: &str, ephemeral_pubkey: [u8; 32], ) -> Result<StreamInfo>
save_lora_stream (Text variant)
Sourcepub async fn save_adaptation_stream(
&self,
__request: &SaveAdaptationRequest,
ephemeral_pubkey: [u8; 32],
) -> Result<StreamInfo>
pub async fn save_adaptation_stream( &self, __request: &SaveAdaptationRequest, ephemeral_pubkey: [u8; 32], ) -> Result<StreamInfo>
save_adaptation_stream (SaveAdaptationRequest variant)
Sourcepub async fn snapshot_delta_stream(
&self,
ephemeral_pubkey: [u8; 32],
) -> Result<StreamInfo>
pub async fn snapshot_delta_stream( &self, ephemeral_pubkey: [u8; 32], ) -> Result<StreamInfo>
snapshot_delta_stream (Void variant)
Sourcepub async fn export_peft_adapter_stream(
&self,
__request: &ExportPeftRequest,
ephemeral_pubkey: [u8; 32],
) -> Result<StreamInfo>
pub async fn export_peft_adapter_stream( &self, __request: &ExportPeftRequest, ephemeral_pubkey: [u8; 32], ) -> Result<StreamInfo>
export_peft_adapter_stream (ExportPeftRequest variant)
Sourcepub async fn merge_lora_stream(
&self,
__request: &MergeLoraRequest,
ephemeral_pubkey: [u8; 32],
) -> Result<StreamInfo>
pub async fn merge_lora_stream( &self, __request: &MergeLoraRequest, ephemeral_pubkey: [u8; 32], ) -> Result<StreamInfo>
merge_lora_stream (MergeLoraRequest variant)
Sourcepub async fn embed(
&self,
__request: &EmbedImagesRequest,
) -> Result<EmbedImagesResponse>
pub async fn embed( &self, __request: &EmbedImagesRequest, ) -> Result<EmbedImagesResponse>
embed (EmbedImagesRequest variant)
Sourcepub async fn get_layer_profile(&self) -> Result<LayerProfileResult>
pub async fn get_layer_profile(&self) -> Result<LayerProfileResult>
get_layer_profile (Void variant)
Sourcepub fn parse_response(bytes: &[u8]) -> Result<InferenceResponseVariant>
pub fn parse_response(bytes: &[u8]) -> Result<InferenceResponseVariant>
Parse a response from raw bytes.
Source§impl InferenceClient
impl InferenceClient
Sourcepub fn for_local_bootstrap(
signing_key: SigningKey,
destination: VerifyingKey,
token: Option<String>,
) -> Result<Self>
pub fn for_local_bootstrap( signing_key: SigningKey, destination: VerifyingKey, token: Option<String>, ) -> Result<Self>
Construct a client for a co-located service discovered through the explicitly registered local endpoint.
Sourcepub fn for_local_endpoint_bootstrap(
endpoint: &str,
signing_key: SigningKey,
destination: VerifyingKey,
token: Option<String>,
) -> Result<Self>
pub fn for_local_endpoint_bootstrap( endpoint: &str, signing_key: SigningKey, destination: VerifyingKey, token: Option<String>, ) -> Result<Self>
Construct a client from an explicit local endpoint string.
Sourcepub fn for_local_transport_bootstrap(
transport: &TransportConfig,
signing_key: SigningKey,
destination: VerifyingKey,
token: Option<String>,
) -> Result<Self>
pub fn for_local_transport_bootstrap( transport: &TransportConfig, signing_key: SigningKey, destination: VerifyingKey, token: Option<String>, ) -> Result<Self>
Construct a client from a typed local transport.
Source§impl InferenceClient
impl InferenceClient
Sourcepub async fn call_method(&self, method: &str, args: &Value) -> Result<Value>
pub async fn call_method(&self, method: &str, args: &Value) -> Result<Value>
Dispatch a method call by name with JSON arguments. Returns the response as a proper JSON value.
Sourcepub async fn call_streaming_method(
&self,
method: &str,
args: &Value,
ephemeral_pubkey: [u8; 32],
) -> Result<StreamInfo>
pub async fn call_streaming_method( &self, method: &str, args: &Value, ephemeral_pubkey: [u8; 32], ) -> Result<StreamInfo>
Dispatch a streaming method call by name with JSON arguments and an ephemeral public key.
Returns the verified-capnp StreamInfo library type (decoded + COSE-verified
inside call_streaming) — NOT a re-serialized serde_json::Value (#468).
Trait Implementations§
Source§impl Clone for InferenceClient
impl Clone for InferenceClient
Source§fn clone(&self) -> InferenceClient
fn clone(&self) -> InferenceClient
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moreSource§impl InferenceRpc for InferenceClient
impl InferenceRpc for InferenceClient
fn generate_stream<'life0, 'life1, 'async_trait>(
&'life0 self,
request: &'life1 GenerationRequest,
) -> Pin<Box<dyn Future<Output = Result<MoqStreamHandle>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
fn model_info<'life0, 'async_trait>(
&'life0 self,
) -> Pin<Box<dyn Future<Output = Result<ModelInfo>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
fn is_ready<'life0, 'async_trait>(
&'life0 self,
) -> Pin<Box<dyn Future<Output = Result<bool>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
fn apply_chat_template<'life0, 'life1, 'async_trait>(
&'life0 self,
request: &'life1 ChatTemplateRequest,
) -> Pin<Box<dyn Future<Output = Result<String>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
fn create_lora<'life0, 'life1, 'async_trait>(
&'life0 self,
request: &'life1 LoraConfig,
) -> Pin<Box<dyn Future<Output = Result<()>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
fn load_lora<'life0, 'life1, 'async_trait>(
&'life0 self,
value: &'life1 str,
) -> Pin<Box<dyn Future<Output = Result<()>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
fn save_lora<'life0, 'life1, 'async_trait>(
&'life0 self,
value: &'life1 str,
) -> Pin<Box<dyn Future<Output = Result<()>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
fn unload_lora<'life0, 'async_trait>(
&'life0 self,
) -> Pin<Box<dyn Future<Output = Result<()>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
fn has_lora<'life0, 'async_trait>(
&'life0 self,
) -> Pin<Box<dyn Future<Output = Result<bool>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
fn set_session<'life0, 'life1, 'async_trait>(
&'life0 self,
value: &'life1 str,
) -> Pin<Box<dyn Future<Output = Result<()>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
fn clear_session<'life0, 'async_trait>(
&'life0 self,
) -> Pin<Box<dyn Future<Output = Result<()>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
fn release_session<'life0, 'life1, 'async_trait>(
&'life0 self,
value: &'life1 str,
) -> Pin<Box<dyn Future<Output = Result<()>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
fn health_check<'life0, 'async_trait>(
&'life0 self,
) -> Pin<Box<dyn Future<Output = Result<HealthStatus>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
fn ttt_writeback<'life0, 'async_trait>(
&'life0 self,
) -> Pin<Box<dyn Future<Output = Result<()>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
fn ttt_evict<'life0, 'async_trait>(
&'life0 self,
) -> Pin<Box<dyn Future<Output = Result<()>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
fn train_step<'life0, 'life1, 'async_trait>(
&'life0 self,
request: &'life1 TrainStepRequest,
) -> Pin<Box<dyn Future<Output = Result<TrainStepResult>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
fn ttt_zero<'life0, 'async_trait>(
&'life0 self,
) -> Pin<Box<dyn Future<Output = Result<()>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
fn get_delta_status<'life0, 'async_trait>(
&'life0 self,
) -> Pin<Box<dyn Future<Output = Result<DeltaStatusResult>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
fn save_adaptation<'life0, 'life1, 'async_trait>(
&'life0 self,
request: &'life1 SaveAdaptationRequest,
) -> Pin<Box<dyn Future<Output = Result<SaveAdaptationResult>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
fn snapshot_delta<'life0, 'async_trait>(
&'life0 self,
) -> Pin<Box<dyn Future<Output = Result<SnapshotDeltaResult>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
fn train_step_stream<'life0, 'life1, 'async_trait>(
&'life0 self,
request: &'life1 TrainStepRequest,
) -> Pin<Box<dyn Future<Output = Result<MoqStreamHandle>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
fn export_peft_adapter<'life0, 'life1, 'async_trait>(
&'life0 self,
request: &'life1 ExportPeftRequest,
) -> Pin<Box<dyn Future<Output = Result<ExportPeftResult>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
fn merge_lora<'life0, 'life1, 'async_trait>(
&'life0 self,
request: &'life1 MergeLoraRequest,
) -> Pin<Box<dyn Future<Output = Result<()>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
fn create_lora_stream<'life0, 'life1, 'async_trait>(
&'life0 self,
request: &'life1 LoraConfig,
) -> Pin<Box<dyn Future<Output = Result<MoqStreamHandle>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
fn load_lora_stream<'life0, 'life1, 'async_trait>(
&'life0 self,
value: &'life1 str,
) -> Pin<Box<dyn Future<Output = Result<MoqStreamHandle>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
fn save_lora_stream<'life0, 'life1, 'async_trait>(
&'life0 self,
value: &'life1 str,
) -> Pin<Box<dyn Future<Output = Result<MoqStreamHandle>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
fn save_adaptation_stream<'life0, 'life1, 'async_trait>(
&'life0 self,
request: &'life1 SaveAdaptationRequest,
) -> Pin<Box<dyn Future<Output = Result<MoqStreamHandle>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
fn snapshot_delta_stream<'life0, 'async_trait>(
&'life0 self,
) -> Pin<Box<dyn Future<Output = Result<MoqStreamHandle>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
fn export_peft_adapter_stream<'life0, 'life1, 'async_trait>(
&'life0 self,
request: &'life1 ExportPeftRequest,
) -> Pin<Box<dyn Future<Output = Result<MoqStreamHandle>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
fn merge_lora_stream<'life0, 'life1, 'async_trait>(
&'life0 self,
request: &'life1 MergeLoraRequest,
) -> Pin<Box<dyn Future<Output = Result<MoqStreamHandle>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
fn embed<'life0, 'life1, 'async_trait>(
&'life0 self,
request: &'life1 EmbedImagesRequest,
) -> Pin<Box<dyn Future<Output = Result<EmbedImagesResponse>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
fn get_layer_profile<'life0, 'async_trait>(
&'life0 self,
) -> Pin<Box<dyn Future<Output = Result<LayerProfileResult>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
Auto Trait Implementations§
impl Freeze for InferenceClient
impl !RefUnwindSafe for InferenceClient
impl Send for InferenceClient
impl Sync for InferenceClient
impl Unpin for InferenceClient
impl UnsafeUnpin for InferenceClient
impl !UnwindSafe for InferenceClient
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
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
§impl<T> Instrument for T
impl<T> Instrument for T
§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
§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>
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>
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