Skip to main content

llmrix_rust_sdk/model/
conversation.rs

1use serde::{Deserialize, Serialize};
2
3/// A Llmrix chat thread.
4#[derive(Debug, Clone, Deserialize, Default)]
5pub struct Conversation {
6    pub seq: String,
7    pub id: String,
8    pub title: String,
9    #[serde(default)]
10    pub agent_id: String,
11    pub created_at: String,
12    pub updated_at: String,
13}
14
15/// Request body for creating a conversation.
16#[derive(Debug, Serialize)]
17pub struct ConversationCreateRequest {
18    pub title: String,
19    #[serde(skip_serializing_if = "Option::is_none")]
20    pub agent_id: Option<String>,
21}
22
23/// Request body for updating a conversation.
24#[derive(Debug, Default, Serialize)]
25pub struct ConversationUpdateRequest {
26    #[serde(skip_serializing_if = "Option::is_none")]
27    pub title: Option<String>,
28}
29
30/// A single message within a conversation.
31#[derive(Debug, Clone, Deserialize, Default)]
32pub struct Message {
33    pub seq: i64,
34    pub id: String,
35    /// `"user"` | `"assistant"` | `"tool"` | `"system"`
36    pub role: String,
37    pub content: String,
38    #[serde(default)]
39    pub tool_calls: Vec<ToolCall>,
40}
41
42/// A tool invocation embedded in an assistant message.
43#[derive(Debug, Clone, Deserialize, Default)]
44pub struct ToolCall {
45    pub id: String,
46    pub name: String,
47    pub args: serde_json::Value,
48}
49
50/// Generic cursor-paginated list returned by list endpoints.
51#[derive(Debug, Clone, Deserialize)]
52pub struct PageResult<T> {
53    pub items: Vec<T>,
54    pub has_more: bool,
55}