Skip to content

Commit 20eff0e

Browse files
authored
fix: target json type & round (microsoft#662)
* refactor: Rename direct_exp_gen to json_target_type in DSExpGen class * fix type * fix: Adjust loop iterations and update json_target_type for nested dicts
1 parent fc4cdc3 commit 20eff0e

File tree

2 files changed

+5
-2
lines changed

2 files changed

+5
-2
lines changed

rdagent/oai/backend/base.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -378,7 +378,7 @@ def _create_chat_completion_auto_continue(
378378

379379
all_response = ""
380380
new_messages = deepcopy(messages)
381-
for _ in range(3):
381+
for _ in range(6): # for some long code, 3 times may not enough for reasoning models
382382
if "json_mode" in kwargs:
383383
del kwargs["json_mode"]
384384
response, finish_reason = self._create_chat_completion_add_json_in_prompt(

rdagent/scenarios/data_science/proposal/exp_gen.py

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -420,7 +420,10 @@ def _f(user_prompt):
420420
user_prompt=user_prompt,
421421
system_prompt=system_prompt,
422422
json_mode=True,
423-
json_target_type=dict[str, dict[str, str] | str], # workflow_update may be a string
423+
# NOTE: corner cases.
424+
# workflow_update may be a string
425+
# model could have 2 level nested dict.
426+
json_target_type=dict[str, dict[str, str | dict] | str],
424427
)
425428
)
426429
assert "hypothesis_proposal" in resp_dict, "Hypothesis proposal not provided."

0 commit comments

Comments
 (0)