1313 * @phpstan-import-type ComparisonFilterType from FileSearchComparisonFilter
1414 * @phpstan-import-type CompoundFilterType from FileSearchCompoundFilter
1515 *
16- * @phpstan-type FileSearchToolType array{type: 'file_search', vector_store_ids: array<int, string>, filters: ComparisonFilterType|CompoundFilterType|null, max_num_results: int, ranking_options: RankingOptionType}
16+ * @phpstan-type FileSearchToolType array{type: 'file_search', vector_store_ids: array<int, string>, filters: ComparisonFilterType|CompoundFilterType|null, max_num_results: int|null , ranking_options: RankingOptionType|null }
1717 *
1818 * @implements ResponseContract<FileSearchToolType>
1919 */
@@ -34,8 +34,8 @@ private function __construct(
3434 public readonly string $ type ,
3535 public readonly array $ vectorStoreIds ,
3636 public readonly FileSearchComparisonFilter |FileSearchCompoundFilter |null $ filters ,
37- public readonly int $ maxNumResults ,
38- public readonly FileSearchRankingOption $ rankingOptions ,
37+ public readonly ? int $ maxNumResults ,
38+ public readonly ? FileSearchRankingOption $ rankingOptions ,
3939 ) {}
4040
4141 /**
@@ -56,8 +56,8 @@ public static function from(array $attributes): self
5656 type: $ attributes ['type ' ],
5757 vectorStoreIds: $ attributes ['vector_store_ids ' ],
5858 filters: $ filters ,
59- maxNumResults: $ attributes ['max_num_results ' ],
60- rankingOptions: FileSearchRankingOption::from ($ attributes ['ranking_options ' ]),
59+ maxNumResults: $ attributes ['max_num_results ' ] ?? null ,
60+ rankingOptions: isset ( $ attributes [ ' ranking_options ' ]) ? FileSearchRankingOption::from ($ attributes ['ranking_options ' ]) : null ,
6161 );
6262 }
6363
@@ -71,7 +71,7 @@ public function toArray(): array
7171 'vector_store_ids ' => $ this ->vectorStoreIds ,
7272 'filters ' => $ this ->filters ?->toArray(),
7373 'max_num_results ' => $ this ->maxNumResults ,
74- 'ranking_options ' => $ this ->rankingOptions ->toArray (),
74+ 'ranking_options ' => $ this ->rankingOptions ? ->toArray(),
7575 ];
7676 }
7777}
0 commit comments