From 10163277ca6241d92cee3bee53d91efe136a9123 Mon Sep 17 00:00:00 2001 From: Farouk Adeleke Date: Sat, 24 Jan 2026 00:34:19 -0800 Subject: [PATCH] Add reload_lms method and debug forward() --- nanocode.py | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/nanocode.py b/nanocode.py index 204e0ee..bbd4667 100644 --- a/nanocode.py +++ b/nanocode.py @@ -221,6 +221,7 @@ class RLMCodingProgram(PrecompiledProgram): verbose=self.config.verbose, ) self.agent.set_lm(self.lm) + self.set_lm(self.lm) print(f"{BLUE}CONFIG WAS SET: {self.config}{RESET}") print(f"{BLUE}LM WAS SET: {self.agent.get_lm().model}{RESET}") print(f"{BLUE}SUB LM WAS SET: {self.agent.sub_lm.model}{RESET}") @@ -229,13 +230,11 @@ class RLMCodingProgram(PrecompiledProgram): if not task: return dspy.Prediction(answer="No Task Given.") - # Debug: verify LM at call time - actual_lm = self.agent.get_lm() - print(f"{YELLOW}DEBUG forward() - agent.get_lm().model: {actual_lm.model}{RESET}") + print(f"{YELLOW}DEBUG forward() - agent.get_lm().model: {self.agent.get_lm().model}{RESET}") print(f"{YELLOW}DEBUG forward() - self.lm.model: {self.lm.model}{RESET}") print(f"{YELLOW}DEBUG forward() - agent.sub_lm.model: {self.agent.sub_lm.model}{RESET}") print(f"{YELLOW}DEBUG forward() - self.sub_lm.model: {self.sub_lm.model}{RESET}") - print(f"{YELLOW}DEBUG forward() - id(agent.get_lm()): {id(actual_lm)}, id(self.lm): {id(self.lm)}{RESET}") + print(f"{YELLOW}DEBUG forward() - id(agent.get_lm()): {id(self.agent.get_lm())}, id(self.lm): {id(self.lm)}{RESET}") return self.agent(task=task)