unai 0.0.1

Common AI abstractions
Documentation
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>>,
}