watsonx_rs/orchestrate/
types.rs

1//! WatsonX Orchestrate types and data structures
2//!
3//! This module contains types specific to WatsonX Orchestrate functionality,
4//! including custom assistants, agents, tools, skills, and document management.
5
6use serde::{Deserialize, Serialize};
7use std::collections::HashMap;
8use std::time::{Duration, SystemTime};
9
10// Re-export config from parent module
11pub use super::config::OrchestrateConfig;
12
13/// Simple Agent information (matches Watson Orchestrate API response)
14#[derive(Clone, Debug, Serialize, Deserialize)]
15pub struct Agent {
16    /// Agent ID from API (field name: "id")
17    #[serde(rename = "id")]
18    pub agent_id: String,
19    /// Agent display name from API (field name: "display_name")
20    #[serde(rename = "display_name")]
21    pub name: String,
22}
23
24/// Custom Assistant information
25#[derive(Clone, Debug, Serialize, Deserialize)]
26pub struct CustomAssistant {
27    /// Assistant ID
28    pub id: String,
29    /// Assistant name
30    pub name: String,
31    /// Assistant description
32    pub description: Option<String>,
33    /// Assistant status
34    pub status: AssistantStatus,
35    /// Created timestamp
36    pub created_at: Option<SystemTime>,
37    /// Updated timestamp
38    pub updated_at: Option<SystemTime>,
39    /// Configuration settings
40    pub config: AssistantConfig,
41    /// Associated skills
42    pub skills: Vec<Skill>,
43    /// Associated tools
44    pub tools: Vec<Tool>,
45}
46
47/// Assistant status enumeration
48#[derive(Clone, Debug, Serialize, Deserialize)]
49pub enum AssistantStatus {
50    /// Assistant is active and ready
51    Active,
52    /// Assistant is inactive
53    Inactive,
54    /// Assistant is being trained
55    Training,
56    /// Assistant has errors
57    Error,
58    /// Assistant is being deployed
59    Deploying,
60}
61
62/// Assistant configuration
63#[derive(Clone, Debug, Serialize, Deserialize)]
64pub struct AssistantConfig {
65    /// Model ID to use
66    pub model_id: String,
67    /// System prompt
68    pub system_prompt: Option<String>,
69    /// Maximum tokens
70    pub max_tokens: u32,
71    /// Temperature setting
72    pub temperature: f32,
73    /// Top-p setting
74    pub top_p: f32,
75    /// Whether to enable streaming
76    pub enable_streaming: bool,
77    /// Custom parameters
78    pub custom_params: HashMap<String, serde_json::Value>,
79}
80
81impl Default for AssistantConfig {
82    fn default() -> Self {
83        Self {
84            model_id: "ibm/granite-3.0-8b-instruct".to_string(),
85            system_prompt: None,
86            max_tokens: 2048,
87            temperature: 0.7,
88            top_p: 0.9,
89            enable_streaming: true,
90            custom_params: HashMap::new(),
91        }
92    }
93}
94
95/// Skill definition for assistants
96#[derive(Clone, Debug, Serialize, Deserialize)]
97pub struct Skill {
98    /// Skill ID
99    pub id: String,
100    /// Skill name
101    pub name: String,
102    /// Skill description
103    pub description: Option<String>,
104    /// Skill type
105    pub skill_type: SkillType,
106    /// Skill configuration
107    pub config: SkillConfig,
108    /// Whether skill is enabled
109    pub enabled: bool,
110    /// Skill version
111    pub version: Option<String>,
112}
113
114/// Skill type enumeration
115#[derive(Clone, Debug, Serialize, Deserialize)]
116pub enum SkillType {
117    /// Text processing skill
118    TextProcessing,
119    /// Code generation skill
120    CodeGeneration,
121    /// Data analysis skill
122    DataAnalysis,
123    /// Document processing skill
124    DocumentProcessing,
125    /// Custom skill
126    Custom(String),
127}
128
129/// Skill configuration
130#[derive(Clone, Debug, Serialize, Deserialize)]
131pub struct SkillConfig {
132    /// Input parameters
133    pub input_params: HashMap<String, ParameterDefinition>,
134    /// Output parameters
135    pub output_params: HashMap<String, ParameterDefinition>,
136    /// Execution timeout
137    pub timeout: Duration,
138    /// Retry configuration
139    pub retry_config: Option<OrchestrateRetryConfig>,
140    /// Custom settings
141    pub custom_settings: HashMap<String, serde_json::Value>,
142}
143
144/// Parameter definition for skills
145#[derive(Clone, Debug, Serialize, Deserialize)]
146pub struct ParameterDefinition {
147    /// Parameter name
148    pub name: String,
149    /// Parameter type
150    pub param_type: ParameterType,
151    /// Whether parameter is required
152    pub required: bool,
153    /// Default value
154    pub default_value: Option<serde_json::Value>,
155    /// Parameter description
156    pub description: Option<String>,
157    /// Validation rules
158    pub validation: Option<ValidationRules>,
159}
160
161/// Parameter type enumeration
162#[derive(Clone, Debug, Serialize, Deserialize)]
163pub enum ParameterType {
164    /// String parameter
165    String,
166    /// Integer parameter
167    Integer,
168    /// Float parameter
169    Float,
170    /// Boolean parameter
171    Boolean,
172    /// Array parameter
173    Array,
174    /// Object parameter
175    Object,
176    /// File parameter
177    File,
178}
179
180/// Validation rules for parameters
181#[derive(Clone, Debug, Serialize, Deserialize)]
182pub struct ValidationRules {
183    /// Minimum value (for numeric types)
184    pub min_value: Option<f64>,
185    /// Maximum value (for numeric types)
186    pub max_value: Option<f64>,
187    /// Minimum length (for string types)
188    pub min_length: Option<usize>,
189    /// Maximum length (for string types)
190    pub max_length: Option<usize>,
191    /// Allowed values
192    pub allowed_values: Option<Vec<serde_json::Value>>,
193    /// Regex pattern (for string types)
194    pub pattern: Option<String>,
195}
196
197/// Tool definition for assistants
198#[derive(Clone, Debug, Serialize, Deserialize)]
199pub struct Tool {
200    /// Tool ID
201    pub id: String,
202    /// Tool name
203    pub name: String,
204    /// Tool description
205    pub description: Option<String>,
206    /// Tool type (optional - may not be in all API responses)
207    #[serde(default)]
208    pub tool_type: Option<ToolType>,
209    /// Tool configuration (optional - may not be in all API responses)
210    #[serde(default)]
211    pub config: Option<ToolConfig>,
212    /// Whether tool is enabled
213    #[serde(default)]
214    pub enabled: bool,
215    /// Tool version
216    pub version: Option<String>,
217}
218
219/// Tool type enumeration
220#[derive(Clone, Debug, Serialize, Deserialize)]
221pub enum ToolType {
222    /// API tool
223    Api,
224    /// Database tool
225    Database,
226    /// File system tool
227    FileSystem,
228    /// Web scraping tool
229    WebScraping,
230    /// Custom tool
231    Custom(String),
232}
233
234/// Tool configuration
235#[derive(Clone, Debug, Serialize, Deserialize)]
236pub struct ToolConfig {
237    /// Tool endpoint URL
238    pub endpoint: Option<String>,
239    /// Authentication configuration
240    pub auth: Option<AuthConfig>,
241    /// Request headers
242    pub headers: HashMap<String, String>,
243    /// Request timeout
244    pub timeout: Duration,
245    /// Retry configuration
246    pub retry_config: Option<OrchestrateRetryConfig>,
247    /// Custom settings
248    pub custom_settings: HashMap<String, serde_json::Value>,
249}
250
251/// Authentication configuration for tools
252#[derive(Clone, Debug, Serialize, Deserialize)]
253pub struct AuthConfig {
254    /// Authentication type
255    pub auth_type: AuthType,
256    /// Authentication credentials
257    pub credentials: HashMap<String, String>,
258}
259
260/// Authentication type enumeration
261#[derive(Clone, Debug, Serialize, Deserialize)]
262pub enum AuthType {
263    /// API key authentication
264    ApiKey,
265    /// Bearer token authentication
266    Bearer,
267    /// Basic authentication
268    Basic,
269    /// OAuth authentication
270    OAuth,
271    /// No authentication
272    None,
273}
274
275/// Document collection for knowledge base
276#[derive(Clone, Debug, Serialize, Deserialize)]
277pub struct DocumentCollection {
278    /// Collection ID
279    pub id: String,
280    /// Collection name
281    pub name: String,
282    /// Collection description
283    pub description: Option<String>,
284    /// Collection status
285    pub status: CollectionStatus,
286    /// Created timestamp
287    pub created_at: Option<SystemTime>,
288    /// Updated timestamp
289    pub updated_at: Option<SystemTime>,
290    /// Document count
291    pub document_count: u32,
292    /// Vector index configuration
293    pub vector_index: Option<VectorIndexConfig>,
294}
295
296/// Collection status enumeration
297#[derive(Clone, Debug, Serialize, Deserialize)]
298pub enum CollectionStatus {
299    /// Collection is active
300    Active,
301    /// Collection is inactive
302    Inactive,
303    /// Collection is being processed
304    Processing,
305    /// Collection has errors
306    Error,
307}
308
309/// Vector index configuration
310#[derive(Clone, Debug, Serialize, Deserialize)]
311pub struct VectorIndexConfig {
312    /// Index ID
313    pub id: String,
314    /// Embedding model
315    pub embedding_model: String,
316    /// Vector dimensions
317    pub dimensions: u32,
318    /// Index type
319    pub index_type: IndexType,
320    /// Similarity metric
321    pub similarity_metric: SimilarityMetric,
322}
323
324/// Index type enumeration
325#[derive(Clone, Debug, Serialize, Deserialize)]
326pub enum IndexType {
327    /// HNSW index
328    Hnsw,
329    /// IVF index
330    Ivf,
331    /// Flat index
332    Flat,
333}
334
335/// Similarity metric enumeration
336#[derive(Clone, Debug, Serialize, Deserialize)]
337pub enum SimilarityMetric {
338    /// Cosine similarity
339    Cosine,
340    /// Euclidean distance
341    Euclidean,
342    /// Inner product
343    InnerProduct,
344}
345
346/// Document in a collection
347#[derive(Clone, Debug, Serialize, Deserialize)]
348pub struct Document {
349    /// Document ID
350    pub id: String,
351    /// Document title
352    pub title: String,
353    /// Document content
354    pub content: String,
355    /// Document metadata
356    pub metadata: HashMap<String, serde_json::Value>,
357    /// Document type
358    pub document_type: DocumentType,
359    /// Created timestamp
360    pub created_at: Option<SystemTime>,
361    /// Updated timestamp
362    pub updated_at: Option<SystemTime>,
363    /// Vector embedding (if available)
364    pub embedding: Option<Vec<f32>>,
365}
366
367/// Document type enumeration
368#[derive(Clone, Debug, Serialize, Deserialize, PartialEq)]
369pub enum DocumentType {
370    /// Text document
371    Text,
372    /// PDF document
373    Pdf,
374    /// Markdown document
375    Markdown,
376    /// HTML document
377    Html,
378    /// JSON document
379    Json,
380    /// CSV document
381    Csv,
382}
383
384/// Simple message structure for Watson Orchestrate API
385#[derive(Clone, Debug, Serialize, Deserialize)]
386pub struct Message {
387    pub role: String,
388    pub content: String,
389}
390
391/// Message payload for Watson Orchestrate API
392#[derive(Clone, Debug, Serialize, Deserialize)]
393pub struct MessagePayload {
394    pub message: Message,
395    #[serde(skip_serializing_if = "HashMap::is_empty")]
396    pub additional_properties: HashMap<String, serde_json::Value>,
397    #[serde(skip_serializing_if = "HashMap::is_empty")]
398    pub context: HashMap<String, serde_json::Value>,
399    pub agent_id: String,
400    #[serde(skip_serializing_if = "Option::is_none")]
401    pub thread_id: Option<String>,
402}
403
404/// Thread information for conversation management
405#[derive(Clone, Debug, Serialize, Deserialize)]
406pub struct ThreadInfo {
407    /// Thread ID
408    pub thread_id: String,
409    /// Agent ID associated with the thread
410    pub agent_id: Option<String>,
411    /// Thread title or summary
412    pub title: Option<String>,
413    /// Created timestamp
414    pub created_at: Option<String>,
415    /// Updated timestamp
416    pub updated_at: Option<String>,
417    /// Message count
418    pub message_count: Option<u32>,
419}
420
421/// Chat message for assistant conversations
422#[derive(Clone, Debug, Serialize, Deserialize)]
423pub struct ChatMessage {
424    /// Message ID
425    pub id: String,
426    /// Message role
427    pub role: MessageRole,
428    /// Message content
429    pub content: String,
430    /// Message timestamp
431    pub timestamp: SystemTime,
432    /// Message metadata
433    pub metadata: HashMap<String, serde_json::Value>,
434}
435
436/// Message role enumeration
437#[derive(Clone, Debug, Serialize, Deserialize)]
438pub enum MessageRole {
439    /// System message
440    System,
441    /// User message
442    User,
443    /// Assistant message
444    Assistant,
445    /// Tool message
446    Tool,
447}
448
449/// Chat session for assistant conversations
450#[derive(Clone, Debug, Serialize, Deserialize)]
451pub struct ChatSession {
452    /// Session ID
453    pub id: String,
454    /// Assistant ID
455    pub assistant_id: String,
456    /// Session messages
457    pub messages: Vec<ChatMessage>,
458    /// Session metadata
459    pub metadata: HashMap<String, serde_json::Value>,
460    /// Created timestamp
461    pub created_at: SystemTime,
462    /// Updated timestamp
463    pub updated_at: SystemTime,
464}
465
466/// Request to create a custom assistant
467#[derive(Clone, Debug, Serialize)]
468pub struct CreateAssistantRequest {
469    /// Assistant name
470    pub name: String,
471    /// Assistant description
472    pub description: Option<String>,
473    /// Assistant configuration
474    pub config: AssistantConfig,
475    /// Initial skills
476    pub skills: Option<Vec<String>>,
477    /// Initial tools
478    pub tools: Option<Vec<String>>,
479}
480
481/// Request to update a custom assistant
482#[derive(Clone, Debug, Serialize)]
483pub struct UpdateAssistantRequest {
484    /// Assistant name
485    pub name: Option<String>,
486    /// Assistant description
487    pub description: Option<String>,
488    /// Assistant configuration
489    pub config: Option<AssistantConfig>,
490    /// Skills to add
491    pub add_skills: Option<Vec<String>>,
492    /// Skills to remove
493    pub remove_skills: Option<Vec<String>>,
494    /// Tools to add
495    pub add_tools: Option<Vec<String>>,
496    /// Tools to remove
497    pub remove_tools: Option<Vec<String>>,
498}
499
500/// Request to send a chat message
501#[derive(Clone, Debug, Serialize)]
502pub struct ChatRequest {
503    /// Message content
504    pub message: String,
505    /// Session ID (optional, creates new session if not provided)
506    pub session_id: Option<String>,
507    /// Message metadata
508    pub metadata: Option<HashMap<String, serde_json::Value>>,
509    /// Whether to enable streaming
510    pub stream: bool,
511}
512
513/// Response from chat request
514#[derive(Clone, Debug, Serialize, Deserialize)]
515pub struct ChatResponse {
516    /// Response message
517    pub message: String,
518    /// Session ID
519    pub session_id: String,
520    /// Message ID
521    pub message_id: String,
522    /// Response metadata
523    pub metadata: HashMap<String, serde_json::Value>,
524    /// Tool calls (if any)
525    pub tool_calls: Option<Vec<ToolCall>>,
526}
527
528/// Tool call information
529#[derive(Clone, Debug, Serialize, Deserialize)]
530pub struct ToolCall {
531    /// Tool call ID
532    pub id: String,
533    /// Tool name
534    pub tool_name: String,
535    /// Tool parameters
536    pub parameters: HashMap<String, serde_json::Value>,
537    /// Tool result (if available)
538    pub result: Option<serde_json::Value>,
539}
540
541/// Request to create a document collection
542#[derive(Clone, Debug, Serialize)]
543pub struct CreateCollectionRequest {
544    /// Collection name
545    pub name: String,
546    /// Collection description
547    pub description: Option<String>,
548    /// Vector index configuration
549    pub vector_index: Option<VectorIndexConfig>,
550}
551
552/// Request to add documents to a collection
553#[derive(Clone, Debug, Serialize)]
554pub struct AddDocumentsRequest {
555    /// Documents to add
556    pub documents: Vec<Document>,
557    /// Whether to process documents asynchronously
558    pub async_processing: bool,
559}
560
561/// Search request for document collections
562#[derive(Clone, Debug, Serialize)]
563pub struct SearchRequest {
564    /// Search query
565    pub query: String,
566    /// Number of results to return
567    pub limit: Option<u32>,
568    /// Similarity threshold
569    pub threshold: Option<f32>,
570    /// Search metadata filters
571    pub filters: Option<HashMap<String, serde_json::Value>>,
572}
573
574/// Search result from document collection
575#[derive(Clone, Debug, Serialize, Deserialize)]
576pub struct SearchResult {
577    /// Document ID
578    pub document_id: String,
579    /// Document title
580    pub title: String,
581    /// Document content snippet
582    pub content_snippet: String,
583    /// Similarity score
584    pub similarity_score: f32,
585    /// Document metadata
586    pub metadata: HashMap<String, serde_json::Value>,
587}
588
589/// Search response from document collection
590#[derive(Clone, Debug, Serialize, Deserialize)]
591pub struct SearchResponse {
592    /// Search results
593    pub results: Vec<SearchResult>,
594    /// Total number of results
595    pub total_results: u32,
596    /// Search metadata
597    pub metadata: HashMap<String, serde_json::Value>,
598}
599
600/// Retry configuration for Orchestrate operations
601#[derive(Clone, Debug, Serialize, Deserialize)]
602pub struct OrchestrateRetryConfig {
603    /// Maximum number of retry attempts
604    pub max_attempts: u32,
605    /// Base delay between retries
606    pub base_delay: Duration,
607    /// Maximum delay between retries
608    pub max_delay: Duration,
609    /// Exponential backoff multiplier
610    pub backoff_multiplier: f32,
611    /// Retry on specific error types
612    pub retry_on_errors: Vec<String>,
613}
614
615impl Default for OrchestrateRetryConfig {
616    fn default() -> Self {
617        Self {
618            max_attempts: 3,
619            base_delay: Duration::from_secs(1),
620            max_delay: Duration::from_secs(30),
621            backoff_multiplier: 2.0,
622            retry_on_errors: vec!["timeout".to_string(), "network_error".to_string()],
623        }
624    }
625}
626
627/// Run information for tracking agent execution
628#[derive(Clone, Debug, Serialize, Deserialize)]
629pub struct RunInfo {
630    /// Run ID
631    pub run_id: String,
632    /// Associated thread ID
633    pub thread_id: String,
634    /// Associated agent ID
635    pub agent_id: Option<String>,
636    /// Run status
637    pub status: RunStatus,
638    /// Run start time
639    pub created_at: Option<String>,
640    /// Run completion time
641    pub completed_at: Option<String>,
642    /// Run metadata
643    pub metadata: HashMap<String, serde_json::Value>,
644}
645
646/// Run status enumeration
647#[derive(Clone, Debug, Serialize, Deserialize, PartialEq)]
648pub enum RunStatus {
649    /// Run is queued
650    #[serde(rename = "queued")]
651    Queued,
652    /// Run is in progress
653    #[serde(rename = "in_progress")]
654    InProgress,
655    /// Run completed successfully
656    #[serde(rename = "completed")]
657    Completed,
658    /// Run failed
659    #[serde(rename = "failed")]
660    Failed,
661    /// Run was cancelled
662    #[serde(rename = "cancelled")]
663    Cancelled,
664}
665
666/// Tool execution request
667#[derive(Clone, Debug, Serialize)]
668pub struct ToolExecutionRequest {
669    /// Tool ID
670    pub tool_id: String,
671    /// Tool parameters
672    pub parameters: HashMap<String, serde_json::Value>,
673    /// Execution context
674    pub context: Option<HashMap<String, serde_json::Value>>,
675}
676
677/// Tool execution result
678#[derive(Clone, Debug, Serialize, Deserialize)]
679pub struct ToolExecutionResult {
680    /// Tool ID
681    pub tool_id: String,
682    /// Execution status
683    pub status: String,
684    /// Result data
685    pub result: serde_json::Value,
686    /// Execution time in milliseconds
687    pub execution_time_ms: Option<u64>,
688    /// Error message (if failed)
689    pub error: Option<String>,
690}
691
692/// Tool update request
693#[derive(Clone, Debug, Serialize)]
694pub struct ToolUpdateRequest {
695    /// Tool name
696    pub name: Option<String>,
697    /// Tool description
698    pub description: Option<String>,
699    /// Tool configuration
700    pub config: Option<ToolConfig>,
701    /// Enable/disable tool
702    pub enabled: Option<bool>,
703    /// Tool metadata
704    pub metadata: Option<HashMap<String, serde_json::Value>>,
705}
706
707/// Tool version information
708#[derive(Clone, Debug, Deserialize)]
709pub struct ToolVersion {
710    /// Version ID
711    pub id: String,
712    /// Version number
713    pub version: String,
714    /// Created timestamp
715    pub created_at: Option<String>,
716    /// Updated timestamp
717    pub updated_at: Option<String>,
718    /// Version metadata
719    pub metadata: Option<HashMap<String, serde_json::Value>>,
720}
721
722/// Tool execution history entry
723#[derive(Clone, Debug, Deserialize)]
724pub struct ToolExecutionHistory {
725    /// Execution ID
726    pub id: String,
727    /// Tool ID
728    pub tool_id: String,
729    /// Execution status
730    pub status: String,
731    /// Execution timestamp
732    pub timestamp: Option<String>,
733    /// Execution time in milliseconds
734    pub execution_time_ms: Option<u64>,
735    /// Input parameters
736    pub input: Option<serde_json::Value>,
737    /// Result/output
738    pub output: Option<serde_json::Value>,
739    /// Error message (if failed)
740    pub error: Option<String>,
741}
742
743/// Tool test request
744#[derive(Clone, Debug, Serialize)]
745pub struct ToolTestRequest {
746    /// Tool ID
747    pub tool_id: String,
748    /// Test input parameters
749    pub input: serde_json::Value,
750    /// Test metadata
751    pub metadata: Option<HashMap<String, serde_json::Value>>,
752}
753
754/// Tool test result
755#[derive(Clone, Debug, Deserialize)]
756pub struct ToolTestResult {
757    /// Test status (passed/failed)
758    pub status: String,
759    /// Test output
760    pub output: Option<serde_json::Value>,
761    /// Error message (if failed)
762    pub error: Option<String>,
763    /// Execution time in milliseconds
764    pub execution_time_ms: Option<u64>,
765}
766
767/// Batch message request for multiple messages
768#[derive(Clone, Debug, Serialize)]
769pub struct BatchMessageRequest {
770    /// Messages to process
771    pub messages: Vec<Message>,
772    /// Agent ID
773    pub agent_id: String,
774    /// Thread ID (optional)
775    pub thread_id: Option<String>,
776    /// Batch metadata
777    pub metadata: Option<HashMap<String, serde_json::Value>>,
778}
779
780/// Batch message response
781#[derive(Clone, Debug, Serialize, Deserialize)]
782pub struct BatchMessageResponse {
783    /// Batch ID
784    pub batch_id: String,
785    /// Responses for each message
786    pub responses: Vec<BatchMessageResult>,
787    /// Batch metadata
788    pub metadata: HashMap<String, serde_json::Value>,
789}
790
791/// Individual batch message result
792#[derive(Clone, Debug, Serialize, Deserialize)]
793pub struct BatchMessageResult {
794    /// Message index
795    pub message_index: usize,
796    /// Response message
797    pub response: String,
798    /// Processing time in milliseconds
799    pub processing_time_ms: Option<u64>,
800    /// Error (if any)
801    pub error: Option<String>,
802}
803
804/// Agent configuration for execution
805#[derive(Clone, Debug, Serialize)]
806pub struct AgentExecutionConfig {
807    /// Maximum execution time in seconds
808    pub max_execution_time: Option<u32>,
809    /// Enable tool use
810    pub enable_tools: bool,
811    /// Allowed tools (if empty, all tools allowed)
812    pub allowed_tools: Vec<String>,
813    /// Custom parameters
814    pub custom_params: HashMap<String, serde_json::Value>,
815}
816
817impl Default for AgentExecutionConfig {
818    fn default() -> Self {
819        Self {
820            max_execution_time: Some(300),
821            enable_tools: true,
822            allowed_tools: Vec::new(),
823            custom_params: HashMap::new(),
824        }
825    }
826}
827
828/// Request to chat with documents
829#[derive(Clone, Debug, Serialize)]
830pub struct ChatWithDocsRequest {
831    /// The message to send
832    pub message: String,
833    /// Document content or file reference
834    pub document_content: Option<String>,
835    /// Document file path or URL
836    pub document_path: Option<String>,
837    /// Additional context
838    pub context: Option<HashMap<String, serde_json::Value>>,
839}
840
841/// Response from chat with documents
842#[derive(Clone, Debug, Deserialize)]
843pub struct ChatWithDocsResponse {
844    /// The response message
845    pub message: String,
846    /// Document references used
847    pub documents_used: Option<Vec<String>>,
848    /// Confidence score
849    pub confidence: Option<f64>,
850    /// Additional metadata
851    pub metadata: Option<HashMap<String, serde_json::Value>>,
852}
853
854/// Status of chat with documents knowledge base
855#[derive(Clone, Debug, Deserialize)]
856pub struct ChatWithDocsStatus {
857    /// Status of the knowledge base (e.g., "ready", "processing", "error")
858    pub status: String,
859    /// Number of documents in knowledge base
860    pub document_count: Option<u32>,
861    /// Last update timestamp
862    pub last_updated: Option<String>,
863    /// Error message if status is error
864    pub error_message: Option<String>,
865    /// Additional metadata
866    pub metadata: Option<HashMap<String, serde_json::Value>>,
867}