use sim_kernel::Symbol;
#[derive(Clone, Copy, Debug, PartialEq, Eq)]
pub enum RequestWire {
OpenAiResponses,
OpenAiChat,
AnthropicMessages,
OllamaChat,
}
#[derive(Clone, Copy, Debug, PartialEq, Eq)]
pub enum StreamWire {
None,
Sse,
Ndjson,
}
#[derive(Clone, Debug, PartialEq, Eq)]
pub struct CodecProfile {
pub codec: Symbol,
pub provider: Symbol,
pub request_wire: RequestWire,
pub stream_wire: StreamWire,
}
impl CodecProfile {
pub fn new(
codec: Symbol,
provider: Symbol,
request_wire: RequestWire,
stream_wire: StreamWire,
) -> Self {
Self {
codec,
provider,
request_wire,
stream_wire,
}
}
}
pub fn openai_profile() -> CodecProfile {
CodecProfile::new(
Symbol::qualified("codec", "openai"),
Symbol::new("openai"),
RequestWire::OpenAiChat,
StreamWire::Sse,
)
}
pub fn anthropic_profile() -> CodecProfile {
CodecProfile::new(
Symbol::qualified("codec", "anthropic"),
Symbol::new("anthropic"),
RequestWire::AnthropicMessages,
StreamWire::Sse,
)
}
pub fn ollama_profile() -> CodecProfile {
CodecProfile::new(
Symbol::qualified("codec", "ollama"),
Symbol::new("ollama"),
RequestWire::OllamaChat,
StreamWire::Ndjson,
)
}
pub fn lm_studio_profile() -> CodecProfile {
CodecProfile::new(
Symbol::qualified("codec", "lm-studio"),
Symbol::new("lm-studio"),
RequestWire::OpenAiChat,
StreamWire::Sse,
)
}
pub fn lemonade_profile() -> CodecProfile {
CodecProfile::new(
Symbol::qualified("codec", "lemonade"),
Symbol::new("lemonade"),
RequestWire::OpenAiChat,
StreamWire::Sse,
)
}