Skip to content

Commit 521897d

Browse files
Copilotowndev
andcommitted
fix: Address additional code review feedback
- Add explicit logging for dynamic thinking mode - Improve exception handling with specific exception types Co-authored-by: owndev <69784886+owndev@users.noreply.github.com>
1 parent bf11442 commit 521897d

File tree

1 file changed

+10
-4
lines changed

1 file changed

+10
-4
lines changed

pipelines/google/google_gemini.py

Lines changed: 10 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1510,15 +1510,21 @@ def _configure_generation(
15101510
self.log.debug(
15111511
f"Using thinking_budget={validated_budget} for model {model_id}"
15121512
)
1513-
# -1 means dynamic, so we don't set thinking_budget explicitly
1513+
else:
1514+
# -1 means dynamic thinking
1515+
self.log.debug(
1516+
f"Using dynamic thinking (model decides) for model {model_id}"
1517+
)
15141518

15151519
gen_config_params["thinking_config"] = types.ThinkingConfig(
15161520
**thinking_config_params
15171521
)
1518-
except Exception as e:
1519-
# Fall back silently if SDK/model does not support ThinkingConfig
1522+
except (AttributeError, TypeError) as e:
1523+
# Fall back if SDK/model does not support ThinkingConfig
15201524
self.log.debug(f"ThinkingConfig not supported: {e}")
1521-
pass
1525+
except Exception as e:
1526+
# Log unexpected errors but continue without thinking config
1527+
self.log.warning(f"Unexpected error configuring ThinkingConfig: {e}")
15221528

15231529
# Configure safety settings
15241530
if self.valves.USE_PERMISSIVE_SAFETY:

0 commit comments

Comments
 (0)