forked from Txio-labs/txio-backend
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathai.rs
More file actions
33 lines (29 loc) · 822 Bytes
/
Copy pathai.rs
File metadata and controls
33 lines (29 loc) · 822 Bytes
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
use serde::{Deserialize, Serialize};
use serde_json::Value;
use validator::Validate;
#[derive(Debug, Clone, Deserialize, Serialize)]
#[serde(rename_all = "camelCase")]
pub struct AiChatMessage {
pub role: String,
pub text: String,
}
#[derive(Debug, Deserialize, Validate)]
#[serde(rename_all = "camelCase")]
pub struct AiChatRequest {
#[validate(length(min = 1))]
pub messages: Vec<AiChatMessage>,
}
#[derive(Debug, Clone, Deserialize, Serialize)]
#[serde(rename_all = "camelCase")]
pub struct AiToolCall {
pub name: String,
pub args: Value,
}
#[derive(Debug, Clone, Deserialize, Serialize)]
#[serde(rename_all = "camelCase")]
pub struct AiChatResponse {
pub role: String,
pub text: String,
#[serde(skip_serializing_if = "Option::is_none")]
pub tool_call: Option<AiToolCall>,
}