MCPcopy Create free account
hub / github.com/SamuelSchmidgall/AgentLaboratory / reflect_code

Method reflect_code

mlesolver.py:319–327  ·  view source on GitHub ↗

Provide a reflection on produced behavior for next execution @return: (str) language model-produced reflection

(self)

Source from the content-addressed store, hash-verified

317 return model_resp, cmd_str
318
319 def reflect_code(self):
320 """
321 Provide a reflection on produced behavior for next execution
322 @return: (str) language model-produced reflection
323 """
324 code_strs = ("$"*40 + "\n\n").join([self.generate_code_lines(_code[0]) + f"\nCode Return {_code[1]}" for _code in self.best_codes])
325 code_strs = f"Please reflect on the following sets of code: {code_strs} and come up with generalizable insights that will help you improve your performance on this benchmark."
326 syst = self.system_prompt(commands=False) + code_strs
327 return query_model(prompt="Please reflect on ideas for how to improve your current code. Examine the provided code and think very specifically (with precise ideas) on how to improve performance, which methods to use, how to improve generalization on the test set with line-by-line examples below:\n", system_prompt=syst, model_str=f"{self.llm_str}", openai_api_key=self.openai_api_key)
328
329 def process_command(self, model_resp):
330 """

Callers 1

solveMethod · 0.95

Calls 3

generate_code_linesMethod · 0.95
system_promptMethod · 0.95
query_modelFunction · 0.85

Tested by

no test coverage detected