use crate::prompts::chat::ChatPromptClient;
use crate::prompts::text::TextPromptClient;
#[derive(Debug, Clone)]
pub enum Prompt {
Text(TextPromptClient),
Chat(ChatPromptClient),
}
impl Prompt {
pub fn is_text(&self) -> bool {
matches!(self, Self::Text(_))
}
pub fn is_chat(&self) -> bool {
matches!(self, Self::Chat(_))
}
pub fn as_text(&self) -> Option<&TextPromptClient> {
match self {
Self::Text(t) => Some(t),
Self::Chat(_) => None,
}
}
pub fn as_chat(&self) -> Option<&ChatPromptClient> {
match self {
Self::Text(_) => None,
Self::Chat(c) => Some(c),
}
}
pub fn name(&self) -> &str {
match self {
Self::Text(t) => &t.name,
Self::Chat(c) => &c.name,
}
}
pub fn version(&self) -> i32 {
match self {
Self::Text(t) => t.version,
Self::Chat(c) => c.version,
}
}
pub fn is_fallback(&self) -> bool {
match self {
Self::Text(t) => t.is_fallback,
Self::Chat(c) => c.is_fallback,
}
}
}