From 1cbcaeafc91e4b1d79866ee5fff52c9f2b2f05cb Mon Sep 17 00:00:00 2001 From: foremtehan <53290883+foremtehan@users.noreply.github.com> Date: Wed, 17 Dec 2025 12:02:51 -0500 Subject: [PATCH 1/6] Add ThinkingLevel enum for different levels of thinking --- src/Enums/ThinkingLevel.php | 13 +++++++++++++ 1 file changed, 13 insertions(+) create mode 100644 src/Enums/ThinkingLevel.php diff --git a/src/Enums/ThinkingLevel.php b/src/Enums/ThinkingLevel.php new file mode 100644 index 0000000..d2d5224 --- /dev/null +++ b/src/Enums/ThinkingLevel.php @@ -0,0 +1,13 @@ + Date: Wed, 17 Dec 2025 12:08:37 -0500 Subject: [PATCH 2/6] Document ThinkingLevel enum behavior Add documentation for ThinkingLevel enum. --- src/Enums/ThinkingLevel.php | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/src/Enums/ThinkingLevel.php b/src/Enums/ThinkingLevel.php index d2d5224..355a091 100644 --- a/src/Enums/ThinkingLevel.php +++ b/src/Enums/ThinkingLevel.php @@ -4,6 +4,12 @@ namespace Gemini\Enums; +/** + * Controls reasoning behavior. + * + * Gemini 3 Pro: low, high + * Gemini 3 Flash: minimal, low, medium, high + */ enum ThinkingLevel: string { case LOW = 'low'; From c78358813819b2d5ad94a3efb4917ed09a2bc68d Mon Sep 17 00:00:00 2001 From: foremtehan <53290883+foremtehan@users.noreply.github.com> Date: Wed, 17 Dec 2025 12:11:41 -0500 Subject: [PATCH 3/6] Add ThinkingLevel parameter to ThinkingConfig --- src/Data/ThinkingConfig.php | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/src/Data/ThinkingConfig.php b/src/Data/ThinkingConfig.php index e0c0644..44a1ef9 100644 --- a/src/Data/ThinkingConfig.php +++ b/src/Data/ThinkingConfig.php @@ -5,6 +5,7 @@ namespace Gemini\Data; use Gemini\Contracts\Arrayable; +use Gemini\Enums\ThinkingLevel; /** * Config for thinking features. @@ -16,10 +17,12 @@ final class ThinkingConfig implements Arrayable /** * @param bool $includeThoughts Indicates whether to include thoughts in the response. If true, thoughts are returned only when available. * @param int $thinkingBudget The number of thoughts tokens that the model should generate. + * @param ThinkingLevel|null $thinkingBudget Controls reasoning behavior. */ public function __construct( public readonly bool $includeThoughts, public readonly int $thinkingBudget, + public readonly ?ThinkingLevel $thinkingLevel = null, ) {} /** @@ -30,6 +33,7 @@ public static function from(array $attributes): self return new self( includeThoughts: $attributes['includeThoughts'], thinkingBudget: $attributes['thinkingBudget'], + thinkingLevel: $attributes['thinkingLevel'] ?? null ); } @@ -38,6 +42,7 @@ public function toArray(): array return [ 'includeThoughts' => $this->includeThoughts, 'thinkingBudget' => $this->thinkingBudget, + 'thinkingLevel' => $this->thinkingLevel?->value, ]; } } From c58c1705b6103adb5b35ec38f19e97099f67ae16 Mon Sep 17 00:00:00 2001 From: foremtehan <53290883+foremtehan@users.noreply.github.com> Date: Wed, 17 Dec 2025 12:16:52 -0500 Subject: [PATCH 4/6] Refactor toArray method to use temporary items array --- src/Data/ThinkingConfig.php | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/src/Data/ThinkingConfig.php b/src/Data/ThinkingConfig.php index 44a1ef9..ac41987 100644 --- a/src/Data/ThinkingConfig.php +++ b/src/Data/ThinkingConfig.php @@ -39,10 +39,15 @@ public static function from(array $attributes): self public function toArray(): array { - return [ + $items = [ 'includeThoughts' => $this->includeThoughts, 'thinkingBudget' => $this->thinkingBudget, - 'thinkingLevel' => $this->thinkingLevel?->value, ]; + + if ($this->thinkingLevel) { + $items['thinkingLevel'] = $this->thinkingLevel->value; + } + + return $items; } } From 0d0c7b4b0ea89bff27edfdb585c39d92e88cdaa9 Mon Sep 17 00:00:00 2001 From: foremtehan <53290883+foremtehan@users.noreply.github.com> Date: Wed, 17 Dec 2025 13:15:13 -0500 Subject: [PATCH 5/6] Fix parameter name in ThinkingConfig constructor --- src/Data/ThinkingConfig.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/Data/ThinkingConfig.php b/src/Data/ThinkingConfig.php index ac41987..0367ae6 100644 --- a/src/Data/ThinkingConfig.php +++ b/src/Data/ThinkingConfig.php @@ -17,7 +17,7 @@ final class ThinkingConfig implements Arrayable /** * @param bool $includeThoughts Indicates whether to include thoughts in the response. If true, thoughts are returned only when available. * @param int $thinkingBudget The number of thoughts tokens that the model should generate. - * @param ThinkingLevel|null $thinkingBudget Controls reasoning behavior. + * @param ThinkingLevel|null $thinkingLevel Controls reasoning behavior. */ public function __construct( public readonly bool $includeThoughts, @@ -26,7 +26,7 @@ public function __construct( ) {} /** - * @param array{ includeThoughts: bool, thinkingBudget: int} $attributes + * @param array{ includeThoughts: bool, thinkingBudget: int, $thinkingLevel: ?ThinkingLevel} $attributes */ public static function from(array $attributes): self { From 5f827c540e5cf1a3af4c4d6daf89a96f2047a7d5 Mon Sep 17 00:00:00 2001 From: foremtehan <53290883+foremtehan@users.noreply.github.com> Date: Wed, 17 Dec 2025 13:18:03 -0500 Subject: [PATCH 6/6] Fix parameter annotation in from method --- src/Data/ThinkingConfig.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/Data/ThinkingConfig.php b/src/Data/ThinkingConfig.php index 0367ae6..750978c 100644 --- a/src/Data/ThinkingConfig.php +++ b/src/Data/ThinkingConfig.php @@ -26,7 +26,7 @@ public function __construct( ) {} /** - * @param array{ includeThoughts: bool, thinkingBudget: int, $thinkingLevel: ?ThinkingLevel} $attributes + * @param array{ includeThoughts: bool, thinkingBudget: int, thinkingLevel: ?ThinkingLevel} $attributes */ public static function from(array $attributes): self {