simple_llama_rs 1.0.7

Rust crate for the Ollama API.
Documentation
1
2
3
4
5
6
7
8
9
10
11
12
13
use crate::models::options::ModelOptions;
use bytes::Bytes;
use reqwest::Client;

pub async fn send_message_stream(
    data: &ModelOptions,
    url: &str,
) -> Result<impl tokio_stream::Stream<Item = Result<Bytes, reqwest::Error>>, reqwest::Error> {
    let client = Client::new();

    let resp = client.post(url).json(&data).send().await?;
    Ok(resp.bytes_stream())
}