Expand description
Rust client for the SIE inference server.
use sie_sdk::{Client, Item, OutputType};
let client = Client::new("http://localhost:8080")?;
let result = client
.encode("BAAI/bge-m3", [Item::text("Hello world")])
.output_types([OutputType::Dense, OutputType::Sparse])
.send_one()
.await?;
println!("{:?}", result.dense);§Waiting for capacity
SIE scales from zero and loads models on demand, so a request can legitimately be
answered with “not yet”. The client absorbs that: PROVISIONING, MODEL_LOADING,
LORA_LOADING and RESOURCE_EXHAUSTED are retried inside a wall-clock budget
(15 minutes by default) with bounded, jittered backoff. Endpoints that are not
idempotent never replay a request that may already have reached a worker.
Opt out per call when a failure is more useful than a wait:
let result = client
.encode("BAAI/bge-m3", [Item::text("Hello")])
.wait_for_capacity(false)
.max_oom_retries(0)
.send_one()
.await;
if let Err(error) = &result
&& error.is_capacity_error()
{
// Fall back to a smaller model, or shed the request.
}Re-exports§
pub use client::WatchMode;pub use client::jobs::connection_name;pub use client::jobs::require_connection_name;pub use client::jobs::require_connector_idempotency_key;pub use client::ChunkStream;pub use client::Client;pub use client::ClientBuilder;pub use error::Error;pub use error::ModelLoadErrorClass;pub use error::Result;pub use error::TransportErrorKind;pub use media::Samples;pub use retry::RequestOptions;pub use scoring::maxsim;pub use scoring::maxsim_batch;pub use types::AudioInput;pub use types::BinaryInput;pub use types::CapacityInfo;pub use types::Classification;pub use types::DType;pub use types::DetectedObject;pub use types::EncodeResult;pub use types::Entity;pub use types::ExtractResult;pub use types::HealthResponse;pub use types::ImageInput;pub use types::Item;pub use types::ModelInfo;pub use types::ModelState;pub use types::Multivector;pub use types::OutputDType;pub use types::OutputType;pub use types::RequestMetadata;pub use types::RequestUsage;pub use types::ScoreResult;pub use types::SparseVector;pub use types::TimingInfo;
Modules§
- blocking
- A blocking facade over the async client.
- client
- The client, its builder, and the one request path every endpoint shares.
- error
- The single error type returned by every fallible SDK operation.
- media
- Turning caller-supplied images, audio and documents into the bytes the wire carries.
- ndarray
- Conversions into
ndarraytypes, for callers whose numeric code already uses it. - redaction
- Scrubbing secrets out of anything that reaches a log.
- retry
- The retry state machine shared by every endpoint.
- scoring
- Client-side
MaxSimscoring for late-interaction (ColBERT-style) models. - types
- Wire types for every SIE endpoint.
- wire
- Server error envelopes: decoding them, and mapping status + code onto
Error.
Constants§
- VERSION
- The version this SDK reports to the server.