ralph_workflow/prompts/
prompt_config.rs1use crate::checkpoint::restore::ResumeContext;
6
7#[derive(Debug, Clone, Default, PartialEq, Eq)]
11#[must_use]
12pub struct PromptConfig {
13 pub iteration: Option<u32>,
15 pub total_iterations: Option<u32>,
17 pub prompt_md_content: Option<String>,
19 pub prompt_and_plan: Option<(String, String)>,
21 pub prompt_plan_and_issues: Option<(String, String, String)>,
23 pub is_resume: bool,
25 pub resume_context: Option<ResumeContext>,
27}
28
29impl PromptConfig {
30 #[must_use = "configuration is required for prompt generation"]
32 pub const fn new() -> Self {
33 Self {
34 iteration: None,
35 total_iterations: None,
36 prompt_md_content: None,
37 prompt_and_plan: None,
38 prompt_plan_and_issues: None,
39 is_resume: false,
40 resume_context: None,
41 }
42 }
43
44 #[must_use = "returns the updated configuration for chaining"]
46 pub const fn with_iterations(mut self, iteration: u32, total: u32) -> Self {
47 self.iteration = Some(iteration);
48 self.total_iterations = Some(total);
49 self
50 }
51
52 #[must_use = "returns the updated configuration for chaining"]
54 pub fn with_prompt_md(mut self, content: String) -> Self {
55 self.prompt_md_content = Some(content);
56 self
57 }
58
59 #[must_use = "returns the updated configuration for chaining"]
61 pub fn with_prompt_and_plan(mut self, prompt: String, plan: String) -> Self {
62 self.prompt_and_plan = Some((prompt, plan));
63 self
64 }
65
66 pub fn with_prompt_plan_and_issues(
68 mut self,
69 prompt: String,
70 plan: String,
71 issues: String,
72 ) -> Self {
73 self.prompt_plan_and_issues = Some((prompt, plan, issues));
74 self
75 }
76
77 #[must_use = "returns the updated configuration for chaining"]
79 pub const fn with_resume(mut self, is_resume: bool) -> Self {
80 self.is_resume = is_resume;
81 self
82 }
83
84 #[must_use = "returns the updated configuration for chaining"]
86 pub fn with_resume_context(mut self, context: ResumeContext) -> Self {
87 self.resume_context = Some(context);
88 self.is_resume = true;
89 self
90 }
91}