lm-studio-api-extended 0.1.3

Unofficial Rust client for LM Studio with text embedding support.
Documentation
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
use lm_studio_api_extended::{embedding::*, input::EmbeddingInput};

#[tokio::main]
async fn main() {
    let mut embedder = Embedder::new(None); // Uses default localhost:1234
    let req = EmbeddingRequest {
        model: EmbeddingModel::AllMiniLmL6,
        input: EmbeddingInput::from("Rust is magic."),
        encoding_format: Some("float".to_string()),
    };

    let res = embedder.embed(req).await.unwrap();
    println!("Embedding: {:?}", res);
    //println!("Length of embedding: {}", res.len());
}