pub struct TttClient { /* private fields */ }Expand description
Scoped client for ttt operations (transport-agnostic).
Implementations§
Source§impl TttClient
impl TttClient
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_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 fn parse_scoped_response(bytes: &[u8]) -> Result<TttClientResponseVariant>
pub fn parse_scoped_response(bytes: &[u8]) -> Result<TttClientResponseVariant>
Parse a scoped response from raw bytes.
Sourcepub async fn init(&self, __request: &LoraConfig) -> Result<()>
pub async fn init(&self, __request: &LoraConfig) -> Result<()>
Initialize the training infrastructure (LoRA parameters, optimizer, delta pool) on a loaded model. Required before ttt.train or TTT-enabled inference. Configure rank, alpha, target modules, and learning rate.
Scope: train
Sourcepub async fn train(
&self,
__request: &TrainStepRequest,
) -> Result<TrainStepResult>
pub async fn train( &self, __request: &TrainStepRequest, ) -> Result<TrainStepResult>
Run TTT gradient steps on input text WITHOUT generating a response. Pure training — use for pre-training on domain text before asking questions. Returns loss metrics and recommendation. Use adaptationStrategy=speculative to keep pending, then call ttt.writeback or ttt.evict.
Scope: train
Sourcepub async fn train_stream(
&self,
__request: &TrainStepRequest,
ephemeral_pubkey: [u8; 32],
) -> Result<StreamInfo>
pub async fn train_stream( &self, __request: &TrainStepRequest, ephemeral_pubkey: [u8; 32], ) -> Result<StreamInfo>
Stream TTT training on input text. Returns progress and results via streaming. Use for long-running training that would timeout via ttt.train.
Scope: train
Sourcepub async fn writeback(&self) -> Result<()>
pub async fn writeback(&self) -> Result<()>
Write back a pending TTT adaptation to the tenant delta accumulator. Call after reviewing onlineTrainingMetrics.recommendation from infer.generateStream. Must be called within the pending rollback window (default 60 seconds, configurable via pending_rollback_ms). If the window expires, the adaptation is auto-evicted and this call will return an error.
Scope: manage
Sourcepub async fn evict(&self) -> Result<()>
pub async fn evict(&self) -> Result<()>
Evict (discard) a pending TTT adaptation, restoring the tenant delta accumulator to its pre-adaptation state. Call within the pending rollback window (default 60 seconds, configurable via pending_rollback_ms) if recommendation was false or output quality was poor. If multiple adaptations were stacked, evict restores to the state before the earliest pending adaptation.
Scope: manage
Sourcepub async fn zero(&self) -> Result<()>
pub async fn zero(&self) -> Result<()>
Zero the tenant delta accumulator, clearing all accumulated training. Use after ttt.save or ttt.export to free capacity.
Scope: manage
Sourcepub async fn status(&self) -> Result<DeltaStatusResult>
pub async fn status(&self) -> Result<DeltaStatusResult>
Get tenant delta accumulator metrics: step count, loss improvement, drift. Use to decide if adaptations should be persisted via ttt.save or ttt.export.
Scope: query
Sourcepub async fn save(
&self,
__request: &SaveAdaptationRequest,
) -> Result<SaveAdaptationResult>
pub async fn save( &self, __request: &SaveAdaptationRequest, ) -> Result<SaveAdaptationResult>
Merge the tenant delta accumulator into an on-disk adapter file using a configurable merge strategy (replace/additive/do_merge). For incremental refinement of existing adapters. Call ttt.status first to verify quality. The result is committed to the model’s git repository.
Scope: write
Sourcepub async fn snapshot(&self) -> Result<SnapshotDeltaResult>
pub async fn snapshot(&self) -> Result<SnapshotDeltaResult>
Snapshot the tenant delta accumulator to content-addressed storage without merging into an adapter file.
Scope: write
Sourcepub async fn export(
&self,
__request: &ExportPeftRequest,
) -> Result<ExportPeftResult>
pub async fn export( &self, __request: &ExportPeftRequest, ) -> Result<ExportPeftResult>
Export the tenant delta accumulator as a standalone PEFT-compatible adapter directory (adapter_config.json + adapter_model.safetensors). For interop with HuggingFace and external tools. The exported adapter can be reloaded via adapter.load.
Scope: write
Sourcepub async fn write_ttt_config(
&self,
__request: &WriteTttConfigRequest,
) -> Result<()>
pub async fn write_ttt_config( &self, __request: &WriteTttConfigRequest, ) -> Result<()>
Write hyprstream_training configuration to the model worktree’s config.json and optionally reload. Required before ttt.train or TTT-enabled inference. Sets training mode to test_time_training and configures LoRA rank/alpha, target modules, and learning rate.
Scope: write
Source§impl TttClient
impl TttClient
Trait Implementations§
Source§impl TttRpc for TttClient
impl TttRpc for TttClient
fn init<'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 train<'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 train_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 writeback<'life0, 'async_trait>(
&'life0 self,
) -> Pin<Box<dyn Future<Output = Result<()>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
fn evict<'life0, 'async_trait>(
&'life0 self,
) -> Pin<Box<dyn Future<Output = Result<()>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
fn zero<'life0, 'async_trait>(
&'life0 self,
) -> Pin<Box<dyn Future<Output = Result<()>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
fn 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<'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<'life0, 'async_trait>(
&'life0 self,
) -> Pin<Box<dyn Future<Output = Result<SnapshotDeltaResult>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
fn export<'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 write_ttt_config<'life0, 'life1, 'async_trait>(
&'life0 self,
request: &'life1 WriteTttConfigRequest,
) -> Pin<Box<dyn Future<Output = Result<()>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
Auto Trait Implementations§
impl Freeze for TttClient
impl !RefUnwindSafe for TttClient
impl Send for TttClient
impl Sync for TttClient
impl Unpin for TttClient
impl UnsafeUnpin for TttClient
impl !UnwindSafe for TttClient
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