use kernelx_core::prelude::*; #[test] fn test_chat_message_roles() { let system_msg = ChatMessage::new(Role::System, "System message"); let user_msg = ChatMessage::new(Role::User, "User message"); let assistant_msg = ChatMessage::new(Role::Assistant, "Assistant message"); assert!(matches!(system_msg.role(), &Role::System)); assert!(matches!(user_msg.role(), &Role::User)); assert!(matches!(assistant_msg.role(), &Role::Assistant)); } #[test] fn test_chat_message_content() { let msg = ChatMessage::new(Role::User, "Test message"); assert_eq!(msg.content(), "Test message"); assert!(!msg.content().is_empty()); } #[test] fn test_message_type_creation() { let system_msg = ChatMessage::system("System prompt"); let user_msg = ChatMessage::user("User message"); let assistant_msg = ChatMessage::assistant("Assistant message"); assert!(matches!(system_msg.role(), &Role::System)); assert!(matches!(user_msg.role(), &Role::User)); assert!(matches!(assistant_msg.role(), &Role::Assistant)); assert_eq!(system_msg.content(), "System prompt"); assert_eq!(user_msg.content(), "User message"); assert_eq!(assistant_msg.content(), "Assistant message"); } #[test] fn test_chat_message_conversion() { use kernelx_core::providers::IntoOpenAIChatMessage; let messages = vec![ ChatMessage::system("System prompt"), ChatMessage::user("User message"), ]; let openai_messages = messages.into_openai_messages().unwrap(); assert_eq!(openai_messages.len(), 2); }