Skip to main content

Crate litert_lm

Crate litert_lm 

Source
Expand description

§LiteRT-LM Rust Bindings

Safe, idiomatic Rust wrapper for the LiteRT-LM C API.

§Features

  • Safe API: Memory-safe wrappers around C FFI
  • Automatic cleanup: RAII-based resource management
  • Thread-safe: Proper Send/Sync implementations
  • Error handling: Result-based error handling

§Example

use litert_lm::{Engine, Backend};

fn main() -> Result<(), Box<dyn std::error::Error>> {
    // Create engine
    let engine = Engine::new("model.tflite", Backend::Cpu)?;

    // Create session
    let session = engine.create_session()?;

    // Generate text
    let response = session.generate("Hello, how are you?")?;
    println!("Response: {}", response);

    Ok(())
}

Structs§

BenchmarkInfo
Benchmark information for a session
Engine
LiteRT-LM Engine - the main entry point for loading models
Error
Error type for LiteRT-LM operations
Session
LiteRT-LM Session - represents a conversation context

Enums§

Backend
Backend type for model execution

Type Aliases§

Result
Result type for LiteRT-LM operations