55namespace Gemini \Data ;
66
77use Gemini \Contracts \Arrayable ;
8+ use Gemini \Enums \ThinkingLevel ;
89
910/**
1011 * Config for thinking features.
@@ -16,28 +17,37 @@ final class ThinkingConfig implements Arrayable
1617 /**
1718 * @param bool $includeThoughts Indicates whether to include thoughts in the response. If true, thoughts are returned only when available.
1819 * @param int $thinkingBudget The number of thoughts tokens that the model should generate.
20+ * @param ThinkingLevel|null $thinkingLevel Controls reasoning behavior.
1921 */
2022 public function __construct (
2123 public readonly bool $ includeThoughts ,
2224 public readonly int $ thinkingBudget ,
25+ public readonly ?ThinkingLevel $ thinkingLevel = null ,
2326 ) {}
2427
2528 /**
26- * @param array{ includeThoughts: bool, thinkingBudget: int} $attributes
29+ * @param array{ includeThoughts: bool, thinkingBudget: int, thinkingLevel: ?ThinkingLevel } $attributes
2730 */
2831 public static function from (array $ attributes ): self
2932 {
3033 return new self (
3134 includeThoughts: $ attributes ['includeThoughts ' ],
3235 thinkingBudget: $ attributes ['thinkingBudget ' ],
36+ thinkingLevel: $ attributes ['thinkingLevel ' ] ?? null
3337 );
3438 }
3539
3640 public function toArray (): array
3741 {
38- return [
42+ $ items = [
3943 'includeThoughts ' => $ this ->includeThoughts ,
4044 'thinkingBudget ' => $ this ->thinkingBudget ,
4145 ];
46+
47+ if ($ this ->thinkingLevel ) {
48+ $ items ['thinkingLevel ' ] = $ this ->thinkingLevel ->value ;
49+ }
50+
51+ return $ items ;
4252 }
4353}
0 commit comments