3 unstable releases

0.2.1 Feb 28, 2024
0.2.0 Feb 18, 2024
0.1.0 Dec 16, 2023

#858 in Machine learning

Download history 117/week @ 2024-02-14 48/week @ 2024-02-21 205/week @ 2024-02-28 30/week @ 2024-03-06 23/week @ 2024-03-13 11/week @ 2024-03-20 37/week @ 2024-03-27 61/week @ 2024-04-03 1/week @ 2024-04-10 10/week @ 2024-04-24

85 downloads per month
Used in 7 crates (6 directly)

MIT/Apache

225KB
6K SLoC

Language Model

This crate provides a unified interface for language models. It supports streaming text, sampling, and embedding.

Usage (with the RPhi implementation crate)

use rphi::prelude::*;

#[tokio::main]
async fn main() {
    let mut model = Phi::default();
    let prompt = "The capital of France is ";
    let mut result = model.stream_text(prompt).await.unwrap();

    print!("{prompt}");
    while let Some(token) = result.next().await {
        print!("{token}");
    }
}

Dependencies

~29–45MB
~835K SLoC