1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
/*
* OpenAI API
*
* The OpenAI REST API. Please see https://platform.openai.com/docs/api-reference for more details.
*
* The version of the OpenAPI document: 2.3.0
*
* Generated by: https://openapi-generator.tech
*/
use crate::models;
use serde::{Deserialize, Serialize};
/// LiveSessionCreateParams : Initial configuration for a Live session, including its model, conversation instructions, audio, and delegated task handling.
#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, bon::Builder)]
pub struct LiveSessionCreateParams {
#[serde(rename = "model")]
pub model: Box<models::ModelIdsLive>,
/// Frontend instructions for voice, conversation, interruptions, and when to delegate. Start with the [Live prompting guide](https://developers.openai.com/api/docs/guides/live-prompting); put business rules and tool workflows in a separate [backend prompt](https://developers.openai.com/api/docs/guides/live-delegation#start-with-your-existing-backend-prompt). Limited to 16,384 client-supplied tokens. Omitted or blank instructions use server defaults. Immutable after startup.
#[serde(
rename = "instructions",
default,
with = "::serde_with::rust::double_option",
skip_serializing_if = "Option::is_none"
)]
pub instructions: Option<Option<String>>,
/// Ordered text-only history supplied before startup. Supports developer, user, and assistant messages with one text part each; at most 128 messages and a configured rendered-token limit (8,192 by default).
#[serde(rename = "input", skip_serializing_if = "Option::is_none")]
pub input: Option<Vec<models::LiveInitialItem>>,
#[serde(rename = "audio", skip_serializing_if = "Option::is_none")]
pub audio: Option<Box<models::LiveInitialSessionAudioParam>>,
#[serde(
rename = "delegation",
default,
with = "::serde_with::rust::double_option",
skip_serializing_if = "Option::is_none"
)]
pub delegation: Option<Option<Box<models::LiveSessionCreateParamsDelegation>>>,
/// At most one Decisions trigger per transcript event type. Triggers run independently of delegation. On update, omit triggers to keep the current configuration, send a list to replace it, or send an empty list to disable triggers.
#[serde(rename = "triggers", skip_serializing_if = "Option::is_none")]
pub triggers: Option<Vec<models::LiveDecisionTriggerInputParam2>>,
/// Whether to store the session for later forking and recording download. Defaults to false for new sessions.
#[serde(rename = "store", skip_serializing_if = "Option::is_none")]
pub store: Option<bool>,
#[serde(rename = "client", skip_serializing_if = "Option::is_none")]
pub client: Option<Box<models::LiveClientConfigParam>>,
}
impl LiveSessionCreateParams {
/// Initial configuration for a Live session, including its model, conversation instructions, audio, and delegated task handling.
pub fn new(model: models::ModelIdsLive) -> LiveSessionCreateParams {
LiveSessionCreateParams {
model: Box::new(model),
instructions: None,
input: None,
audio: None,
delegation: None,
triggers: None,
store: None,
client: None,
}
}
}
impl std::fmt::Display for LiveSessionCreateParams {
fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
match serde_json::to_string(self) {
Ok(s) => write!(f, "{}", s),
Err(_) => Err(std::fmt::Error),
}
}
}