Skip to content

Official Codebase of 3DCodeVerse

Python

callers: clip every remaining unbounded model call with max_wait_s

gaoypeng43d035006899
diff --git a/harness/codeverse/flywheel/captions.py b/harness/codeverse/flywheel/captions.py
index aaaf3a74..bd4abb77 100644
--- a/harness/codeverse/flywheel/captions.py
+++ b/harness/codeverse/flywheel/captions.py
@@ -182,7 +182,7 @@ def caption_sample(
problems: list[str] = []
for _attempt in range(2):
resp = model.generate(ChatRequest(messages=messages, system=system, response_schema=schema,
- temperature=0.3, thinking="low", label="captioner")) # type: ignore[attr-defined]
+ temperature=0.3, thinking="low", max_wait_s=300.0, label="captioner")) # type: ignore[attr-defined]
cost += resp.usage.cost_usd
data = resp.parsed if isinstance(resp.parsed, dict) else _parse_json(resp.text)
try:
diff --git a/harness/codeverse/judges/pairwise.py b/harness/codeverse/judges/pairwise.py
index d678137d..1475b04f 100644
--- a/harness/codeverse/judges/pairwise.py
+++ b/harness/codeverse/judges/pairwise.py
@@ -231,7 +231,8 @@ class PairwiseJudge:
parts.append(TextPart(text="Compare A and B and return the JSON object."))
return ChatRequest(
messages=[ChatMessage(role="user", parts=parts)], system=_SYSTEM,
- response_schema=PairwiseReply.model_json_schema(), temperature=self.temperature, label=label,
+ response_schema=PairwiseReply.model_json_schema(), temperature=self.temperature,
+ max_wait_s=240.0, label=label,
)
def _side_images(self, tag: str, rs: RenderSet) -> list[tuple[str, ImagePart]]:
diff --git a/harness/codeverse/reference/gate.py b/harness/codeverse/reference/gate.py
index 3804308c..971f5cb8 100644
--- a/harness/codeverse/reference/gate.py
+++ b/harness/codeverse/reference/gate.py
@@ -88,6 +88,7 @@ def check_plausible(
temperature=temperature,
thinking="low",
max_output_tokens=2000,
+ max_wait_s=240.0,
label="reference_gate",
)
try:
diff --git a/harness/codeverse/reference/mismatch.py b/harness/codeverse/reference/mismatch.py
index 00da4fe4..c6e8036d 100644
--- a/harness/codeverse/reference/mismatch.py
+++ b/harness/codeverse/reference/mismatch.py
@@ -85,7 +85,7 @@ def compare(
images += [ImagePart(path=str(p), label=f"RENDER {i + 1} ({p.stem})") for i, p in enumerate(rens)]
req = ChatRequest(messages=[ChatMessage.user(text, images=images)], system=DIFF_SYSTEM,
response_schema=DiffAnswer.model_json_schema(), temperature=temperature,
- thinking="low", max_output_tokens=3000, label="reference_diff")
+ thinking="low", max_output_tokens=3000, max_wait_s=240.0, label="reference_diff")
try:
resp = model.generate(req)
except ModelError as e:
diff --git a/harness/codeverse/reference/synth.py b/harness/codeverse/reference/synth.py
index 223cb5a3..da6a17c9 100644
--- a/harness/codeverse/reference/synth.py
+++ b/harness/codeverse/reference/synth.py
@@ -93,7 +93,7 @@ def image_prompt_plan(spec: Spec, view_names: list[str], *, model: Any, temperat
text = IMAGE_PROMPT_USER.format(brief=brief_text(spec), n_views=len(view_names), views=", ".join(view_names))
req = ChatRequest(messages=[ChatMessage.user(text)], system=IMAGE_PROMPT_SYSTEM,
response_schema=ImagePromptPlan.model_json_schema(), temperature=temperature,
- thinking="low", max_output_tokens=2000, label="reference_prompt")
+ thinking="low", max_output_tokens=2000, max_wait_s=300.0, label="reference_prompt")
try:
resp = model.generate(req)
except ModelError as e:
diff --git a/harness/codeverse/texturing/plan.py b/harness/codeverse/texturing/plan.py
index 56b1c699..6ebb7c4b 100644
--- a/harness/codeverse/texturing/plan.py
+++ b/harness/codeverse/texturing/plan.py
@@ -319,7 +319,7 @@ def material_plan(
messages=[ChatMessage.user(text, images=[ImagePart(path=str(p), label=p.stem) for p in images])],
system="You plan PBR textures for 3D assets. Answer with JSON only.",
response_schema=PlannerOutput.model_json_schema(), temperature=temperature, thinking="low",
- max_output_tokens=8000, label="texture_plan",
+ max_output_tokens=8000, max_wait_s=300.0, label="texture_plan",
)
resp = model.generate(req)
payload = resp.parsed if resp.parsed is not None else parse_json_lenient(resp.text)
diff --git a/harness/codeverse/texturing/scene_pack.py b/harness/codeverse/texturing/scene_pack.py
index 71c2ea92..06cbfe87 100644
--- a/harness/codeverse/texturing/scene_pack.py
+++ b/harness/codeverse/texturing/scene_pack.py
@@ -148,7 +148,7 @@ def scene_pack_plan(
environment=plan.environment, zones=zones, assets=assets)
req = ChatRequest(messages=[ChatMessage.user(text)], system="You plan texture packs for 3D scenes. JSON only.",
response_schema=PackOutput.model_json_schema(), temperature=temperature, thinking="low",
- max_output_tokens=8000, label="scene_texture_pack")
+ max_output_tokens=8000, max_wait_s=300.0, label="scene_texture_pack")
resp = model.generate(req)
payload = resp.parsed if resp.parsed is not None else parse_json_lenient(resp.text)
try:
diff --git a/harness/codeverse/tracks/brief.py b/harness/codeverse/tracks/brief.py
index 994e38dd..b6cb1883 100644
--- a/harness/codeverse/tracks/brief.py
+++ b/harness/codeverse/tracks/brief.py
@@ -133,7 +133,7 @@ def expand_brief(spec: Spec, model_id: str, *, model: Any | None = None, events:
resp = model.generate(ChatRequest(
messages=[ChatMessage.user(user, images=images or None)], system=system,
response_schema=EngineeringBrief.model_json_schema(), temperature=0.3, thinking="low",
- max_output_tokens=BRIEF_MAX_TOKENS, label="planner-brief"))
+ max_output_tokens=BRIEF_MAX_TOKENS, max_wait_s=300.0, label="planner-brief"))
usage = usage + resp.usage
# parse_json_lenient, not json.loads: it tolerates fences/prose AND strips the
# C0 controls a model can emit, which json.loads would carry into the brief.