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
use super::content::Content;
#[derive(Debug, Clone)]
pub enum FinishReason {
/// The generation completed successfully
Stop,
/// The generation was cut off due to reaching the maximum token length
MaxTokens,
/// The generation was stopped due to a content filter
ContentFilter,
/// The generation was stopped to make tool calls
ToolCalls,
/// The generation was stopped for another reason
Other,
}
#[derive(Debug, Clone)]
pub struct Usage {
/// The number of tokens in the prompt
pub prompt_tokens: Option<u32>,
/// The number of tokens in the output
pub output_tokens: Option<u32>,
/// The total number of tokens used
pub total_tokens: Option<u32>,
}
#[derive(Debug, Clone)]
pub struct Completion {
/// The generated content
pub content: Vec<Content>,
/// The reason the generation finished
pub finish_reason: FinishReason,
/// Usage information about the generation
pub usage: Usage,
/// Additional metadata about the generation
pub metadata: Option<serde_json::Map<String, serde_json::Value>>,
}