pub struct ModelsResource<'c> { /* private fields */ }Expand description
client.models() — B-112 embedded ML model registry.
Upload ONNX models that the streaming ml_predict operator scores events
against, in-process on the Pulse engine (no model-server hop). Models are
org-scoped; upload / delete require the ADMIN role.
§Example
use pulse_client::{PulseClient, ModelUpload};
use std::collections::BTreeMap;
let mut input = BTreeMap::new();
input.insert("amount".to_string(), "float".to_string());
input.insert("country".to_string(), "string".to_string());
client
.models()
.upload(
ModelUpload::from_path("fraud-classifier", "./model.onnx")
.input_schema(input),
)
.await?;Implementations§
Source§impl ModelsResource<'_>
impl ModelsResource<'_>
Sourcepub async fn upload(&self, upload: ModelUpload) -> Result<Value, PulseError>
pub async fn upload(&self, upload: ModelUpload) -> Result<Value, PulseError>
POST /api/pulse/ml-models — upload (or replace) a model.
Sent as multipart/form-data: a file part named model carrying the
bytes, plus text parts name, runtime, and (when set) inputSchema /
outputSchema as JSON strings. Replacing an existing name hot-swaps the
model with no agent restart.
Returns the persisted model metadata (name, runtime, sha256, version, …).
§Errors
PulseError::InvalidConfigifnameis blank, if neither or both ofpath/dataare set, or if the model bytes are empty.PulseError::Transportif reading the file atpathfails.
Sourcepub async fn list(&self) -> Result<Vec<Value>, PulseError>
pub async fn list(&self) -> Result<Vec<Value>, PulseError>
GET /api/pulse/ml-models — models registered for the caller’s org.
Trait Implementations§
Auto Trait Implementations§
impl<'c> Freeze for ModelsResource<'c>
impl<'c> !RefUnwindSafe for ModelsResource<'c>
impl<'c> Send for ModelsResource<'c>
impl<'c> Sync for ModelsResource<'c>
impl<'c> Unpin for ModelsResource<'c>
impl<'c> UnsafeUnpin for ModelsResource<'c>
impl<'c> !UnwindSafe for ModelsResource<'c>
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