sim_codec_chat/providers/
profile.rs1use sim_kernel::Symbol;
8
9#[derive(Clone, Copy, Debug, PartialEq, Eq)]
11pub enum RequestWire {
12 OpenAiResponses,
14 OpenAiChat,
16 AnthropicMessages,
18 OllamaChat,
20}
21
22#[derive(Clone, Copy, Debug, PartialEq, Eq)]
24pub enum StreamWire {
25 None,
27 Sse,
29 Ndjson,
31}
32
33#[derive(Clone, Debug, PartialEq, Eq)]
35pub struct CodecProfile {
36 pub codec: Symbol,
38 pub provider: Symbol,
40 pub request_wire: RequestWire,
42 pub stream_wire: StreamWire,
44}
45
46impl CodecProfile {
47 pub fn new(
49 codec: Symbol,
50 provider: Symbol,
51 request_wire: RequestWire,
52 stream_wire: StreamWire,
53 ) -> Self {
54 Self {
55 codec,
56 provider,
57 request_wire,
58 stream_wire,
59 }
60 }
61}
62
63pub fn openai_profile() -> CodecProfile {
65 CodecProfile::new(
66 Symbol::qualified("codec", "openai"),
67 Symbol::new("openai"),
68 RequestWire::OpenAiChat,
69 StreamWire::Sse,
70 )
71}
72
73pub fn anthropic_profile() -> CodecProfile {
75 CodecProfile::new(
76 Symbol::qualified("codec", "anthropic"),
77 Symbol::new("anthropic"),
78 RequestWire::AnthropicMessages,
79 StreamWire::Sse,
80 )
81}
82
83pub fn ollama_profile() -> CodecProfile {
85 CodecProfile::new(
86 Symbol::qualified("codec", "ollama"),
87 Symbol::new("ollama"),
88 RequestWire::OllamaChat,
89 StreamWire::Ndjson,
90 )
91}
92
93pub fn lm_studio_profile() -> CodecProfile {
95 CodecProfile::new(
96 Symbol::qualified("codec", "lm-studio"),
97 Symbol::new("lm-studio"),
98 RequestWire::OpenAiChat,
99 StreamWire::Sse,
100 )
101}
102
103pub fn lemonade_profile() -> CodecProfile {
105 CodecProfile::new(
106 Symbol::qualified("codec", "lemonade"),
107 Symbol::new("lemonade"),
108 RequestWire::OpenAiChat,
109 StreamWire::Sse,
110 )
111}