1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
use ModelOptions;
use crateMessage;
use Client;
/// Sends a message to the LLM
///
/// # Arguments
/// * `data` - The data which will be sent to the API
/// * `url` - The URL for the API.
///
/// # Returns
/// A `Result` containing a `Message` on success, or a `reqwest::Error` on failure.
///
/// # Examples
/// ```rust
/// use simple_llama_rs::{
/// ModelMemory, ModelOptions, DEFAULT_URL, chat::MessageMethods, send_message
/// };
///
/// #[tokio::main]
/// async fn main() -> Result<(), Box<dyn std::error::Error>> {
/// let mut messages: ModelMemory = Vec::new();
///
/// // Create model options
/// let model_data = ModelOptions {
/// messages,
/// temperature: 0.7,
/// top_p: 1.0,
/// top_k: 1,
/// model: "llama3.1".to_string(),
/// stream: false,
/// };
///
/// // Send message to the model
/// let response = send_message(&model_data, DEFAULT_URL).await?;
///
/// // Get the content from the response
/// let content = response.get_llm_content();
/// println!("Model response: {}", content);
///
/// Ok(())
/// }
/// ```
pub async