causa_protocol/
protocol.rs1use serde::{Deserialize, Serialize};
4
5#[derive(Debug, Clone, Copy, PartialEq, Eq, Hash, Serialize, Deserialize)]
10pub enum Protocol {
11 #[serde(rename = "openai_chat_completions")]
13 OpenAiChatCompletions,
14 #[serde(rename = "anthropic_messages")]
16 AnthropicMessages,
17 #[serde(rename = "openai_responses")]
19 OpenAiResponses,
20}
21
22impl Protocol {
23 pub fn as_str(self) -> &'static str {
25 match self {
26 Self::OpenAiChatCompletions => "openai_chat_completions",
27 Self::AnthropicMessages => "anthropic_messages",
28 Self::OpenAiResponses => "openai_responses",
29 }
30 }
31}
32
33impl std::fmt::Display for Protocol {
34 fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
35 f.write_str(self.as_str())
36 }
37}