File tree Expand file tree Collapse file tree 1 file changed +10
-10
lines changed
Expand file tree Collapse file tree 1 file changed +10
-10
lines changed Original file line number Diff line number Diff line change 1313use function json_encode ;
1414use function in_array ;
1515
16- /**
17- * Structured outputs with tools is available only for the Gemini 3 series models.
18- * https://ai.google.dev/gemini-api/docs/structured-output?example=recipe#structured_outputs_with_tools
19- */
20- const SUPPORTED_MODELS = [
21- 'gemini-3-pro-preview ' ,
22- 'gemini-3-flash-preview ' ,
23- ];
24-
2516trait HandleStructured
2617{
18+ /**
19+ * Structured outputs with tools is available only for the Gemini 3 series models.
20+ * https://ai.google.dev/gemini-api/docs/structured-output?example=recipe#structured_outputs_with_tools
21+ */
22+ protected array $ supportedModels = [
23+ 'gemini-3-pro-preview ' ,
24+ 'gemini-3-flash-preview ' ,
25+ ];
26+
2727 public function structured (
2828 array $ messages ,
2929 string $ class ,
@@ -37,7 +37,7 @@ public function structured(
3737
3838 // Gemini does not support structured output in combination with tools.
3939 // So we try to work with a JSON mode in case the agent has some tools defined.
40- if (!empty ($ this ->tools ) && !in_array ($ this ->model , SUPPORTED_MODELS )) {
40+ if (!empty ($ this ->tools ) && !in_array ($ this ->model , $ this -> supportedModels )) {
4141 $ last_message = end ($ messages );
4242 if ($ last_message instanceof Message && $ last_message ->getRole () === MessageRole::USER ->value ) {
4343 $ last_message ->setContent (
You can’t perform that action at this time.
0 commit comments