sim_lib_openai_server/codec_openai/
shapes.rs1use sim_codec_chat::validate_chat_transcript;
2use sim_kernel::{Expr, Result};
3
4#[derive(Clone, Debug, PartialEq)]
6pub struct ChatTranscript {
7 expr: Expr,
8}
9
10impl ChatTranscript {
11 pub fn new(expr: Expr) -> Result<Self> {
13 validate_chat_transcript(&expr)?;
14 Ok(Self { expr })
15 }
16
17 pub fn expr(&self) -> &Expr {
19 &self.expr
20 }
21
22 pub fn into_expr(self) -> Expr {
24 self.expr
25 }
26}
27
28#[derive(Clone, Debug, PartialEq, Eq)]
30pub struct OpenAiCodecOptions {
31 pub model: String,
33 pub stream: bool,
35 pub tools: bool,
37}
38
39impl OpenAiCodecOptions {
40 pub fn new(model: impl Into<String>, stream: bool, tools: bool) -> Self {
42 Self {
43 model: model.into(),
44 stream,
45 tools,
46 }
47 }
48}
49
50pub type OpenAiRequestOptions = OpenAiCodecOptions;