Skip to main content

Crate litert_lm

Crate litert_lm 

Source
Expand description

LiteRT-LM: A Rust library for LiteRT-LM model inference

This library provides:

  • Model download and management
  • Process pool management for efficient inference
  • Streaming completions
  • MCP (Model Context Protocol) service
  • OpenAI-compatible API server

§Example

use litert_lm::{LitManager, Result};

#[tokio::main]
async fn main() -> Result<()> {
    let manager = LitManager::new().await?;

    // Pull a model
    manager.pull("gemma-3n-E4B", None, None).await?;

    // Run completion
    let response = manager.run_completion("gemma-3n-E4B", "Hello!").await?;
    println!("{}", response);

    Ok(())
}

Re-exports§

pub use manager::LitManager;
pub use mcp::LiteRtMcpService;
pub use process::LitProcess;
pub use process::ProcessPool;
pub use server::AppState;
pub use server::ChatCompletionRequest;
pub use server::create_router;

Modules§

binary
manager
mcp
process
server

Type Aliases§

Result