@@ -302,7 +302,7 @@ class NemoAgent:
302302 WRITE_RETRY_DELAY = 1 # second
303303
304304 def __init__ (
305- self , task : str , model : str = "qwen2.5-coder:14b" , provider : str = "ollama"
305+ self , task : str , model : str = "qwen2.5-coder:14b" , provider : str = "ollama" , tests : bool = True
306306 ):
307307 self .task = task
308308 self .model = model
@@ -317,6 +317,7 @@ def __init__(
317317 self .code_content = ""
318318 self .data_content = ""
319319 self .previous_prompt = ""
320+ self .tests = tests
320321
321322 def count_tokens (self , text ):
322323 encoding = tiktoken .encoding_for_model ("gpt-3.5-turbo" )
@@ -419,15 +420,16 @@ def run_task(self):
419420 break
420421 code_check_attempts += 1
421422
422- test_check_attempts = 1
423- while test_check_attempts < self .MAX_IMPROVEMENT_ATTEMPTS :
424- tests_passed , coverage , test_output = self .run_tests ()
425- if not tests_passed or coverage < 80 :
426- self .improve_test_file (test_output )
423+ if self .tests :
424+ test_check_attempts = 1
425+ while test_check_attempts < self .MAX_IMPROVEMENT_ATTEMPTS :
427426 tests_passed , coverage , test_output = self .run_tests ()
428- else :
429- break
430- test_check_attempts += 1
427+ if not tests_passed or coverage < 80 :
428+ self .improve_test_file (test_output )
429+ tests_passed , coverage , test_output = self .run_tests ()
430+ else :
431+ break
432+ test_check_attempts += 1
431433
432434 total_tokens = sum (self .token_counts .values ())
433435 print (f"\n Total tokens used: { total_tokens } " )
@@ -1011,7 +1013,7 @@ def main
10111013 type = click .Path (exists = True ),
10121014 help = "Path to a markdown file containing the task" ,
10131015)
1014- @click .option ("--model" , default = "qwen2.5-coder:14b" , help = "The model to use for the LLM " )
1016+ @click .option ("--model" , default = "qwen2.5-coder:14b" , help = "The model to use for Nemo Agent " )
10151017@click .option (
10161018 "--provider" ,
10171019 default = "ollama" ,
@@ -1036,6 +1038,12 @@ def main
10361038 type = click .Path (exists = True ),
10371039 help = "Path to the import folder containing data files" ,
10381040)
1041+ @click .option (
1042+ "--tests" ,
1043+ default = True ,
1044+ type = click .BOOL ,
1045+ help = "Whether to run tests after implementing the solution" ,
1046+ )
10391047def cli (
10401048 task : str = None ,
10411049 file : str = None ,
@@ -1045,6 +1053,7 @@ def cli(
10451053 docs : str = None ,
10461054 code : str = None ,
10471055 data : str = None ,
1056+ tests : bool = True ,
10481057):
10491058 """
10501059 Run Nemo Agent tasks to create Python projects using uv and pytest.
@@ -1073,7 +1082,7 @@ def cli(
10731082 elif not task :
10741083 task = click .prompt ("Please enter your task" )
10751084
1076- nemo_agent = NemoAgent (task = task , model = model , provider = provider )
1085+ nemo_agent = NemoAgent (task = task , model = model , provider = provider , tests = tests )
10771086
10781087 # Ingest docs if provided
10791088 if docs :
0 commit comments