diff --git a/src/Data/ThinkingConfig.php b/src/Data/ThinkingConfig.php index e0c0644..750978c 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,28 +17,37 @@ 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 $thinkingLevel Controls reasoning behavior. */ public function __construct( public readonly bool $includeThoughts, public readonly int $thinkingBudget, + public readonly ?ThinkingLevel $thinkingLevel = null, ) {} /** - * @param array{ includeThoughts: bool, thinkingBudget: int} $attributes + * @param array{ includeThoughts: bool, thinkingBudget: int, thinkingLevel: ?ThinkingLevel} $attributes */ public static function from(array $attributes): self { return new self( includeThoughts: $attributes['includeThoughts'], thinkingBudget: $attributes['thinkingBudget'], + thinkingLevel: $attributes['thinkingLevel'] ?? null ); } public function toArray(): array { - return [ + $items = [ 'includeThoughts' => $this->includeThoughts, 'thinkingBudget' => $this->thinkingBudget, ]; + + if ($this->thinkingLevel) { + $items['thinkingLevel'] = $this->thinkingLevel->value; + } + + return $items; } } diff --git a/src/Enums/ThinkingLevel.php b/src/Enums/ThinkingLevel.php new file mode 100644 index 0000000..355a091 --- /dev/null +++ b/src/Enums/ThinkingLevel.php @@ -0,0 +1,19 @@ +