MCPcopy Create free account
hub / github.com/AI45Lab/Code / fallback_plan

Method fallback_plan

core/src/planning/llm_planner.rs:149–181  ·  view source on GitHub ↗

Create a fallback plan using heuristic logic (no LLM required)

(prompt: &str)

Source from the content-addressed store, hash-verified

147
148 /// Create a fallback plan using heuristic logic (no LLM required)
149 pub fn fallback_plan(prompt: &str) -> ExecutionPlan {
150 let complexity = if prompt.len() < 50 {
151 Complexity::Simple
152 } else if prompt.len() < 150 {
153 Complexity::Medium
154 } else if prompt.len() < 300 {
155 Complexity::Complex
156 } else {
157 Complexity::VeryComplex
158 };
159
160 let mut plan = ExecutionPlan::new(prompt, complexity);
161
162 let step_count = match complexity {
163 Complexity::Simple => 2,
164 Complexity::Medium => 4,
165 Complexity::Complex => 7,
166 Complexity::VeryComplex => 10,
167 };
168
169 for i in 0..step_count {
170 let step = Task::new(
171 format!("step-{}", i + 1),
172 crate::prompts::render(
173 crate::prompts::PLAN_FALLBACK_STEP,
174 &[("step_num", &(i + 1).to_string())],
175 ),
176 );
177 plan.add_step(step);
178 }
179
180 plan
181 }
182
183 /// Create a fallback goal using heuristic logic (no LLM required)
184 pub fn fallback_goal(prompt: &str) -> AgentGoal {

Callers

nothing calls this directly

Calls 3

renderFunction · 0.85
add_stepMethod · 0.80
lenMethod · 0.45

Tested by

no test coverage detected