Skip to main content

Module blocking

Module blocking 

Source
Expand description

A blocking facade over the async client.

There is one implementation of every endpoint, and this module drives it on a runtime it owns. Rather than mirroring every builder in a second, drift-prone surface, it hands you the real crate::Client and runs the future it produces:

use sie_sdk::{Item, blocking::Client};

let client = Client::new("http://localhost:8080")?;

let result = client.call(|sie| sie.encode("BAAI/bge-m3", [Item::text("Hello")]).send_one())?;
println!("{:?}", result.dense);

for model in client.call(|sie| sie.list_models())? {
    println!("{}", model.name);
}

Every builder, option and error is the same as on the async client.

§Do not call this from async code

Blocking a thread that is already inside a Tokio runtime deadlocks it. In an async context, use crate::Client directly.

Structs§

Client
A blocking handle to one SIE server.
ClientBuilder
Configures a blocking Client.