rexis_rag/agent/
config.rs1use serde::{Deserialize, Serialize};
4
5#[derive(Debug, Clone, Copy, PartialEq, Eq, Serialize, Deserialize)]
7pub enum ConversationMode {
8 Stateless,
10 Stateful,
12}
13
14#[derive(Debug, Clone, Serialize, Deserialize)]
16pub struct AgentConfig {
17 pub system_prompt: String,
19
20 pub max_iterations: usize,
22
23 pub verbose: bool,
25
26 pub conversation_mode: ConversationMode,
28
29 pub max_conversation_length: usize,
31}
32
33impl Default for AgentConfig {
34 fn default() -> Self {
35 Self {
36 system_prompt: "You are a helpful assistant with access to tools. Use tools when needed to provide accurate information.".to_string(),
37 max_iterations: 10,
38 verbose: false,
39 conversation_mode: ConversationMode::Stateless,
40 max_conversation_length: 50,
41 }
42 }
43}
44
45impl AgentConfig {
46 pub fn new() -> Self {
48 Self::default()
49 }
50
51 pub fn with_system_prompt(mut self, prompt: impl Into<String>) -> Self {
53 self.system_prompt = prompt.into();
54 self
55 }
56
57 pub fn with_max_iterations(mut self, max: usize) -> Self {
59 self.max_iterations = max;
60 self
61 }
62
63 pub fn with_verbose(mut self, verbose: bool) -> Self {
65 self.verbose = verbose;
66 self
67 }
68
69 pub fn with_conversation_mode(mut self, mode: ConversationMode) -> Self {
71 self.conversation_mode = mode;
72 self
73 }
74
75 pub fn with_max_conversation_length(mut self, length: usize) -> Self {
77 self.max_conversation_length = length;
78 self
79 }
80}