Skip to main content

AxumServer

Struct AxumServer 

Source
pub struct AxumServer { /* private fields */ }
Expand description

Axum-based server implementation.

The server is built around AppState, which holds an optional engine per modality. Handlers fault to 503 when the modality they need isn’t loaded, instead of running stub error logic.

Implementations§

Source§

impl AxumServer

Source

pub fn from_state(state: AppState) -> Self

Create a server with a fully populated AppState.

Source

pub fn from_llm(engine: Arc<dyn LlmInferenceEngine + Send + Sync>) -> Self

Convenience constructor for an LLM-only server (chat / completions).

Source

pub fn from_embed(engine: Arc<dyn EmbedEngine + Send + Sync>) -> Self

Convenience constructor for an embedding-only server (/v1/embeddings).

Source

pub fn from_transcribe(engine: Arc<dyn TranscribeEngine + Send + Sync>) -> Self

Convenience constructor for a transcription-only server (/v1/audio/transcriptions).

Source

pub fn from_tts(engine: Arc<dyn TtsEngine + Send + Sync>) -> Self

Convenience constructor for a TTS-only server (/v1/audio/speech).

Source

pub fn with_auto_config(self, auto_config: ResolvedFerrumConfig) -> Self

Attach the startup auto-configuration decision trace exposed by /health. Constructors keep this optional so tests and non-LLM deployments can use the server without a model-specific resolver.

Source

pub fn with_prompt_template( self, prompt_template: Option<ModelChatTemplate>, ) -> Self

Attach the loaded model’s prompt template, if available. This keeps OpenAI request aliases from driving prompt-family selection.

Source

pub fn with_default_enable_thinking(self, enable_thinking: Option<bool>) -> Self

Set the server-wide reasoning default for requests that omit chat_template_kwargs.enable_thinking. Per-request values still win.

Source

pub fn with_served_model_registry(self, registry: ServedModelRegistry) -> Self

Install the public OpenAI model namespace used for request routing and /v1/models. The registry keeps public aliases separate from the engine’s internal model id.

Source

pub fn with_lora_adapters( self, base_model_id: impl Into<String>, adapters: Vec<LoraAdapterModel>, ) -> Result<Self>

Attach startup-loaded LoRA adapter model ids.

Trait Implementations§

Source§

impl HttpServer for AxumServer

Source§

fn start<'life0, 'life1, 'async_trait>( &'life0 self, config: &'life1 ServerConfig, ) -> Pin<Box<dyn Future<Output = Result<()>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait,

Start the server
Source§

fn stop<'life0, 'async_trait>( &'life0 self, timeout: Duration, ) -> Pin<Box<dyn Future<Output = Result<()>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait,

Stop the server gracefully
Source§

fn is_running(&self) -> bool

Check if server is running
Source§

fn address(&self) -> Option<SocketAddr>

Get server address
Source§

fn register_handler( &mut self, _path: &str, _method: HttpMethod, _handler: Box<dyn RequestHandler>, )

Register a request handler
Source§

fn register_middleware(&mut self, _middleware: Box<dyn Middleware>)

Register middleware
Source§

fn get_metrics(&self) -> ServerMetrics

Get server metrics
Source§

fn health_check<'life0, 'async_trait>( &'life0 self, ) -> Pin<Box<dyn Future<Output = HealthStatus> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait,

Health check

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> ErasedDestructor for T
where T: 'static,

Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T> Instrument for T

Source§

fn instrument(self, span: Span) -> Instrumented<Self>

Instruments this type with the provided Span, returning an Instrumented wrapper. Read more
Source§

fn in_current_span(self) -> Instrumented<Self>

Instruments this type with the current Span, returning an Instrumented wrapper. Read more
Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> Pointable for T

Source§

const ALIGN: usize

The alignment of pointer.
Source§

type Init = T

The type for initializers.
Source§

unsafe fn init(init: <T as Pointable>::Init) -> usize

Initializes a with the given initializer. Read more
Source§

unsafe fn deref<'a>(ptr: usize) -> &'a T

Dereferences the given pointer. Read more
Source§

unsafe fn deref_mut<'a>(ptr: usize) -> &'a mut T

Mutably dereferences the given pointer. Read more
Source§

unsafe fn drop(ptr: usize)

Drops the object pointed to by the given pointer. Read more
Source§

impl<T> Same for T

Source§

type Output = T

Should always be Self
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = !

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
Source§

impl<V, T> VZip<V> for T
where V: MultiLane<T>,

Source§

fn vzip(self) -> V

Source§

impl<T> WithSubscriber for T

Source§

fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self>
where S: Into<Dispatch>,

Attaches the provided Subscriber to this type, returning a WithDispatch wrapper. Read more
Source§

fn with_current_subscriber(self) -> WithDispatch<Self>

Attaches the current default Subscriber to this type, returning a WithDispatch wrapper. Read more