mutil-ai 0.7.0

A beginner-friendly, provider-neutral Rust AI SDK with a strict normalization layer.
Documentation
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
use crate::error::Result;
use crate::types::ChatRequest;

/// A synchronous, provider-neutral request transform.
///
/// Transforms run once per logical request before capability gating and
/// normalization. Retries and stream reconnects reuse the transformed request.
pub trait RequestTransform: Send + Sync {
    /// Applies the transform to a request.
    ///
    /// Implementations should be pure and deterministic: the result is reused
    /// across retries and stream reconnects.
    ///
    /// # Errors
    /// Returns an error when the request cannot be transformed; the request is
    /// then not sent at all.
    fn transform(&self, request: &ChatRequest) -> Result<ChatRequest>;
}