sim_codec_chat/providers/
openai.rs1mod common;
8mod decode;
9mod encode;
10mod runtime;
11
12pub use decode::{decode_openai_request, decode_openai_response, decode_openai_stream};
13pub use encode::{encode_openai_request, encode_openai_response};
14pub use runtime::{OpenAiCodec, OpenAiCodecLib};
15
16use sim_kernel::{CodecId, Symbol};
17
18pub(super) const OPENAI_CODEC_ID: CodecId = CodecId(0);
19
20#[derive(Clone, Debug, PartialEq, Eq)]
22pub struct OpenAiCodecOptions {
23 pub model: String,
25 pub stream: bool,
27 pub tools: bool,
29}
30
31impl OpenAiCodecOptions {
32 pub fn new(model: impl Into<String>, stream: bool, tools: bool) -> Self {
34 Self {
35 model: model.into(),
36 stream,
37 tools,
38 }
39 }
40}
41
42pub type OpenAiRequestOptions = OpenAiCodecOptions;
44
45pub fn openai_codec_symbol() -> Symbol {
47 Symbol::qualified("codec", "openai")
48}