llmrix_rust_sdk/model/
chat.rs1use serde::{Deserialize, Serialize};
2
3#[derive(Debug, Default, Serialize)]
5pub struct ChatRequest {
6 pub message: String,
7 #[serde(skip_serializing_if = "Option::is_none")]
8 pub agent_id: Option<String>,
9 #[serde(skip_serializing_if = "Option::is_none")]
10 pub metadata: Option<serde_json::Value>,
11 #[serde(skip_serializing_if = "Vec::is_empty", default)]
12 pub hitl_decisions: Vec<HitlDecision>,
13}
14
15#[derive(Debug, Clone, Serialize, Deserialize)]
17pub struct HitlDecision {
18 pub decision: String,
20 #[serde(skip_serializing_if = "Option::is_none")]
21 pub reason: Option<String>,
22 #[serde(skip_serializing_if = "Option::is_none")]
23 pub modified_args: Option<serde_json::Value>,
24}
25
26impl HitlDecision {
27 pub fn approve() -> Self {
29 Self { decision: "approve".into(), reason: None, modified_args: None }
30 }
31
32 pub fn reject(reason: impl Into<String>) -> Self {
34 Self { decision: "reject".into(), reason: Some(reason.into()), modified_args: None }
35 }
36
37 pub fn modify(args: serde_json::Value) -> Self {
39 Self { decision: "modify".into(), reason: None, modified_args: Some(args) }
40 }
41}
42
43#[derive(Debug, Serialize)]
45pub(crate) struct HitlDecideRequest {
46 pub decisions: Vec<HitlDecision>,
47}