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
use Pin;
use async_trait;
use Stream;
use crate::;
/// An async interface to a large language model.
///
/// Implementors wrap a specific provider (OpenAI, Anthropic, Ollama, …) and
/// translate a slice of [`Message`]s into a [`GenerateResult`]. The `rune-chain`
/// ecosystem builds all chains on top of this trait rather than depending on any
/// concrete LLM type.
///
/// # Example
///
/// ```rust,ignore
/// use rune_chain_core::{Llm, Message};
///
/// let messages = vec![
/// Message::system("You are a helpful assistant."),
/// Message::human("What is the capital of France?"),
/// ];
/// let result = llm.generate(&messages).await?;
/// println!("{}", result.generation);
/// ```