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