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
impl AxumServer
Sourcepub fn from_state(state: AppState) -> Self
pub fn from_state(state: AppState) -> Self
Create a server with a fully populated AppState.
Sourcepub fn from_llm(engine: Arc<dyn LlmInferenceEngine + Send + Sync>) -> Self
pub fn from_llm(engine: Arc<dyn LlmInferenceEngine + Send + Sync>) -> Self
Convenience constructor for an LLM-only server (chat / completions).
Sourcepub fn from_embed(engine: Arc<dyn EmbedEngine + Send + Sync>) -> Self
pub fn from_embed(engine: Arc<dyn EmbedEngine + Send + Sync>) -> Self
Convenience constructor for an embedding-only server (/v1/embeddings).
Sourcepub fn from_transcribe(engine: Arc<dyn TranscribeEngine + Send + Sync>) -> Self
pub fn from_transcribe(engine: Arc<dyn TranscribeEngine + Send + Sync>) -> Self
Convenience constructor for a transcription-only server
(/v1/audio/transcriptions).
Sourcepub fn from_tts(engine: Arc<dyn TtsEngine + Send + Sync>) -> Self
pub fn from_tts(engine: Arc<dyn TtsEngine + Send + Sync>) -> Self
Convenience constructor for a TTS-only server (/v1/audio/speech).
Sourcepub fn with_auto_config(self, auto_config: ResolvedFerrumConfig) -> Self
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.
Sourcepub fn with_prompt_template(
self,
prompt_template: Option<ModelChatTemplate>,
) -> Self
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.
Sourcepub fn with_default_enable_thinking(self, enable_thinking: Option<bool>) -> Self
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.
Sourcepub fn with_served_model_registry(self, registry: ServedModelRegistry) -> Self
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.
Sourcepub fn with_lora_adapters(
self,
base_model_id: impl Into<String>,
adapters: Vec<LoraAdapterModel>,
) -> Result<Self>
pub fn with_lora_adapters( self, base_model_id: impl Into<String>, adapters: Vec<LoraAdapterModel>, ) -> Result<Self>
Attach startup-loaded LoRA adapter model ids.