hippox 0.5.6

🦛A reliable, autonomous LLM runtime and skill orchestration engine, Capable of processing natural language and automatically executing OS-native atomic skills, fundamentally enabling the LLM to truly take over the computer.
//! Intent parser types
//!
//! This module defines the data structures for parsing user intent.

use serde::{Deserialize, Serialize};

/// Result from intent parser LLM call
#[derive(Debug, Clone, Serialize, Deserialize)]
pub struct IntentParseResult {
    /// Clean user intent without any formatting instructions
    pub clean_intent: String,
    /// Skill categories needed to fulfill the request
    pub skill_categories: Vec<String>,
}

impl IntentParseResult {
    /// Create an empty result (for fallback when parsing fails)
    pub fn empty() -> Self {
        Self {
            clean_intent: String::new(),
            skill_categories: Vec::new(),
        }
    }

    /// Create a fallback result using original input
    pub fn fallback(original_input: &str) -> Self {
        Self {
            clean_intent: original_input.to_string(),
            skill_categories: Vec::new(),
        }
    }

    /// Check if the result is valid (has non-empty clean_intent)
    pub fn is_valid(&self) -> bool {
        !self.clean_intent.is_empty()
    }
}

#[cfg(test)]
mod tests {
    use super::*;

    #[test]
    fn test_intent_parse_result_empty() {
        let result = IntentParseResult::empty();
        assert!(result.clean_intent.is_empty());
        assert!(result.skill_categories.is_empty());
        assert!(!result.is_valid());
    }
}