@@ -73,6 +73,7 @@ def generate_tasks_using_llm(
7373 num_tasks : int ,
7474 scientist_llm_gen_cfg_task_gen : Dict [str , Any ],
7575 scientist_llm_gen_cfg_task_solve : Dict [str , Any ],
76+ solve_sample_tasks : bool = False ,
7677 ** kwargs : Any ,
7778) -> None :
7879 """
@@ -91,6 +92,7 @@ def generate_tasks_using_llm(
9192 for task generation using the scientist LLM.
9293 scientist_llm_gen_cfg_task_solve (Dict[str, Any]): The generation configuration
9394 for solving tasks using the scientist LLM.
95+ solve_sample_tasks (bool, optional): Whether to solve sample tasks.
9496 **kwargs (Any): Additional arguments for task generation.
9597 """
9698 # TODO: Implement the function with the following components
@@ -122,9 +124,6 @@ def generate_tasks_using_llm(
122124 # Generate task problems
123125 # Extract sample tasks from representative tasks
124126 sample_tasks = capability .get_repr_tasks ()
125- for task in sample_tasks :
126- # Remove the answer
127- task .pop ("answer" , None )
128127
129128 # Generate new tasks using the scientist LLM
130129 sys_prompt , user_prompt = get_task_generation_prompt (
@@ -144,14 +143,20 @@ def generate_tasks_using_llm(
144143 print (f"Metadata: { task_gen_metadata } " )
145144 parsed_response = extract_and_parse_response (response )
146145 new_tasks = parsed_response ["parsed_response" ]
147- # Combine with sample tasks to get the full set of tasks
148- start_id = len (sample_tasks ) + 1
149- all_tasks = sample_tasks + [
146+
147+ # Solve task and generate answers
148+ # Set starting ID for new tasks
149+ start_id = len (capability .get_tasks ()) + 1
150+ all_tasks = [
150151 {"id" : str (start_id + idx ), "problem" : new_tasks [idx ]}
151152 for idx in range (len (new_tasks ))
152153 ]
153-
154- # Solve task and generate answers
154+ # Add sample tasks if solving them
155+ if solve_sample_tasks :
156+ for task in sample_tasks :
157+ # Remove the answer
158+ task .pop ("answer" , None )
159+ all_tasks = sample_tasks + all_tasks
155160 solved_tasks , task_solver_metadata = capability .solve_tasks (
156161 tasks = all_tasks ,
157162 llm = scientist_llm ,
0 commit comments