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