Skip to content

Commit a88f9ce

Browse files
committed
fix(browsecomp): Await Workforce.clone and fix typing in browsecomp
1 parent cd462c8 commit a88f9ce

File tree

1 file changed

+9
-7
lines changed

1 file changed

+9
-7
lines changed

camel/benchmarks/browsecomp.py

Lines changed: 9 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -585,15 +585,17 @@ def process_benchmark_row(row: Dict[str, Any]) -> Dict[str, Any]:
585585
input_message = QUERY_TEMPLATE.format(question=problem)
586586

587587
if isinstance(pipeline_template, (ChatAgent)):
588-
pipeline = pipeline_template.clone() # type: ignore[assignment]
588+
chat_pipeline = pipeline_template.clone()
589589

590-
response_text = pipeline.step(
590+
response_text = chat_pipeline.step(
591591
input_message, response_format=QueryResponse
592592
)
593593
elif isinstance(pipeline_template, Workforce):
594-
pipeline = pipeline_template.clone() # type: ignore[assignment]
594+
workforce_pipeline = asyncio.run(pipeline_template.clone())
595595
task = Task(content=input_message, id="0")
596-
task = asyncio.run(pipeline.process_task_async(task)) # type: ignore[attr-defined]
596+
task = asyncio.run(
597+
workforce_pipeline.process_task_async(task)
598+
) # type: ignore[attr-defined]
597599
if task_json_formatter:
598600
formatter_in_process = task_json_formatter.clone()
599601
else:
@@ -607,16 +609,16 @@ def process_benchmark_row(row: Dict[str, Any]) -> Dict[str, Any]:
607609

608610
elif isinstance(pipeline_template, RolePlaying):
609611
# RolePlaying is different.
610-
pipeline = pipeline_template.clone( # type: ignore[assignment]
612+
rp_pipeline = pipeline_template.clone(
611613
task_prompt=input_message
612614
)
613615

614616
n = 0
615-
input_msg = pipeline.init_chat() # type: ignore[attr-defined]
617+
input_msg = rp_pipeline.init_chat()
616618
chat_history = []
617619
while n < chat_turn_limit:
618620
n += 1
619-
assistant_response, user_response = pipeline.step(
621+
assistant_response, user_response = rp_pipeline.step(
620622
input_msg
621623
)
622624
if assistant_response.terminated: # type: ignore[union-attr]

0 commit comments

Comments
 (0)