Skip to content

Commit 798a9f6

Browse files
committed
Only show traceback.print_exc during debug mode
1 parent 345eb9d commit 798a9f6

File tree

1 file changed

+6
-3
lines changed

1 file changed

+6
-3
lines changed

operate/models/apis.py

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -138,7 +138,8 @@ def call_gpt_4_vision_preview(messages):
138138
f"{ANSI_GREEN}[Self-Operating Computer]{ANSI_RED}[Error] AI response was {ANSI_RESET}",
139139
content,
140140
)
141-
traceback.print_exc()
141+
if VERBOSE:
142+
traceback.print_exc()
142143
return call_gpt_4_vision_preview(messages)
143144

144145

@@ -314,7 +315,8 @@ async def call_gpt_4_vision_preview_ocr(messages, objective, model):
314315
f"{ANSI_GREEN}[Self-Operating Computer]{ANSI_RED}[Error] Something went wrong. Trying another method {ANSI_RESET}",
315316
e,
316317
)
317-
traceback.print_exc()
318+
if VERBOSE:
319+
traceback.print_exc()
318320
return gpt_4_fallback(messages, objective, model)
319321

320322

@@ -450,7 +452,8 @@ async def call_gpt_4_vision_preview_labeled(messages, objective):
450452
f"{ANSI_GREEN}[Self-Operating Computer]{ANSI_RED}[Error] Something went wrong. Trying another method {ANSI_RESET}",
451453
e,
452454
)
453-
traceback.print_exc()
455+
if VERBOSE:
456+
traceback.print_exc()
454457
return call_gpt_4_vision_preview(messages)
455458

456459

0 commit comments

Comments
 (0)