diff --git a/.repo-metadata-full.json b/.repo-metadata-full.json index 771229c6598..7a3e5d19169 100644 --- a/.repo-metadata-full.json +++ b/.repo-metadata-full.json @@ -823,6 +823,14 @@ "library_type": "GAPIC_AUTO", "api_shortname": "gkemulticloud" }, + "GkeRecommender": { + "language": "php", + "distribution_name": "google/cloud-gkerecommender", + "release_level": "preview", + "client_documentation": "https://cloud.google.com/php/docs/reference/cloud-gkerecommender/latest", + "library_type": "GAPIC_AUTO", + "api_shortname": "gkerecommender" + }, "Grafeas": { "language": "php", "distribution_name": "google/grafeas", diff --git a/GkeRecommender/.OwlBot.yaml b/GkeRecommender/.OwlBot.yaml new file mode 100644 index 00000000000..4b6b23fb05c --- /dev/null +++ b/GkeRecommender/.OwlBot.yaml @@ -0,0 +1,4 @@ +deep-copy-regex: + - source: /google/cloud/gkerecommender/(v1)/.*-php/(.*) + dest: /owl-bot-staging/GkeRecommender/$1/$2 +api-name: GkeRecommender diff --git a/GkeRecommender/.gitattributes b/GkeRecommender/.gitattributes new file mode 100644 index 00000000000..4bf0fe6f415 --- /dev/null +++ b/GkeRecommender/.gitattributes @@ -0,0 +1,7 @@ +/*.xml.dist export-ignore +/.OwlBot.yaml export-ignore +/.github export-ignore +/owlbot.py export-ignore +/src/**/gapic_metadata.json export-ignore +/samples export-ignore +/tests export-ignore diff --git a/GkeRecommender/.github/pull_request_template.md b/GkeRecommender/.github/pull_request_template.md new file mode 100644 index 00000000000..581cb884ac8 --- /dev/null +++ b/GkeRecommender/.github/pull_request_template.md @@ -0,0 +1,24 @@ +**PLEASE READ THIS ENTIRE MESSAGE** + +Hello, and thank you for your contribution! Please note that this repository is +a read-only split of `googleapis/google-cloud-php`. As such, we are +unable to accept pull requests to this repository. + +We welcome your pull request and would be happy to consider it for inclusion in +our library if you follow these steps: + +* Clone the parent client library repository: + +```sh +$ git clone git@github.com:googleapis/google-cloud-php.git +``` + +* Move your changes into the correct location in that library. Library code +belongs in `GkeRecommender/src`, and tests in `GkeRecommender/tests`. + +* Push the changes in a new branch to a fork, and open a new pull request +[here](https://github.com/googleapis/google-cloud-php). + +Thanks again, and we look forward to seeing your proposed change! + +The Google Cloud PHP team diff --git a/GkeRecommender/CONTRIBUTING.md b/GkeRecommender/CONTRIBUTING.md new file mode 100644 index 00000000000..76ea811cacd --- /dev/null +++ b/GkeRecommender/CONTRIBUTING.md @@ -0,0 +1,10 @@ +# How to Contribute + +We'd love to accept your patches and contributions to this project. We accept +and review pull requests against the main +[Google Cloud PHP](https://github.com/googleapis/google-cloud-php) +repository, which contains all of our client libraries. You will also need to +sign a Contributor License Agreement. For more details about how to contribute, +see the +[CONTRIBUTING.md](https://github.com/googleapis/google-cloud-php/blob/main/CONTRIBUTING.md) +file in the main Google Cloud PHP repository. diff --git a/GkeRecommender/LICENSE b/GkeRecommender/LICENSE new file mode 100644 index 00000000000..8f71f43fee3 --- /dev/null +++ b/GkeRecommender/LICENSE @@ -0,0 +1,202 @@ + Apache License + Version 2.0, January 2004 + http://www.apache.org/licenses/ + + TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION + + 1. Definitions. + + "License" shall mean the terms and conditions for use, reproduction, + and distribution as defined by Sections 1 through 9 of this document. + + "Licensor" shall mean the copyright owner or entity authorized by + the copyright owner that is granting the License. + + "Legal Entity" shall mean the union of the acting entity and all + other entities that control, are controlled by, or are under common + control with that entity. For the purposes of this definition, + "control" means (i) the power, direct or indirect, to cause the + direction or management of such entity, whether by contract or + otherwise, or (ii) ownership of fifty percent (50%) or more of the + outstanding shares, or (iii) beneficial ownership of such entity. + + "You" (or "Your") shall mean an individual or Legal Entity + exercising permissions granted by this License. + + "Source" form shall mean the preferred form for making modifications, + including but not limited to software source code, documentation + source, and configuration files. + + "Object" form shall mean any form resulting from mechanical + transformation or translation of a Source form, including but + not limited to compiled object code, generated documentation, + and conversions to other media types. + + "Work" shall mean the work of authorship, whether in Source or + Object form, made available under the License, as indicated by a + copyright notice that is included in or attached to the work + (an example is provided in the Appendix below). + + "Derivative Works" shall mean any work, whether in Source or Object + form, that is based on (or derived from) the Work and for which the + editorial revisions, annotations, elaborations, or other modifications + represent, as a whole, an original work of authorship. For the purposes + of this License, Derivative Works shall not include works that remain + separable from, or merely link (or bind by name) to the interfaces of, + the Work and Derivative Works thereof. + + "Contribution" shall mean any work of authorship, including + the original version of the Work and any modifications or additions + to that Work or Derivative Works thereof, that is intentionally + submitted to Licensor for inclusion in the Work by the copyright owner + or by an individual or Legal Entity authorized to submit on behalf of + the copyright owner. For the purposes of this definition, "submitted" + means any form of electronic, verbal, or written communication sent + to the Licensor or its representatives, including but not limited to + communication on electronic mailing lists, source code control systems, + and issue tracking systems that are managed by, or on behalf of, the + Licensor for the purpose of discussing and improving the Work, but + excluding communication that is conspicuously marked or otherwise + designated in writing by the copyright owner as "Not a Contribution." + + "Contributor" shall mean Licensor and any individual or Legal Entity + on behalf of whom a Contribution has been received by Licensor and + subsequently incorporated within the Work. + + 2. Grant of Copyright License. Subject to the terms and conditions of + this License, each Contributor hereby grants to You a perpetual, + worldwide, non-exclusive, no-charge, royalty-free, irrevocable + copyright license to reproduce, prepare Derivative Works of, + publicly display, publicly perform, sublicense, and distribute the + Work and such Derivative Works in Source or Object form. + + 3. Grant of Patent License. Subject to the terms and conditions of + this License, each Contributor hereby grants to You a perpetual, + worldwide, non-exclusive, no-charge, royalty-free, irrevocable + (except as stated in this section) patent license to make, have made, + use, offer to sell, sell, import, and otherwise transfer the Work, + where such license applies only to those patent claims licensable + by such Contributor that are necessarily infringed by their + Contribution(s) alone or by combination of their Contribution(s) + with the Work to which such Contribution(s) was submitted. If You + institute patent litigation against any entity (including a + cross-claim or counterclaim in a lawsuit) alleging that the Work + or a Contribution incorporated within the Work constitutes direct + or contributory patent infringement, then any patent licenses + granted to You under this License for that Work shall terminate + as of the date such litigation is filed. + + 4. Redistribution. You may reproduce and distribute copies of the + Work or Derivative Works thereof in any medium, with or without + modifications, and in Source or Object form, provided that You + meet the following conditions: + + (a) You must give any other recipients of the Work or + Derivative Works a copy of this License; and + + (b) You must cause any modified files to carry prominent notices + stating that You changed the files; and + + (c) You must retain, in the Source form of any Derivative Works + that You distribute, all copyright, patent, trademark, and + attribution notices from the Source form of the Work, + excluding those notices that do not pertain to any part of + the Derivative Works; and + + (d) If the Work includes a "NOTICE" text file as part of its + distribution, then any Derivative Works that You distribute must + include a readable copy of the attribution notices contained + within such NOTICE file, excluding those notices that do not + pertain to any part of the Derivative Works, in at least one + of the following places: within a NOTICE text file distributed + as part of the Derivative Works; within the Source form or + documentation, if provided along with the Derivative Works; or, + within a display generated by the Derivative Works, if and + wherever such third-party notices normally appear. The contents + of the NOTICE file are for informational purposes only and + do not modify the License. You may add Your own attribution + notices within Derivative Works that You distribute, alongside + or as an addendum to the NOTICE text from the Work, provided + that such additional attribution notices cannot be construed + as modifying the License. + + You may add Your own copyright statement to Your modifications and + may provide additional or different license terms and conditions + for use, reproduction, or distribution of Your modifications, or + for any such Derivative Works as a whole, provided Your use, + reproduction, and distribution of the Work otherwise complies with + the conditions stated in this License. + + 5. Submission of Contributions. Unless You explicitly state otherwise, + any Contribution intentionally submitted for inclusion in the Work + by You to the Licensor shall be under the terms and conditions of + this License, without any additional terms or conditions. + Notwithstanding the above, nothing herein shall supersede or modify + the terms of any separate license agreement you may have executed + with Licensor regarding such Contributions. + + 6. Trademarks. This License does not grant permission to use the trade + names, trademarks, service marks, or product names of the Licensor, + except as required for reasonable and customary use in describing the + origin of the Work and reproducing the content of the NOTICE file. + + 7. Disclaimer of Warranty. Unless required by applicable law or + agreed to in writing, Licensor provides the Work (and each + Contributor provides its Contributions) on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or + implied, including, without limitation, any warranties or conditions + of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A + PARTICULAR PURPOSE. You are solely responsible for determining the + appropriateness of using or redistributing the Work and assume any + risks associated with Your exercise of permissions under this License. + + 8. Limitation of Liability. In no event and under no legal theory, + whether in tort (including negligence), contract, or otherwise, + unless required by applicable law (such as deliberate and grossly + negligent acts) or agreed to in writing, shall any Contributor be + liable to You for damages, including any direct, indirect, special, + incidental, or consequential damages of any character arising as a + result of this License or out of the use or inability to use the + Work (including but not limited to damages for loss of goodwill, + work stoppage, computer failure or malfunction, or any and all + other commercial damages or losses), even if such Contributor + has been advised of the possibility of such damages. + + 9. Accepting Warranty or Additional Liability. While redistributing + the Work or Derivative Works thereof, You may choose to offer, + and charge a fee for, acceptance of support, warranty, indemnity, + or other liability obligations and/or rights consistent with this + License. However, in accepting such obligations, You may act only + on Your own behalf and on Your sole responsibility, not on behalf + of any other Contributor, and only if You agree to indemnify, + defend, and hold each Contributor harmless for any liability + incurred by, or claims asserted against, such Contributor by reason + of your accepting any such warranty or additional liability. + + END OF TERMS AND CONDITIONS + + APPENDIX: How to apply the Apache License to your work. + + To apply the Apache License to your work, attach the following + boilerplate notice, with the fields enclosed by brackets "{}" + replaced with your own identifying information. (Don't include + the brackets!) The text should be enclosed in the appropriate + comment syntax for the file format. We also recommend that a + file or class name and description of purpose be included on the + same "printed page" as the copyright notice for easier + identification within third-party archives. + + Copyright {yyyy} {name of copyright owner} + + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. + diff --git a/GkeRecommender/README.md b/GkeRecommender/README.md new file mode 100644 index 00000000000..cc36925f66a --- /dev/null +++ b/GkeRecommender/README.md @@ -0,0 +1,76 @@ +# Google Cloud Gke Recommender for PHP + +> Idiomatic PHP client for [Google Cloud Gke Recommender](https://cloud.google.com/kubernetes-engine). + +[![Latest Stable Version](https://poser.pugx.org/google/cloud-gkerecommender/v/stable)](https://packagist.org/packages/google/cloud-gkerecommender) [![Packagist](https://img.shields.io/packagist/dm/google/cloud-gkerecommender.svg)](https://packagist.org/packages/google/cloud-gkerecommender) + +* [API documentation](https://cloud.google.com/php/docs/reference/cloud-gkerecommender/latest) + +**NOTE:** This repository is part of [Google Cloud PHP](https://github.com/googleapis/google-cloud-php). Any +support requests, bug reports, or development contributions should be directed to +that project. + +### Installation + +To begin, install the preferred dependency manager for PHP, [Composer](https://getcomposer.org/). + +Now, install this component: + +```sh +$ composer require google/cloud-gkerecommender +``` + +> Browse the complete list of [Google Cloud APIs](https://cloud.google.com/php/docs/reference) +> for PHP + +This component supports both REST over HTTP/1.1 and gRPC. In order to take advantage of the benefits +offered by gRPC (such as streaming methods) please see our +[gRPC installation guide](https://cloud.google.com/php/grpc). + +### Authentication + +Please see our [Authentication guide](https://github.com/googleapis/google-cloud-php/blob/main/AUTHENTICATION.md) for more information +on authenticating your client. Once authenticated, you'll be ready to start making requests. + +### Sample + +```php +use Google\ApiCore\ApiException; +use Google\ApiCore\PagedListResponse; +use Google\Cloud\GkeRecommender\V1\Client\GkeInferenceQuickstartClient; +use Google\Cloud\GkeRecommender\V1\FetchModelsRequest; + +// Create a client. +$gkeInferenceQuickstartClient = new GkeInferenceQuickstartClient(); + +// Prepare the request message. +$request = new FetchModelsRequest(); + +// Call the API and handle any network failures. +try { + /** @var PagedListResponse $response */ + $response = $gkeInferenceQuickstartClient->fetchModels($request); + + /** @var string $element */ + foreach ($response as $element) { + printf('Element data: %s' . PHP_EOL, $element); + } +} catch (ApiException $ex) { + printf('Call failed with message: %s' . PHP_EOL, $ex->getMessage()); +} +``` + +See the [samples directory](https://github.com/googleapis/google-cloud-php-gkerecommender/tree/main/samples) for a canonical list of samples. + +### Debugging + +Please see our [Debugging guide](https://github.com/googleapis/google-cloud-php/blob/main/DEBUG.md) +for more information about the debugging tools. + +### Version + +This component is considered alpha. As such, it is still a work-in-progress and is more likely to get backwards-incompatible updates. + +### Next Steps + +1. Understand the [official documentation](https://cloud.google.com/kubernetes-engine/docs/how-to/machine-learning/inference-quickstart). diff --git a/GkeRecommender/VERSION b/GkeRecommender/VERSION new file mode 100644 index 00000000000..77d6f4ca237 --- /dev/null +++ b/GkeRecommender/VERSION @@ -0,0 +1 @@ +0.0.0 diff --git a/GkeRecommender/composer.json b/GkeRecommender/composer.json new file mode 100644 index 00000000000..09b670c42de --- /dev/null +++ b/GkeRecommender/composer.json @@ -0,0 +1,30 @@ +{ + "name": "google/cloud-gkerecommender", + "description": "Google Cloud Gke Recommender Client for PHP", + "license": "Apache-2.0", + "minimum-stability": "stable", + "autoload": { + "psr-4": { + "Google\\Cloud\\GkeRecommender\\": "src", + "GPBMetadata\\Google\\Cloud\\Gkerecommender\\": "metadata" + } + }, + "extra": { + "component": { + "id": "cloud-gkerecommender", + "path": "GkeRecommender", + "target": "googleapis/google-cloud-php-gkerecommender" + } + }, + "require": { + "php": "^8.1", + "google/gax": "^1.40.0" + }, + "require-dev": { + "phpunit/phpunit": "^9.0" + }, + "suggest": { + "ext-grpc": "Enables use of gRPC, a universal high-performance RPC framework created by Google.", + "ext-protobuf": "Provides a significant increase in throughput over the pure PHP protobuf implementation. See https://cloud.google.com/php/grpc for installation instructions." + } +} diff --git a/GkeRecommender/metadata/V1/Gkerecommender.php b/GkeRecommender/metadata/V1/Gkerecommender.php new file mode 100644 index 00000000000..6c9cf5de195 Binary files /dev/null and b/GkeRecommender/metadata/V1/Gkerecommender.php differ diff --git a/GkeRecommender/owlbot.py b/GkeRecommender/owlbot.py new file mode 100644 index 00000000000..ebf10f220ad --- /dev/null +++ b/GkeRecommender/owlbot.py @@ -0,0 +1,56 @@ +# Copyright 2024 Google LLC +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +"""This script is used to synthesize generated parts of this library.""" + +import logging +from pathlib import Path +import subprocess + +import synthtool as s +from synthtool.languages import php +from synthtool import _tracked_paths + +logging.basicConfig(level=logging.DEBUG) + +src = Path(f"../{php.STAGING_DIR}/GkeRecommender").resolve() +dest = Path().resolve() + +# Added so that we can pass copy_excludes in the owlbot_main() call +_tracked_paths.add(src) + +php.owlbot_main(src=src, dest=dest) + +# remove class_alias code +s.replace( + "src/V*/**/*.php", + r"^// Adding a class alias for backwards compatibility with the previous class name.$" + + "\n" + + r"^class_alias\(.*\);$" + + "\n", + '') + +# format generated clients +subprocess.run([ + 'npm', + 'exec', + '--yes', + '--package=@prettier/plugin-php@^0.19', + '--', + 'prettier', + '**/Client/*', + '--write', + '--parser=php', + '--single-quote', + '--print-width=120']) diff --git a/GkeRecommender/phpunit.xml.dist b/GkeRecommender/phpunit.xml.dist new file mode 100644 index 00000000000..f302d56f6c5 --- /dev/null +++ b/GkeRecommender/phpunit.xml.dist @@ -0,0 +1,16 @@ + + + + + src + + + src/V[!a-zA-Z]* + + + + + tests/Unit + + + diff --git a/GkeRecommender/samples/V1/GkeInferenceQuickstartClient/fetch_benchmarking_data.php b/GkeRecommender/samples/V1/GkeInferenceQuickstartClient/fetch_benchmarking_data.php new file mode 100644 index 00000000000..a088c9f8075 --- /dev/null +++ b/GkeRecommender/samples/V1/GkeInferenceQuickstartClient/fetch_benchmarking_data.php @@ -0,0 +1,86 @@ +setModel($modelServerInfoModel) + ->setModelServer($modelServerInfoModelServer); + $request = (new FetchBenchmarkingDataRequest()) + ->setModelServerInfo($modelServerInfo); + + // Call the API and handle any network failures. + try { + /** @var FetchBenchmarkingDataResponse $response */ + $response = $gkeInferenceQuickstartClient->fetchBenchmarkingData($request); + printf('Response data: %s' . PHP_EOL, $response->serializeToJsonString()); + } catch (ApiException $ex) { + printf('Call failed with message: %s' . PHP_EOL, $ex->getMessage()); + } +} + +/** + * Helper to execute the sample. + * + * This sample has been automatically generated and should be regarded as a code + * template only. It will require modifications to work: + * - It may require correct/in-range values for request initialization. + * - It may require specifying regional endpoints when creating the service client, + * please see the apiEndpoint client configuration option for more details. + */ +function callSample(): void +{ + $modelServerInfoModel = '[MODEL]'; + $modelServerInfoModelServer = '[MODEL_SERVER]'; + + fetch_benchmarking_data_sample($modelServerInfoModel, $modelServerInfoModelServer); +} +// [END gkerecommender_v1_generated_GkeInferenceQuickstart_FetchBenchmarkingData_sync] diff --git a/GkeRecommender/samples/V1/GkeInferenceQuickstartClient/fetch_model_server_versions.php b/GkeRecommender/samples/V1/GkeInferenceQuickstartClient/fetch_model_server_versions.php new file mode 100644 index 00000000000..56f984b97b9 --- /dev/null +++ b/GkeRecommender/samples/V1/GkeInferenceQuickstartClient/fetch_model_server_versions.php @@ -0,0 +1,89 @@ +setModel($model) + ->setModelServer($modelServer); + + // Call the API and handle any network failures. + try { + /** @var PagedListResponse $response */ + $response = $gkeInferenceQuickstartClient->fetchModelServerVersions($request); + + /** @var string $element */ + foreach ($response as $element) { + printf('Element data: %s' . PHP_EOL, $element); + } + } catch (ApiException $ex) { + printf('Call failed with message: %s' . PHP_EOL, $ex->getMessage()); + } +} + +/** + * Helper to execute the sample. + * + * This sample has been automatically generated and should be regarded as a code + * template only. It will require modifications to work: + * - It may require correct/in-range values for request initialization. + * - It may require specifying regional endpoints when creating the service client, + * please see the apiEndpoint client configuration option for more details. + */ +function callSample(): void +{ + $model = '[MODEL]'; + $modelServer = '[MODEL_SERVER]'; + + fetch_model_server_versions_sample($model, $modelServer); +} +// [END gkerecommender_v1_generated_GkeInferenceQuickstart_FetchModelServerVersions_sync] diff --git a/GkeRecommender/samples/V1/GkeInferenceQuickstartClient/fetch_model_servers.php b/GkeRecommender/samples/V1/GkeInferenceQuickstartClient/fetch_model_servers.php new file mode 100644 index 00000000000..b75d2768fc2 --- /dev/null +++ b/GkeRecommender/samples/V1/GkeInferenceQuickstartClient/fetch_model_servers.php @@ -0,0 +1,78 @@ +setModel($model); + + // Call the API and handle any network failures. + try { + /** @var PagedListResponse $response */ + $response = $gkeInferenceQuickstartClient->fetchModelServers($request); + + /** @var string $element */ + foreach ($response as $element) { + printf('Element data: %s' . PHP_EOL, $element); + } + } catch (ApiException $ex) { + printf('Call failed with message: %s' . PHP_EOL, $ex->getMessage()); + } +} + +/** + * Helper to execute the sample. + * + * This sample has been automatically generated and should be regarded as a code + * template only. It will require modifications to work: + * - It may require correct/in-range values for request initialization. + * - It may require specifying regional endpoints when creating the service client, + * please see the apiEndpoint client configuration option for more details. + */ +function callSample(): void +{ + $model = '[MODEL]'; + + fetch_model_servers_sample($model); +} +// [END gkerecommender_v1_generated_GkeInferenceQuickstart_FetchModelServers_sync] diff --git a/GkeRecommender/samples/V1/GkeInferenceQuickstartClient/fetch_models.php b/GkeRecommender/samples/V1/GkeInferenceQuickstartClient/fetch_models.php new file mode 100644 index 00000000000..1ff94462f7b --- /dev/null +++ b/GkeRecommender/samples/V1/GkeInferenceQuickstartClient/fetch_models.php @@ -0,0 +1,62 @@ +fetchModels($request); + + /** @var string $element */ + foreach ($response as $element) { + printf('Element data: %s' . PHP_EOL, $element); + } + } catch (ApiException $ex) { + printf('Call failed with message: %s' . PHP_EOL, $ex->getMessage()); + } +} +// [END gkerecommender_v1_generated_GkeInferenceQuickstart_FetchModels_sync] diff --git a/GkeRecommender/samples/V1/GkeInferenceQuickstartClient/fetch_profiles.php b/GkeRecommender/samples/V1/GkeInferenceQuickstartClient/fetch_profiles.php new file mode 100644 index 00000000000..ab904a6de2a --- /dev/null +++ b/GkeRecommender/samples/V1/GkeInferenceQuickstartClient/fetch_profiles.php @@ -0,0 +1,72 @@ +fetchProfiles($request); + + /** @var Profile $element */ + foreach ($response as $element) { + printf('Element data: %s' . PHP_EOL, $element->serializeToJsonString()); + } + } catch (ApiException $ex) { + printf('Call failed with message: %s' . PHP_EOL, $ex->getMessage()); + } +} +// [END gkerecommender_v1_generated_GkeInferenceQuickstart_FetchProfiles_sync] diff --git a/GkeRecommender/samples/V1/GkeInferenceQuickstartClient/generate_optimized_manifest.php b/GkeRecommender/samples/V1/GkeInferenceQuickstartClient/generate_optimized_manifest.php new file mode 100644 index 00000000000..eb2de2d398f --- /dev/null +++ b/GkeRecommender/samples/V1/GkeInferenceQuickstartClient/generate_optimized_manifest.php @@ -0,0 +1,99 @@ +setModel($modelServerInfoModel) + ->setModelServer($modelServerInfoModelServer); + $request = (new GenerateOptimizedManifestRequest()) + ->setModelServerInfo($modelServerInfo) + ->setAcceleratorType($acceleratorType); + + // Call the API and handle any network failures. + try { + /** @var GenerateOptimizedManifestResponse $response */ + $response = $gkeInferenceQuickstartClient->generateOptimizedManifest($request); + printf('Response data: %s' . PHP_EOL, $response->serializeToJsonString()); + } catch (ApiException $ex) { + printf('Call failed with message: %s' . PHP_EOL, $ex->getMessage()); + } +} + +/** + * Helper to execute the sample. + * + * This sample has been automatically generated and should be regarded as a code + * template only. It will require modifications to work: + * - It may require correct/in-range values for request initialization. + * - It may require specifying regional endpoints when creating the service client, + * please see the apiEndpoint client configuration option for more details. + */ +function callSample(): void +{ + $modelServerInfoModel = '[MODEL]'; + $modelServerInfoModelServer = '[MODEL_SERVER]'; + $acceleratorType = '[ACCELERATOR_TYPE]'; + + generate_optimized_manifest_sample( + $modelServerInfoModel, + $modelServerInfoModelServer, + $acceleratorType + ); +} +// [END gkerecommender_v1_generated_GkeInferenceQuickstart_GenerateOptimizedManifest_sync] diff --git a/GkeRecommender/src/V1/Amount.php b/GkeRecommender/src/V1/Amount.php new file mode 100644 index 00000000000..b4c6a727d46 --- /dev/null +++ b/GkeRecommender/src/V1/Amount.php @@ -0,0 +1,125 @@ +google.cloud.gkerecommender.v1.Amount + */ +class Amount extends \Google\Protobuf\Internal\Message +{ + /** + * Output only. The whole units of the amount. + * For example if `currencyCode` is `"USD"`, then 1 unit is one US dollar. + * + * Generated from protobuf field int64 units = 1 [(.google.api.field_behavior) = OUTPUT_ONLY]; + */ + protected $units = 0; + /** + * Output only. Number of nano (10^-9) units of the amount. + * The value must be between -999,999,999 and +999,999,999 inclusive. + * If `units` is positive, `nanos` must be positive or zero. + * If `units` is zero, `nanos` can be positive, zero, or negative. + * If `units` is negative, `nanos` must be negative or zero. + * For example $-1.75 is represented as `units`=-1 and `nanos`=-750,000,000. + * + * Generated from protobuf field int32 nanos = 2 [(.google.api.field_behavior) = OUTPUT_ONLY]; + */ + protected $nanos = 0; + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type int|string $units + * Output only. The whole units of the amount. + * For example if `currencyCode` is `"USD"`, then 1 unit is one US dollar. + * @type int $nanos + * Output only. Number of nano (10^-9) units of the amount. + * The value must be between -999,999,999 and +999,999,999 inclusive. + * If `units` is positive, `nanos` must be positive or zero. + * If `units` is zero, `nanos` can be positive, zero, or negative. + * If `units` is negative, `nanos` must be negative or zero. + * For example $-1.75 is represented as `units`=-1 and `nanos`=-750,000,000. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Cloud\Gkerecommender\V1\Gkerecommender::initOnce(); + parent::__construct($data); + } + + /** + * Output only. The whole units of the amount. + * For example if `currencyCode` is `"USD"`, then 1 unit is one US dollar. + * + * Generated from protobuf field int64 units = 1 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * @return int|string + */ + public function getUnits() + { + return $this->units; + } + + /** + * Output only. The whole units of the amount. + * For example if `currencyCode` is `"USD"`, then 1 unit is one US dollar. + * + * Generated from protobuf field int64 units = 1 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * @param int|string $var + * @return $this + */ + public function setUnits($var) + { + GPBUtil::checkInt64($var); + $this->units = $var; + + return $this; + } + + /** + * Output only. Number of nano (10^-9) units of the amount. + * The value must be between -999,999,999 and +999,999,999 inclusive. + * If `units` is positive, `nanos` must be positive or zero. + * If `units` is zero, `nanos` can be positive, zero, or negative. + * If `units` is negative, `nanos` must be negative or zero. + * For example $-1.75 is represented as `units`=-1 and `nanos`=-750,000,000. + * + * Generated from protobuf field int32 nanos = 2 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * @return int + */ + public function getNanos() + { + return $this->nanos; + } + + /** + * Output only. Number of nano (10^-9) units of the amount. + * The value must be between -999,999,999 and +999,999,999 inclusive. + * If `units` is positive, `nanos` must be positive or zero. + * If `units` is zero, `nanos` can be positive, zero, or negative. + * If `units` is negative, `nanos` must be negative or zero. + * For example $-1.75 is represented as `units`=-1 and `nanos`=-750,000,000. + * + * Generated from protobuf field int32 nanos = 2 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * @param int $var + * @return $this + */ + public function setNanos($var) + { + GPBUtil::checkInt32($var); + $this->nanos = $var; + + return $this; + } + +} + diff --git a/GkeRecommender/src/V1/Client/GkeInferenceQuickstartClient.php b/GkeRecommender/src/V1/Client/GkeInferenceQuickstartClient.php new file mode 100644 index 00000000000..2af07afa7a9 --- /dev/null +++ b/GkeRecommender/src/V1/Client/GkeInferenceQuickstartClient.php @@ -0,0 +1,383 @@ + fetchBenchmarkingDataAsync(FetchBenchmarkingDataRequest $request, array $optionalArgs = []) + * @method PromiseInterface fetchModelServerVersionsAsync(FetchModelServerVersionsRequest $request, array $optionalArgs = []) + * @method PromiseInterface fetchModelServersAsync(FetchModelServersRequest $request, array $optionalArgs = []) + * @method PromiseInterface fetchModelsAsync(FetchModelsRequest $request, array $optionalArgs = []) + * @method PromiseInterface fetchProfilesAsync(FetchProfilesRequest $request, array $optionalArgs = []) + * @method PromiseInterface generateOptimizedManifestAsync(GenerateOptimizedManifestRequest $request, array $optionalArgs = []) + */ +final class GkeInferenceQuickstartClient +{ + use GapicClientTrait; + + /** The name of the service. */ + private const SERVICE_NAME = 'google.cloud.gkerecommender.v1.GkeInferenceQuickstart'; + + /** + * The default address of the service. + * + * @deprecated SERVICE_ADDRESS_TEMPLATE should be used instead. + */ + private const SERVICE_ADDRESS = 'gkerecommender.googleapis.com'; + + /** The address template of the service. */ + private const SERVICE_ADDRESS_TEMPLATE = 'gkerecommender.UNIVERSE_DOMAIN'; + + /** The default port of the service. */ + private const DEFAULT_SERVICE_PORT = 443; + + /** The name of the code generator, to be included in the agent header. */ + private const CODEGEN_NAME = 'gapic'; + + /** The default scopes required by the service. */ + public static $serviceScopes = ['https://www.googleapis.com/auth/cloud-platform']; + + private static function getClientDefaults() + { + return [ + 'serviceName' => self::SERVICE_NAME, + 'apiEndpoint' => self::SERVICE_ADDRESS . ':' . self::DEFAULT_SERVICE_PORT, + 'clientConfig' => __DIR__ . '/../resources/gke_inference_quickstart_client_config.json', + 'descriptorsConfigPath' => __DIR__ . '/../resources/gke_inference_quickstart_descriptor_config.php', + 'gcpApiConfigPath' => __DIR__ . '/../resources/gke_inference_quickstart_grpc_config.json', + 'credentialsConfig' => [ + 'defaultScopes' => self::$serviceScopes, + ], + 'transportConfig' => [ + 'rest' => [ + 'restClientConfigPath' => __DIR__ . '/../resources/gke_inference_quickstart_rest_client_config.php', + ], + ], + ]; + } + + /** + * Constructor. + * + * @param array|ClientOptions $options { + * Optional. Options for configuring the service API wrapper. + * + * @type string $apiEndpoint + * The address of the API remote host. May optionally include the port, formatted + * as ":". Default 'gkerecommender.googleapis.com:443'. + * @type FetchAuthTokenInterface|CredentialsWrapper $credentials + * This option should only be used with a pre-constructed + * {@see FetchAuthTokenInterface} or {@see CredentialsWrapper} object. Note that + * when one of these objects are provided, any settings in $credentialsConfig will + * be ignored. + * **Important**: If you are providing a path to a credentials file, or a decoded + * credentials file as a PHP array, this usage is now DEPRECATED. Providing an + * unvalidated credential configuration to Google APIs can compromise the security + * of your systems and data. It is recommended to create the credentials explicitly + * ``` + * use Google\Auth\Credentials\ServiceAccountCredentials; + * use Google\Cloud\GkeRecommender\V1\GkeInferenceQuickstartClient; + * $creds = new ServiceAccountCredentials($scopes, $json); + * $options = new GkeInferenceQuickstartClient(['credentials' => $creds]); + * ``` + * {@see + * https://cloud.google.com/docs/authentication/external/externally-sourced-credentials} + * @type array $credentialsConfig + * Options used to configure credentials, including auth token caching, for the + * client. For a full list of supporting configuration options, see + * {@see \Google\ApiCore\CredentialsWrapper::build()} . + * @type bool $disableRetries + * Determines whether or not retries defined by the client configuration should be + * disabled. Defaults to `false`. + * @type string|array $clientConfig + * Client method configuration, including retry settings. This option can be either + * a path to a JSON file, or a PHP array containing the decoded JSON data. By + * default this settings points to the default client config file, which is + * provided in the resources folder. + * @type string|TransportInterface $transport + * The transport used for executing network requests. May be either the string + * `rest` or `grpc`. Defaults to `grpc` if gRPC support is detected on the system. + * *Advanced usage*: Additionally, it is possible to pass in an already + * instantiated {@see \Google\ApiCore\Transport\TransportInterface} object. Note + * that when this object is provided, any settings in $transportConfig, and any + * $apiEndpoint setting, will be ignored. + * @type array $transportConfig + * Configuration options that will be used to construct the transport. Options for + * each supported transport type should be passed in a key for that transport. For + * example: + * $transportConfig = [ + * 'grpc' => [...], + * 'rest' => [...], + * ]; + * See the {@see \Google\ApiCore\Transport\GrpcTransport::build()} and + * {@see \Google\ApiCore\Transport\RestTransport::build()} methods for the + * supported options. + * @type callable $clientCertSource + * A callable which returns the client cert as a string. This can be used to + * provide a certificate and private key to the transport layer for mTLS. + * @type false|LoggerInterface $logger + * A PSR-3 compliant logger. If set to false, logging is disabled, ignoring the + * 'GOOGLE_SDK_PHP_LOGGING' environment flag + * @type string $universeDomain + * The service domain for the client. Defaults to 'googleapis.com'. + * } + * + * @throws ValidationException + */ + public function __construct(array|ClientOptions $options = []) + { + $clientOptions = $this->buildClientOptions($options); + $this->setClientOptions($clientOptions); + } + + /** Handles execution of the async variants for each documented method. */ + public function __call($method, $args) + { + if (substr($method, -5) !== 'Async') { + trigger_error('Call to undefined method ' . __CLASS__ . "::$method()", E_USER_ERROR); + } + + array_unshift($args, substr($method, 0, -5)); + return call_user_func_array([$this, 'startAsyncCall'], $args); + } + + /** + * Fetches all of the benchmarking data available for a profile. Benchmarking + * data returns all of the performance metrics available for a given model + * server setup on a given instance type. + * + * The async variant is + * {@see GkeInferenceQuickstartClient::fetchBenchmarkingDataAsync()} . + * + * @example samples/V1/GkeInferenceQuickstartClient/fetch_benchmarking_data.php + * + * @param FetchBenchmarkingDataRequest $request A request to house fields associated with the call. + * @param array $callOptions { + * Optional. + * + * @type RetrySettings|array $retrySettings + * Retry settings to use for this call. Can be a {@see RetrySettings} object, or an + * associative array of retry settings parameters. See the documentation on + * {@see RetrySettings} for example usage. + * } + * + * @return FetchBenchmarkingDataResponse + * + * @throws ApiException Thrown if the API call fails. + */ + public function fetchBenchmarkingData( + FetchBenchmarkingDataRequest $request, + array $callOptions = [] + ): FetchBenchmarkingDataResponse { + return $this->startApiCall('FetchBenchmarkingData', $request, $callOptions)->wait(); + } + + /** + * Fetches available model server versions. Open-source servers use their own + * versioning schemas (e.g., `vllm` uses semver like `v1.0.0`). + * + * Some model servers have different versioning schemas depending on the + * accelerator. For example, `vllm` uses semver on GPUs, but returns nightly + * build tags on TPUs. All available versions will be returned when different + * schemas are present. + * + * The async variant is + * {@see GkeInferenceQuickstartClient::fetchModelServerVersionsAsync()} . + * + * @example samples/V1/GkeInferenceQuickstartClient/fetch_model_server_versions.php + * + * @param FetchModelServerVersionsRequest $request A request to house fields associated with the call. + * @param array $callOptions { + * Optional. + * + * @type RetrySettings|array $retrySettings + * Retry settings to use for this call. Can be a {@see RetrySettings} object, or an + * associative array of retry settings parameters. See the documentation on + * {@see RetrySettings} for example usage. + * } + * + * @return PagedListResponse + * + * @throws ApiException Thrown if the API call fails. + */ + public function fetchModelServerVersions( + FetchModelServerVersionsRequest $request, + array $callOptions = [] + ): PagedListResponse { + return $this->startApiCall('FetchModelServerVersions', $request, $callOptions); + } + + /** + * Fetches available model servers. Open-source model servers use simplified, + * lowercase names (e.g., `vllm`). + * + * The async variant is + * {@see GkeInferenceQuickstartClient::fetchModelServersAsync()} . + * + * @example samples/V1/GkeInferenceQuickstartClient/fetch_model_servers.php + * + * @param FetchModelServersRequest $request A request to house fields associated with the call. + * @param array $callOptions { + * Optional. + * + * @type RetrySettings|array $retrySettings + * Retry settings to use for this call. Can be a {@see RetrySettings} object, or an + * associative array of retry settings parameters. See the documentation on + * {@see RetrySettings} for example usage. + * } + * + * @return PagedListResponse + * + * @throws ApiException Thrown if the API call fails. + */ + public function fetchModelServers(FetchModelServersRequest $request, array $callOptions = []): PagedListResponse + { + return $this->startApiCall('FetchModelServers', $request, $callOptions); + } + + /** + * Fetches available models. Open-source models follow the Huggingface Hub + * `owner/model_name` format. + * + * The async variant is {@see GkeInferenceQuickstartClient::fetchModelsAsync()} . + * + * @example samples/V1/GkeInferenceQuickstartClient/fetch_models.php + * + * @param FetchModelsRequest $request A request to house fields associated with the call. + * @param array $callOptions { + * Optional. + * + * @type RetrySettings|array $retrySettings + * Retry settings to use for this call. Can be a {@see RetrySettings} object, or an + * associative array of retry settings parameters. See the documentation on + * {@see RetrySettings} for example usage. + * } + * + * @return PagedListResponse + * + * @throws ApiException Thrown if the API call fails. + */ + public function fetchModels(FetchModelsRequest $request, array $callOptions = []): PagedListResponse + { + return $this->startApiCall('FetchModels', $request, $callOptions); + } + + /** + * Fetches available profiles. A profile contains performance metrics and + * cost information for a specific model server setup. Profiles can be + * filtered by parameters. If no filters are provided, all profiles are + * returned. + * + * Profiles display a single value per performance metric based on the + * provided performance requirements. If no requirements are given, the + * metrics represent the inflection point. See [Run best practice inference + * with GKE Inference Quickstart + * recipes](https://cloud.google.com/kubernetes-engine/docs/how-to/machine-learning/inference/inference-quickstart#how) + * for details. + * + * The async variant is {@see GkeInferenceQuickstartClient::fetchProfilesAsync()} . + * + * @example samples/V1/GkeInferenceQuickstartClient/fetch_profiles.php + * + * @param FetchProfilesRequest $request A request to house fields associated with the call. + * @param array $callOptions { + * Optional. + * + * @type RetrySettings|array $retrySettings + * Retry settings to use for this call. Can be a {@see RetrySettings} object, or an + * associative array of retry settings parameters. See the documentation on + * {@see RetrySettings} for example usage. + * } + * + * @return PagedListResponse + * + * @throws ApiException Thrown if the API call fails. + */ + public function fetchProfiles(FetchProfilesRequest $request, array $callOptions = []): PagedListResponse + { + return $this->startApiCall('FetchProfiles', $request, $callOptions); + } + + /** + * Generates an optimized deployment manifest for a given model and model + * server, based on the specified accelerator, performance targets, and + * configurations. See [Run best practice inference with GKE Inference + * Quickstart + * recipes](https://cloud.google.com/kubernetes-engine/docs/how-to/machine-learning/inference/inference-quickstart) + * for deployment details. + * + * The async variant is + * {@see GkeInferenceQuickstartClient::generateOptimizedManifestAsync()} . + * + * @example samples/V1/GkeInferenceQuickstartClient/generate_optimized_manifest.php + * + * @param GenerateOptimizedManifestRequest $request A request to house fields associated with the call. + * @param array $callOptions { + * Optional. + * + * @type RetrySettings|array $retrySettings + * Retry settings to use for this call. Can be a {@see RetrySettings} object, or an + * associative array of retry settings parameters. See the documentation on + * {@see RetrySettings} for example usage. + * } + * + * @return GenerateOptimizedManifestResponse + * + * @throws ApiException Thrown if the API call fails. + */ + public function generateOptimizedManifest( + GenerateOptimizedManifestRequest $request, + array $callOptions = [] + ): GenerateOptimizedManifestResponse { + return $this->startApiCall('GenerateOptimizedManifest', $request, $callOptions)->wait(); + } +} diff --git a/GkeRecommender/src/V1/Cost.php b/GkeRecommender/src/V1/Cost.php new file mode 100644 index 00000000000..62f0528444d --- /dev/null +++ b/GkeRecommender/src/V1/Cost.php @@ -0,0 +1,228 @@ +google.cloud.gkerecommender.v1.Cost + */ +class Cost extends \Google\Protobuf\Internal\Message +{ + /** + * Optional. The cost per million output tokens, calculated as: + * $/output token = GPU $/s / (1/output-to-input-cost-ratio * input tokens/s + + * output tokens/s) + * + * Generated from protobuf field .google.cloud.gkerecommender.v1.Amount cost_per_million_output_tokens = 1 [(.google.api.field_behavior) = OPTIONAL]; + */ + protected $cost_per_million_output_tokens = null; + /** + * Optional. The cost per million input tokens. $/input token = ($/output + * token) / output-to-input-cost-ratio. + * + * Generated from protobuf field .google.cloud.gkerecommender.v1.Amount cost_per_million_input_tokens = 2 [(.google.api.field_behavior) = OPTIONAL]; + */ + protected $cost_per_million_input_tokens = null; + /** + * Optional. The pricing model used to calculate the cost. Can be one of: + * `3-years-cud`, `1-year-cud`, `on-demand`, `spot`. If not provided, `spot` + * will be used. + * + * Generated from protobuf field string pricing_model = 3 [(.google.api.field_behavior) = OPTIONAL]; + */ + protected $pricing_model = ''; + /** + * Optional. The output-to-input cost ratio. This determines how the total GPU + * cost is split between input and output tokens. If not provided, `4.0` is + * used, assuming a 4:1 output:input cost ratio. + * + * Generated from protobuf field optional float output_input_cost_ratio = 4 [(.google.api.field_behavior) = OPTIONAL]; + */ + protected $output_input_cost_ratio = null; + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type \Google\Cloud\GkeRecommender\V1\Amount $cost_per_million_output_tokens + * Optional. The cost per million output tokens, calculated as: + * $/output token = GPU $/s / (1/output-to-input-cost-ratio * input tokens/s + + * output tokens/s) + * @type \Google\Cloud\GkeRecommender\V1\Amount $cost_per_million_input_tokens + * Optional. The cost per million input tokens. $/input token = ($/output + * token) / output-to-input-cost-ratio. + * @type string $pricing_model + * Optional. The pricing model used to calculate the cost. Can be one of: + * `3-years-cud`, `1-year-cud`, `on-demand`, `spot`. If not provided, `spot` + * will be used. + * @type float $output_input_cost_ratio + * Optional. The output-to-input cost ratio. This determines how the total GPU + * cost is split between input and output tokens. If not provided, `4.0` is + * used, assuming a 4:1 output:input cost ratio. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Cloud\Gkerecommender\V1\Gkerecommender::initOnce(); + parent::__construct($data); + } + + /** + * Optional. The cost per million output tokens, calculated as: + * $/output token = GPU $/s / (1/output-to-input-cost-ratio * input tokens/s + + * output tokens/s) + * + * Generated from protobuf field .google.cloud.gkerecommender.v1.Amount cost_per_million_output_tokens = 1 [(.google.api.field_behavior) = OPTIONAL]; + * @return \Google\Cloud\GkeRecommender\V1\Amount|null + */ + public function getCostPerMillionOutputTokens() + { + return $this->cost_per_million_output_tokens; + } + + public function hasCostPerMillionOutputTokens() + { + return isset($this->cost_per_million_output_tokens); + } + + public function clearCostPerMillionOutputTokens() + { + unset($this->cost_per_million_output_tokens); + } + + /** + * Optional. The cost per million output tokens, calculated as: + * $/output token = GPU $/s / (1/output-to-input-cost-ratio * input tokens/s + + * output tokens/s) + * + * Generated from protobuf field .google.cloud.gkerecommender.v1.Amount cost_per_million_output_tokens = 1 [(.google.api.field_behavior) = OPTIONAL]; + * @param \Google\Cloud\GkeRecommender\V1\Amount $var + * @return $this + */ + public function setCostPerMillionOutputTokens($var) + { + GPBUtil::checkMessage($var, \Google\Cloud\GkeRecommender\V1\Amount::class); + $this->cost_per_million_output_tokens = $var; + + return $this; + } + + /** + * Optional. The cost per million input tokens. $/input token = ($/output + * token) / output-to-input-cost-ratio. + * + * Generated from protobuf field .google.cloud.gkerecommender.v1.Amount cost_per_million_input_tokens = 2 [(.google.api.field_behavior) = OPTIONAL]; + * @return \Google\Cloud\GkeRecommender\V1\Amount|null + */ + public function getCostPerMillionInputTokens() + { + return $this->cost_per_million_input_tokens; + } + + public function hasCostPerMillionInputTokens() + { + return isset($this->cost_per_million_input_tokens); + } + + public function clearCostPerMillionInputTokens() + { + unset($this->cost_per_million_input_tokens); + } + + /** + * Optional. The cost per million input tokens. $/input token = ($/output + * token) / output-to-input-cost-ratio. + * + * Generated from protobuf field .google.cloud.gkerecommender.v1.Amount cost_per_million_input_tokens = 2 [(.google.api.field_behavior) = OPTIONAL]; + * @param \Google\Cloud\GkeRecommender\V1\Amount $var + * @return $this + */ + public function setCostPerMillionInputTokens($var) + { + GPBUtil::checkMessage($var, \Google\Cloud\GkeRecommender\V1\Amount::class); + $this->cost_per_million_input_tokens = $var; + + return $this; + } + + /** + * Optional. The pricing model used to calculate the cost. Can be one of: + * `3-years-cud`, `1-year-cud`, `on-demand`, `spot`. If not provided, `spot` + * will be used. + * + * Generated from protobuf field string pricing_model = 3 [(.google.api.field_behavior) = OPTIONAL]; + * @return string + */ + public function getPricingModel() + { + return $this->pricing_model; + } + + /** + * Optional. The pricing model used to calculate the cost. Can be one of: + * `3-years-cud`, `1-year-cud`, `on-demand`, `spot`. If not provided, `spot` + * will be used. + * + * Generated from protobuf field string pricing_model = 3 [(.google.api.field_behavior) = OPTIONAL]; + * @param string $var + * @return $this + */ + public function setPricingModel($var) + { + GPBUtil::checkString($var, True); + $this->pricing_model = $var; + + return $this; + } + + /** + * Optional. The output-to-input cost ratio. This determines how the total GPU + * cost is split between input and output tokens. If not provided, `4.0` is + * used, assuming a 4:1 output:input cost ratio. + * + * Generated from protobuf field optional float output_input_cost_ratio = 4 [(.google.api.field_behavior) = OPTIONAL]; + * @return float + */ + public function getOutputInputCostRatio() + { + return isset($this->output_input_cost_ratio) ? $this->output_input_cost_ratio : 0.0; + } + + public function hasOutputInputCostRatio() + { + return isset($this->output_input_cost_ratio); + } + + public function clearOutputInputCostRatio() + { + unset($this->output_input_cost_ratio); + } + + /** + * Optional. The output-to-input cost ratio. This determines how the total GPU + * cost is split between input and output tokens. If not provided, `4.0` is + * used, assuming a 4:1 output:input cost ratio. + * + * Generated from protobuf field optional float output_input_cost_ratio = 4 [(.google.api.field_behavior) = OPTIONAL]; + * @param float $var + * @return $this + */ + public function setOutputInputCostRatio($var) + { + GPBUtil::checkFloat($var); + $this->output_input_cost_ratio = $var; + + return $this; + } + +} + diff --git a/GkeRecommender/src/V1/FetchBenchmarkingDataRequest.php b/GkeRecommender/src/V1/FetchBenchmarkingDataRequest.php new file mode 100644 index 00000000000..d9a452787b4 --- /dev/null +++ b/GkeRecommender/src/V1/FetchBenchmarkingDataRequest.php @@ -0,0 +1,174 @@ +google.cloud.gkerecommender.v1.FetchBenchmarkingDataRequest + */ +class FetchBenchmarkingDataRequest extends \Google\Protobuf\Internal\Message +{ + /** + * Required. The model server configuration to get benchmarking data for. Use + * [GkeInferenceQuickstart.FetchProfiles][google.cloud.gkerecommender.v1.GkeInferenceQuickstart.FetchProfiles] + * to find valid configurations. + * + * Generated from protobuf field .google.cloud.gkerecommender.v1.ModelServerInfo model_server_info = 1 [(.google.api.field_behavior) = REQUIRED]; + */ + protected $model_server_info = null; + /** + * Optional. The instance type to filter benchmarking data. Instance types are + * in the format `a2-highgpu-1g`. If not provided, all instance types for the + * given profile's `model_server_info` will be returned. Use + * [GkeInferenceQuickstart.FetchProfiles][google.cloud.gkerecommender.v1.GkeInferenceQuickstart.FetchProfiles] + * to find available instance types. + * + * Generated from protobuf field string instance_type = 3 [(.google.api.field_behavior) = OPTIONAL]; + */ + protected $instance_type = ''; + /** + * Optional. The pricing model to use for the benchmarking data. Defaults to + * `spot`. + * + * Generated from protobuf field string pricing_model = 4 [(.google.api.field_behavior) = OPTIONAL]; + */ + protected $pricing_model = ''; + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type \Google\Cloud\GkeRecommender\V1\ModelServerInfo $model_server_info + * Required. The model server configuration to get benchmarking data for. Use + * [GkeInferenceQuickstart.FetchProfiles][google.cloud.gkerecommender.v1.GkeInferenceQuickstart.FetchProfiles] + * to find valid configurations. + * @type string $instance_type + * Optional. The instance type to filter benchmarking data. Instance types are + * in the format `a2-highgpu-1g`. If not provided, all instance types for the + * given profile's `model_server_info` will be returned. Use + * [GkeInferenceQuickstart.FetchProfiles][google.cloud.gkerecommender.v1.GkeInferenceQuickstart.FetchProfiles] + * to find available instance types. + * @type string $pricing_model + * Optional. The pricing model to use for the benchmarking data. Defaults to + * `spot`. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Cloud\Gkerecommender\V1\Gkerecommender::initOnce(); + parent::__construct($data); + } + + /** + * Required. The model server configuration to get benchmarking data for. Use + * [GkeInferenceQuickstart.FetchProfiles][google.cloud.gkerecommender.v1.GkeInferenceQuickstart.FetchProfiles] + * to find valid configurations. + * + * Generated from protobuf field .google.cloud.gkerecommender.v1.ModelServerInfo model_server_info = 1 [(.google.api.field_behavior) = REQUIRED]; + * @return \Google\Cloud\GkeRecommender\V1\ModelServerInfo|null + */ + public function getModelServerInfo() + { + return $this->model_server_info; + } + + public function hasModelServerInfo() + { + return isset($this->model_server_info); + } + + public function clearModelServerInfo() + { + unset($this->model_server_info); + } + + /** + * Required. The model server configuration to get benchmarking data for. Use + * [GkeInferenceQuickstart.FetchProfiles][google.cloud.gkerecommender.v1.GkeInferenceQuickstart.FetchProfiles] + * to find valid configurations. + * + * Generated from protobuf field .google.cloud.gkerecommender.v1.ModelServerInfo model_server_info = 1 [(.google.api.field_behavior) = REQUIRED]; + * @param \Google\Cloud\GkeRecommender\V1\ModelServerInfo $var + * @return $this + */ + public function setModelServerInfo($var) + { + GPBUtil::checkMessage($var, \Google\Cloud\GkeRecommender\V1\ModelServerInfo::class); + $this->model_server_info = $var; + + return $this; + } + + /** + * Optional. The instance type to filter benchmarking data. Instance types are + * in the format `a2-highgpu-1g`. If not provided, all instance types for the + * given profile's `model_server_info` will be returned. Use + * [GkeInferenceQuickstart.FetchProfiles][google.cloud.gkerecommender.v1.GkeInferenceQuickstart.FetchProfiles] + * to find available instance types. + * + * Generated from protobuf field string instance_type = 3 [(.google.api.field_behavior) = OPTIONAL]; + * @return string + */ + public function getInstanceType() + { + return $this->instance_type; + } + + /** + * Optional. The instance type to filter benchmarking data. Instance types are + * in the format `a2-highgpu-1g`. If not provided, all instance types for the + * given profile's `model_server_info` will be returned. Use + * [GkeInferenceQuickstart.FetchProfiles][google.cloud.gkerecommender.v1.GkeInferenceQuickstart.FetchProfiles] + * to find available instance types. + * + * Generated from protobuf field string instance_type = 3 [(.google.api.field_behavior) = OPTIONAL]; + * @param string $var + * @return $this + */ + public function setInstanceType($var) + { + GPBUtil::checkString($var, True); + $this->instance_type = $var; + + return $this; + } + + /** + * Optional. The pricing model to use for the benchmarking data. Defaults to + * `spot`. + * + * Generated from protobuf field string pricing_model = 4 [(.google.api.field_behavior) = OPTIONAL]; + * @return string + */ + public function getPricingModel() + { + return $this->pricing_model; + } + + /** + * Optional. The pricing model to use for the benchmarking data. Defaults to + * `spot`. + * + * Generated from protobuf field string pricing_model = 4 [(.google.api.field_behavior) = OPTIONAL]; + * @param string $var + * @return $this + */ + public function setPricingModel($var) + { + GPBUtil::checkString($var, True); + $this->pricing_model = $var; + + return $this; + } + +} + diff --git a/GkeRecommender/src/V1/FetchBenchmarkingDataResponse.php b/GkeRecommender/src/V1/FetchBenchmarkingDataResponse.php new file mode 100644 index 00000000000..84c00660eba --- /dev/null +++ b/GkeRecommender/src/V1/FetchBenchmarkingDataResponse.php @@ -0,0 +1,72 @@ +google.cloud.gkerecommender.v1.FetchBenchmarkingDataResponse + */ +class FetchBenchmarkingDataResponse extends \Google\Protobuf\Internal\Message +{ + /** + * Output only. List of profiles containing their respective benchmarking + * data. + * + * Generated from protobuf field repeated .google.cloud.gkerecommender.v1.Profile profile = 1 [(.google.api.field_behavior) = OUTPUT_ONLY]; + */ + private $profile; + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type array<\Google\Cloud\GkeRecommender\V1\Profile>|\Google\Protobuf\Internal\RepeatedField $profile + * Output only. List of profiles containing their respective benchmarking + * data. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Cloud\Gkerecommender\V1\Gkerecommender::initOnce(); + parent::__construct($data); + } + + /** + * Output only. List of profiles containing their respective benchmarking + * data. + * + * Generated from protobuf field repeated .google.cloud.gkerecommender.v1.Profile profile = 1 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * @return \Google\Protobuf\Internal\RepeatedField + */ + public function getProfile() + { + return $this->profile; + } + + /** + * Output only. List of profiles containing their respective benchmarking + * data. + * + * Generated from protobuf field repeated .google.cloud.gkerecommender.v1.Profile profile = 1 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * @param array<\Google\Cloud\GkeRecommender\V1\Profile>|\Google\Protobuf\Internal\RepeatedField $var + * @return $this + */ + public function setProfile($var) + { + $arr = GPBUtil::checkRepeatedField($var, \Google\Protobuf\Internal\GPBType::MESSAGE, \Google\Cloud\GkeRecommender\V1\Profile::class); + $this->profile = $arr; + + return $this; + } + +} + diff --git a/GkeRecommender/src/V1/FetchModelServerVersionsRequest.php b/GkeRecommender/src/V1/FetchModelServerVersionsRequest.php new file mode 100644 index 00000000000..1bace938e8c --- /dev/null +++ b/GkeRecommender/src/V1/FetchModelServerVersionsRequest.php @@ -0,0 +1,258 @@ +google.cloud.gkerecommender.v1.FetchModelServerVersionsRequest + */ +class FetchModelServerVersionsRequest extends \Google\Protobuf\Internal\Message +{ + /** + * Required. The model for which to list model server versions. Open-source + * models follow the Huggingface Hub `owner/model_name` format. Use + * [GkeInferenceQuickstart.FetchModels][google.cloud.gkerecommender.v1.GkeInferenceQuickstart.FetchModels] + * to find available models. + * + * Generated from protobuf field string model = 1 [(.google.api.field_behavior) = REQUIRED]; + */ + protected $model = ''; + /** + * Required. The model server for which to list versions. Open-source model + * servers use simplified, lowercase names (e.g., `vllm`). Use + * [GkeInferenceQuickstart.FetchModelServers][google.cloud.gkerecommender.v1.GkeInferenceQuickstart.FetchModelServers] + * to find available model servers. + * + * Generated from protobuf field string model_server = 2 [(.google.api.field_behavior) = REQUIRED]; + */ + protected $model_server = ''; + /** + * Optional. The target number of results to return in a single response. + * If not specified, a default value will be chosen by the service. + * Note that the response may include a partial list and a caller should + * only rely on the response's + * [next_page_token][google.cloud.gkerecommender.v1.FetchModelServerVersionsResponse.next_page_token] + * to determine if there are more instances left to be queried. + * + * Generated from protobuf field optional int32 page_size = 3 [(.google.api.field_behavior) = OPTIONAL]; + */ + protected $page_size = null; + /** + * Optional. The value of + * [next_page_token][google.cloud.gkerecommender.v1.FetchModelServerVersionsResponse.next_page_token] + * received from a previous `FetchModelServerVersionsRequest` call. + * Provide this to retrieve the subsequent page in a multi-page list of + * results. When paginating, all other parameters provided to + * `FetchModelServerVersionsRequest` must match the call that provided the + * page token. + * + * Generated from protobuf field optional string page_token = 4 [(.google.api.field_behavior) = OPTIONAL]; + */ + protected $page_token = null; + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type string $model + * Required. The model for which to list model server versions. Open-source + * models follow the Huggingface Hub `owner/model_name` format. Use + * [GkeInferenceQuickstart.FetchModels][google.cloud.gkerecommender.v1.GkeInferenceQuickstart.FetchModels] + * to find available models. + * @type string $model_server + * Required. The model server for which to list versions. Open-source model + * servers use simplified, lowercase names (e.g., `vllm`). Use + * [GkeInferenceQuickstart.FetchModelServers][google.cloud.gkerecommender.v1.GkeInferenceQuickstart.FetchModelServers] + * to find available model servers. + * @type int $page_size + * Optional. The target number of results to return in a single response. + * If not specified, a default value will be chosen by the service. + * Note that the response may include a partial list and a caller should + * only rely on the response's + * [next_page_token][google.cloud.gkerecommender.v1.FetchModelServerVersionsResponse.next_page_token] + * to determine if there are more instances left to be queried. + * @type string $page_token + * Optional. The value of + * [next_page_token][google.cloud.gkerecommender.v1.FetchModelServerVersionsResponse.next_page_token] + * received from a previous `FetchModelServerVersionsRequest` call. + * Provide this to retrieve the subsequent page in a multi-page list of + * results. When paginating, all other parameters provided to + * `FetchModelServerVersionsRequest` must match the call that provided the + * page token. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Cloud\Gkerecommender\V1\Gkerecommender::initOnce(); + parent::__construct($data); + } + + /** + * Required. The model for which to list model server versions. Open-source + * models follow the Huggingface Hub `owner/model_name` format. Use + * [GkeInferenceQuickstart.FetchModels][google.cloud.gkerecommender.v1.GkeInferenceQuickstart.FetchModels] + * to find available models. + * + * Generated from protobuf field string model = 1 [(.google.api.field_behavior) = REQUIRED]; + * @return string + */ + public function getModel() + { + return $this->model; + } + + /** + * Required. The model for which to list model server versions. Open-source + * models follow the Huggingface Hub `owner/model_name` format. Use + * [GkeInferenceQuickstart.FetchModels][google.cloud.gkerecommender.v1.GkeInferenceQuickstart.FetchModels] + * to find available models. + * + * Generated from protobuf field string model = 1 [(.google.api.field_behavior) = REQUIRED]; + * @param string $var + * @return $this + */ + public function setModel($var) + { + GPBUtil::checkString($var, True); + $this->model = $var; + + return $this; + } + + /** + * Required. The model server for which to list versions. Open-source model + * servers use simplified, lowercase names (e.g., `vllm`). Use + * [GkeInferenceQuickstart.FetchModelServers][google.cloud.gkerecommender.v1.GkeInferenceQuickstart.FetchModelServers] + * to find available model servers. + * + * Generated from protobuf field string model_server = 2 [(.google.api.field_behavior) = REQUIRED]; + * @return string + */ + public function getModelServer() + { + return $this->model_server; + } + + /** + * Required. The model server for which to list versions. Open-source model + * servers use simplified, lowercase names (e.g., `vllm`). Use + * [GkeInferenceQuickstart.FetchModelServers][google.cloud.gkerecommender.v1.GkeInferenceQuickstart.FetchModelServers] + * to find available model servers. + * + * Generated from protobuf field string model_server = 2 [(.google.api.field_behavior) = REQUIRED]; + * @param string $var + * @return $this + */ + public function setModelServer($var) + { + GPBUtil::checkString($var, True); + $this->model_server = $var; + + return $this; + } + + /** + * Optional. The target number of results to return in a single response. + * If not specified, a default value will be chosen by the service. + * Note that the response may include a partial list and a caller should + * only rely on the response's + * [next_page_token][google.cloud.gkerecommender.v1.FetchModelServerVersionsResponse.next_page_token] + * to determine if there are more instances left to be queried. + * + * Generated from protobuf field optional int32 page_size = 3 [(.google.api.field_behavior) = OPTIONAL]; + * @return int + */ + public function getPageSize() + { + return isset($this->page_size) ? $this->page_size : 0; + } + + public function hasPageSize() + { + return isset($this->page_size); + } + + public function clearPageSize() + { + unset($this->page_size); + } + + /** + * Optional. The target number of results to return in a single response. + * If not specified, a default value will be chosen by the service. + * Note that the response may include a partial list and a caller should + * only rely on the response's + * [next_page_token][google.cloud.gkerecommender.v1.FetchModelServerVersionsResponse.next_page_token] + * to determine if there are more instances left to be queried. + * + * Generated from protobuf field optional int32 page_size = 3 [(.google.api.field_behavior) = OPTIONAL]; + * @param int $var + * @return $this + */ + public function setPageSize($var) + { + GPBUtil::checkInt32($var); + $this->page_size = $var; + + return $this; + } + + /** + * Optional. The value of + * [next_page_token][google.cloud.gkerecommender.v1.FetchModelServerVersionsResponse.next_page_token] + * received from a previous `FetchModelServerVersionsRequest` call. + * Provide this to retrieve the subsequent page in a multi-page list of + * results. When paginating, all other parameters provided to + * `FetchModelServerVersionsRequest` must match the call that provided the + * page token. + * + * Generated from protobuf field optional string page_token = 4 [(.google.api.field_behavior) = OPTIONAL]; + * @return string + */ + public function getPageToken() + { + return isset($this->page_token) ? $this->page_token : ''; + } + + public function hasPageToken() + { + return isset($this->page_token); + } + + public function clearPageToken() + { + unset($this->page_token); + } + + /** + * Optional. The value of + * [next_page_token][google.cloud.gkerecommender.v1.FetchModelServerVersionsResponse.next_page_token] + * received from a previous `FetchModelServerVersionsRequest` call. + * Provide this to retrieve the subsequent page in a multi-page list of + * results. When paginating, all other parameters provided to + * `FetchModelServerVersionsRequest` must match the call that provided the + * page token. + * + * Generated from protobuf field optional string page_token = 4 [(.google.api.field_behavior) = OPTIONAL]; + * @param string $var + * @return $this + */ + public function setPageToken($var) + { + GPBUtil::checkString($var, True); + $this->page_token = $var; + + return $this; + } + +} + diff --git a/GkeRecommender/src/V1/FetchModelServerVersionsResponse.php b/GkeRecommender/src/V1/FetchModelServerVersionsResponse.php new file mode 100644 index 00000000000..0593f543141 --- /dev/null +++ b/GkeRecommender/src/V1/FetchModelServerVersionsResponse.php @@ -0,0 +1,118 @@ +google.cloud.gkerecommender.v1.FetchModelServerVersionsResponse + */ +class FetchModelServerVersionsResponse extends \Google\Protobuf\Internal\Message +{ + /** + * Output only. A list of available model server versions. + * + * Generated from protobuf field repeated string model_server_versions = 1 [(.google.api.field_behavior) = OUTPUT_ONLY]; + */ + private $model_server_versions; + /** + * Output only. A token which may be sent as + * [page_token][FetchModelServerVersionsResponse.page_token] in a subsequent + * `FetchModelServerVersionsResponse` call to retrieve the next page of + * results. If this field is omitted or empty, then there are no more results + * to return. + * + * Generated from protobuf field string next_page_token = 2 [(.google.api.field_behavior) = OUTPUT_ONLY]; + */ + protected $next_page_token = ''; + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type array|\Google\Protobuf\Internal\RepeatedField $model_server_versions + * Output only. A list of available model server versions. + * @type string $next_page_token + * Output only. A token which may be sent as + * [page_token][FetchModelServerVersionsResponse.page_token] in a subsequent + * `FetchModelServerVersionsResponse` call to retrieve the next page of + * results. If this field is omitted or empty, then there are no more results + * to return. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Cloud\Gkerecommender\V1\Gkerecommender::initOnce(); + parent::__construct($data); + } + + /** + * Output only. A list of available model server versions. + * + * Generated from protobuf field repeated string model_server_versions = 1 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * @return \Google\Protobuf\Internal\RepeatedField + */ + public function getModelServerVersions() + { + return $this->model_server_versions; + } + + /** + * Output only. A list of available model server versions. + * + * Generated from protobuf field repeated string model_server_versions = 1 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * @param array|\Google\Protobuf\Internal\RepeatedField $var + * @return $this + */ + public function setModelServerVersions($var) + { + $arr = GPBUtil::checkRepeatedField($var, \Google\Protobuf\Internal\GPBType::STRING); + $this->model_server_versions = $arr; + + return $this; + } + + /** + * Output only. A token which may be sent as + * [page_token][FetchModelServerVersionsResponse.page_token] in a subsequent + * `FetchModelServerVersionsResponse` call to retrieve the next page of + * results. If this field is omitted or empty, then there are no more results + * to return. + * + * Generated from protobuf field string next_page_token = 2 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * @return string + */ + public function getNextPageToken() + { + return $this->next_page_token; + } + + /** + * Output only. A token which may be sent as + * [page_token][FetchModelServerVersionsResponse.page_token] in a subsequent + * `FetchModelServerVersionsResponse` call to retrieve the next page of + * results. If this field is omitted or empty, then there are no more results + * to return. + * + * Generated from protobuf field string next_page_token = 2 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * @param string $var + * @return $this + */ + public function setNextPageToken($var) + { + GPBUtil::checkString($var, True); + $this->next_page_token = $var; + + return $this; + } + +} + diff --git a/GkeRecommender/src/V1/FetchModelServersRequest.php b/GkeRecommender/src/V1/FetchModelServersRequest.php new file mode 100644 index 00000000000..20c7f6932e3 --- /dev/null +++ b/GkeRecommender/src/V1/FetchModelServersRequest.php @@ -0,0 +1,212 @@ +google.cloud.gkerecommender.v1.FetchModelServersRequest + */ +class FetchModelServersRequest extends \Google\Protobuf\Internal\Message +{ + /** + * Required. The model for which to list model servers. Open-source models + * follow the Huggingface Hub `owner/model_name` format. Use + * [GkeInferenceQuickstart.FetchModels][google.cloud.gkerecommender.v1.GkeInferenceQuickstart.FetchModels] + * to find available models. + * + * Generated from protobuf field string model = 1 [(.google.api.field_behavior) = REQUIRED]; + */ + protected $model = ''; + /** + * Optional. The target number of results to return in a single response. + * If not specified, a default value will be chosen by the service. + * Note that the response may include a partial list and a caller should + * only rely on the response's + * [next_page_token][google.cloud.gkerecommender.v1.FetchModelServersResponse.next_page_token] + * to determine if there are more instances left to be queried. + * + * Generated from protobuf field optional int32 page_size = 2 [(.google.api.field_behavior) = OPTIONAL]; + */ + protected $page_size = null; + /** + * Optional. The value of + * [next_page_token][google.cloud.gkerecommender.v1.FetchModelServersResponse.next_page_token] + * received from a previous `FetchModelServersRequest` call. + * Provide this to retrieve the subsequent page in a multi-page list of + * results. When paginating, all other parameters provided to + * `FetchModelServersRequest` must match the call that provided the page + * token. + * + * Generated from protobuf field optional string page_token = 3 [(.google.api.field_behavior) = OPTIONAL]; + */ + protected $page_token = null; + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type string $model + * Required. The model for which to list model servers. Open-source models + * follow the Huggingface Hub `owner/model_name` format. Use + * [GkeInferenceQuickstart.FetchModels][google.cloud.gkerecommender.v1.GkeInferenceQuickstart.FetchModels] + * to find available models. + * @type int $page_size + * Optional. The target number of results to return in a single response. + * If not specified, a default value will be chosen by the service. + * Note that the response may include a partial list and a caller should + * only rely on the response's + * [next_page_token][google.cloud.gkerecommender.v1.FetchModelServersResponse.next_page_token] + * to determine if there are more instances left to be queried. + * @type string $page_token + * Optional. The value of + * [next_page_token][google.cloud.gkerecommender.v1.FetchModelServersResponse.next_page_token] + * received from a previous `FetchModelServersRequest` call. + * Provide this to retrieve the subsequent page in a multi-page list of + * results. When paginating, all other parameters provided to + * `FetchModelServersRequest` must match the call that provided the page + * token. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Cloud\Gkerecommender\V1\Gkerecommender::initOnce(); + parent::__construct($data); + } + + /** + * Required. The model for which to list model servers. Open-source models + * follow the Huggingface Hub `owner/model_name` format. Use + * [GkeInferenceQuickstart.FetchModels][google.cloud.gkerecommender.v1.GkeInferenceQuickstart.FetchModels] + * to find available models. + * + * Generated from protobuf field string model = 1 [(.google.api.field_behavior) = REQUIRED]; + * @return string + */ + public function getModel() + { + return $this->model; + } + + /** + * Required. The model for which to list model servers. Open-source models + * follow the Huggingface Hub `owner/model_name` format. Use + * [GkeInferenceQuickstart.FetchModels][google.cloud.gkerecommender.v1.GkeInferenceQuickstart.FetchModels] + * to find available models. + * + * Generated from protobuf field string model = 1 [(.google.api.field_behavior) = REQUIRED]; + * @param string $var + * @return $this + */ + public function setModel($var) + { + GPBUtil::checkString($var, True); + $this->model = $var; + + return $this; + } + + /** + * Optional. The target number of results to return in a single response. + * If not specified, a default value will be chosen by the service. + * Note that the response may include a partial list and a caller should + * only rely on the response's + * [next_page_token][google.cloud.gkerecommender.v1.FetchModelServersResponse.next_page_token] + * to determine if there are more instances left to be queried. + * + * Generated from protobuf field optional int32 page_size = 2 [(.google.api.field_behavior) = OPTIONAL]; + * @return int + */ + public function getPageSize() + { + return isset($this->page_size) ? $this->page_size : 0; + } + + public function hasPageSize() + { + return isset($this->page_size); + } + + public function clearPageSize() + { + unset($this->page_size); + } + + /** + * Optional. The target number of results to return in a single response. + * If not specified, a default value will be chosen by the service. + * Note that the response may include a partial list and a caller should + * only rely on the response's + * [next_page_token][google.cloud.gkerecommender.v1.FetchModelServersResponse.next_page_token] + * to determine if there are more instances left to be queried. + * + * Generated from protobuf field optional int32 page_size = 2 [(.google.api.field_behavior) = OPTIONAL]; + * @param int $var + * @return $this + */ + public function setPageSize($var) + { + GPBUtil::checkInt32($var); + $this->page_size = $var; + + return $this; + } + + /** + * Optional. The value of + * [next_page_token][google.cloud.gkerecommender.v1.FetchModelServersResponse.next_page_token] + * received from a previous `FetchModelServersRequest` call. + * Provide this to retrieve the subsequent page in a multi-page list of + * results. When paginating, all other parameters provided to + * `FetchModelServersRequest` must match the call that provided the page + * token. + * + * Generated from protobuf field optional string page_token = 3 [(.google.api.field_behavior) = OPTIONAL]; + * @return string + */ + public function getPageToken() + { + return isset($this->page_token) ? $this->page_token : ''; + } + + public function hasPageToken() + { + return isset($this->page_token); + } + + public function clearPageToken() + { + unset($this->page_token); + } + + /** + * Optional. The value of + * [next_page_token][google.cloud.gkerecommender.v1.FetchModelServersResponse.next_page_token] + * received from a previous `FetchModelServersRequest` call. + * Provide this to retrieve the subsequent page in a multi-page list of + * results. When paginating, all other parameters provided to + * `FetchModelServersRequest` must match the call that provided the page + * token. + * + * Generated from protobuf field optional string page_token = 3 [(.google.api.field_behavior) = OPTIONAL]; + * @param string $var + * @return $this + */ + public function setPageToken($var) + { + GPBUtil::checkString($var, True); + $this->page_token = $var; + + return $this; + } + +} + diff --git a/GkeRecommender/src/V1/FetchModelServersResponse.php b/GkeRecommender/src/V1/FetchModelServersResponse.php new file mode 100644 index 00000000000..4bb4ed0d668 --- /dev/null +++ b/GkeRecommender/src/V1/FetchModelServersResponse.php @@ -0,0 +1,122 @@ +google.cloud.gkerecommender.v1.FetchModelServersResponse + */ +class FetchModelServersResponse extends \Google\Protobuf\Internal\Message +{ + /** + * Output only. List of available model servers. Open-source model servers use + * simplified, lowercase names (e.g., `vllm`). + * + * Generated from protobuf field repeated string model_servers = 1 [(.google.api.field_behavior) = OUTPUT_ONLY]; + */ + private $model_servers; + /** + * Output only. A token which may be sent as + * [page_token][FetchModelServersResponse.page_token] in a subsequent + * `FetchModelServersResponse` call to retrieve the next page of results. + * If this field is omitted or empty, then there are no more results to + * return. + * + * Generated from protobuf field string next_page_token = 2 [(.google.api.field_behavior) = OUTPUT_ONLY]; + */ + protected $next_page_token = ''; + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type array|\Google\Protobuf\Internal\RepeatedField $model_servers + * Output only. List of available model servers. Open-source model servers use + * simplified, lowercase names (e.g., `vllm`). + * @type string $next_page_token + * Output only. A token which may be sent as + * [page_token][FetchModelServersResponse.page_token] in a subsequent + * `FetchModelServersResponse` call to retrieve the next page of results. + * If this field is omitted or empty, then there are no more results to + * return. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Cloud\Gkerecommender\V1\Gkerecommender::initOnce(); + parent::__construct($data); + } + + /** + * Output only. List of available model servers. Open-source model servers use + * simplified, lowercase names (e.g., `vllm`). + * + * Generated from protobuf field repeated string model_servers = 1 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * @return \Google\Protobuf\Internal\RepeatedField + */ + public function getModelServers() + { + return $this->model_servers; + } + + /** + * Output only. List of available model servers. Open-source model servers use + * simplified, lowercase names (e.g., `vllm`). + * + * Generated from protobuf field repeated string model_servers = 1 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * @param array|\Google\Protobuf\Internal\RepeatedField $var + * @return $this + */ + public function setModelServers($var) + { + $arr = GPBUtil::checkRepeatedField($var, \Google\Protobuf\Internal\GPBType::STRING); + $this->model_servers = $arr; + + return $this; + } + + /** + * Output only. A token which may be sent as + * [page_token][FetchModelServersResponse.page_token] in a subsequent + * `FetchModelServersResponse` call to retrieve the next page of results. + * If this field is omitted or empty, then there are no more results to + * return. + * + * Generated from protobuf field string next_page_token = 2 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * @return string + */ + public function getNextPageToken() + { + return $this->next_page_token; + } + + /** + * Output only. A token which may be sent as + * [page_token][FetchModelServersResponse.page_token] in a subsequent + * `FetchModelServersResponse` call to retrieve the next page of results. + * If this field is omitted or empty, then there are no more results to + * return. + * + * Generated from protobuf field string next_page_token = 2 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * @param string $var + * @return $this + */ + public function setNextPageToken($var) + { + GPBUtil::checkString($var, True); + $this->next_page_token = $var; + + return $this; + } + +} + diff --git a/GkeRecommender/src/V1/FetchModelsRequest.php b/GkeRecommender/src/V1/FetchModelsRequest.php new file mode 100644 index 00000000000..82d77b5cfae --- /dev/null +++ b/GkeRecommender/src/V1/FetchModelsRequest.php @@ -0,0 +1,162 @@ +google.cloud.gkerecommender.v1.FetchModelsRequest + */ +class FetchModelsRequest extends \Google\Protobuf\Internal\Message +{ + /** + * Optional. The target number of results to return in a single response. + * If not specified, a default value will be chosen by the service. + * Note that the response may include a partial list and a caller should + * only rely on the response's + * [next_page_token][google.cloud.gkerecommender.v1.FetchModelsResponse.next_page_token] + * to determine if there are more instances left to be queried. + * + * Generated from protobuf field optional int32 page_size = 1 [(.google.api.field_behavior) = OPTIONAL]; + */ + protected $page_size = null; + /** + * Optional. The value of + * [next_page_token][google.cloud.gkerecommender.v1.FetchModelsResponse.next_page_token] + * received from a previous `FetchModelsRequest` call. + * Provide this to retrieve the subsequent page in a multi-page list of + * results. When paginating, all other parameters provided to + * `FetchModelsRequest` must match the call that provided the page token. + * + * Generated from protobuf field optional string page_token = 2 [(.google.api.field_behavior) = OPTIONAL]; + */ + protected $page_token = null; + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type int $page_size + * Optional. The target number of results to return in a single response. + * If not specified, a default value will be chosen by the service. + * Note that the response may include a partial list and a caller should + * only rely on the response's + * [next_page_token][google.cloud.gkerecommender.v1.FetchModelsResponse.next_page_token] + * to determine if there are more instances left to be queried. + * @type string $page_token + * Optional. The value of + * [next_page_token][google.cloud.gkerecommender.v1.FetchModelsResponse.next_page_token] + * received from a previous `FetchModelsRequest` call. + * Provide this to retrieve the subsequent page in a multi-page list of + * results. When paginating, all other parameters provided to + * `FetchModelsRequest` must match the call that provided the page token. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Cloud\Gkerecommender\V1\Gkerecommender::initOnce(); + parent::__construct($data); + } + + /** + * Optional. The target number of results to return in a single response. + * If not specified, a default value will be chosen by the service. + * Note that the response may include a partial list and a caller should + * only rely on the response's + * [next_page_token][google.cloud.gkerecommender.v1.FetchModelsResponse.next_page_token] + * to determine if there are more instances left to be queried. + * + * Generated from protobuf field optional int32 page_size = 1 [(.google.api.field_behavior) = OPTIONAL]; + * @return int + */ + public function getPageSize() + { + return isset($this->page_size) ? $this->page_size : 0; + } + + public function hasPageSize() + { + return isset($this->page_size); + } + + public function clearPageSize() + { + unset($this->page_size); + } + + /** + * Optional. The target number of results to return in a single response. + * If not specified, a default value will be chosen by the service. + * Note that the response may include a partial list and a caller should + * only rely on the response's + * [next_page_token][google.cloud.gkerecommender.v1.FetchModelsResponse.next_page_token] + * to determine if there are more instances left to be queried. + * + * Generated from protobuf field optional int32 page_size = 1 [(.google.api.field_behavior) = OPTIONAL]; + * @param int $var + * @return $this + */ + public function setPageSize($var) + { + GPBUtil::checkInt32($var); + $this->page_size = $var; + + return $this; + } + + /** + * Optional. The value of + * [next_page_token][google.cloud.gkerecommender.v1.FetchModelsResponse.next_page_token] + * received from a previous `FetchModelsRequest` call. + * Provide this to retrieve the subsequent page in a multi-page list of + * results. When paginating, all other parameters provided to + * `FetchModelsRequest` must match the call that provided the page token. + * + * Generated from protobuf field optional string page_token = 2 [(.google.api.field_behavior) = OPTIONAL]; + * @return string + */ + public function getPageToken() + { + return isset($this->page_token) ? $this->page_token : ''; + } + + public function hasPageToken() + { + return isset($this->page_token); + } + + public function clearPageToken() + { + unset($this->page_token); + } + + /** + * Optional. The value of + * [next_page_token][google.cloud.gkerecommender.v1.FetchModelsResponse.next_page_token] + * received from a previous `FetchModelsRequest` call. + * Provide this to retrieve the subsequent page in a multi-page list of + * results. When paginating, all other parameters provided to + * `FetchModelsRequest` must match the call that provided the page token. + * + * Generated from protobuf field optional string page_token = 2 [(.google.api.field_behavior) = OPTIONAL]; + * @param string $var + * @return $this + */ + public function setPageToken($var) + { + GPBUtil::checkString($var, True); + $this->page_token = $var; + + return $this; + } + +} + diff --git a/GkeRecommender/src/V1/FetchModelsResponse.php b/GkeRecommender/src/V1/FetchModelsResponse.php new file mode 100644 index 00000000000..253daad1c03 --- /dev/null +++ b/GkeRecommender/src/V1/FetchModelsResponse.php @@ -0,0 +1,122 @@ +google.cloud.gkerecommender.v1.FetchModelsResponse + */ +class FetchModelsResponse extends \Google\Protobuf\Internal\Message +{ + /** + * Output only. List of available models. Open-source models follow the + * Huggingface Hub `owner/model_name` format. + * + * Generated from protobuf field repeated string models = 1 [(.google.api.field_behavior) = OUTPUT_ONLY]; + */ + private $models; + /** + * Output only. A token which may be sent as + * [page_token][FetchModelsResponse.page_token] in a subsequent + * `FetchModelsResponse` call to retrieve the next page of results. + * If this field is omitted or empty, then there are no more results to + * return. + * + * Generated from protobuf field string next_page_token = 2 [(.google.api.field_behavior) = OUTPUT_ONLY]; + */ + protected $next_page_token = ''; + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type array|\Google\Protobuf\Internal\RepeatedField $models + * Output only. List of available models. Open-source models follow the + * Huggingface Hub `owner/model_name` format. + * @type string $next_page_token + * Output only. A token which may be sent as + * [page_token][FetchModelsResponse.page_token] in a subsequent + * `FetchModelsResponse` call to retrieve the next page of results. + * If this field is omitted or empty, then there are no more results to + * return. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Cloud\Gkerecommender\V1\Gkerecommender::initOnce(); + parent::__construct($data); + } + + /** + * Output only. List of available models. Open-source models follow the + * Huggingface Hub `owner/model_name` format. + * + * Generated from protobuf field repeated string models = 1 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * @return \Google\Protobuf\Internal\RepeatedField + */ + public function getModels() + { + return $this->models; + } + + /** + * Output only. List of available models. Open-source models follow the + * Huggingface Hub `owner/model_name` format. + * + * Generated from protobuf field repeated string models = 1 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * @param array|\Google\Protobuf\Internal\RepeatedField $var + * @return $this + */ + public function setModels($var) + { + $arr = GPBUtil::checkRepeatedField($var, \Google\Protobuf\Internal\GPBType::STRING); + $this->models = $arr; + + return $this; + } + + /** + * Output only. A token which may be sent as + * [page_token][FetchModelsResponse.page_token] in a subsequent + * `FetchModelsResponse` call to retrieve the next page of results. + * If this field is omitted or empty, then there are no more results to + * return. + * + * Generated from protobuf field string next_page_token = 2 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * @return string + */ + public function getNextPageToken() + { + return $this->next_page_token; + } + + /** + * Output only. A token which may be sent as + * [page_token][FetchModelsResponse.page_token] in a subsequent + * `FetchModelsResponse` call to retrieve the next page of results. + * If this field is omitted or empty, then there are no more results to + * return. + * + * Generated from protobuf field string next_page_token = 2 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * @param string $var + * @return $this + */ + public function setNextPageToken($var) + { + GPBUtil::checkString($var, True); + $this->next_page_token = $var; + + return $this; + } + +} + diff --git a/GkeRecommender/src/V1/FetchProfilesRequest.php b/GkeRecommender/src/V1/FetchProfilesRequest.php new file mode 100644 index 00000000000..9e68d701934 --- /dev/null +++ b/GkeRecommender/src/V1/FetchProfilesRequest.php @@ -0,0 +1,360 @@ +google.cloud.gkerecommender.v1.FetchProfilesRequest + */ +class FetchProfilesRequest extends \Google\Protobuf\Internal\Message +{ + /** + * Optional. The model to filter profiles by. Open-source models follow the + * Huggingface Hub `owner/model_name` format. If not provided, all models are + * returned. Use + * [GkeInferenceQuickstart.FetchModels][google.cloud.gkerecommender.v1.GkeInferenceQuickstart.FetchModels] + * to find available models. + * + * Generated from protobuf field string model = 1 [(.google.api.field_behavior) = OPTIONAL]; + */ + protected $model = ''; + /** + * Optional. The model server to filter profiles by. If not provided, all + * model servers are returned. Use + * [GkeInferenceQuickstart.FetchModelServers][google.cloud.gkerecommender.v1.GkeInferenceQuickstart.FetchModelServers] + * to find available model servers for a given model. + * + * Generated from protobuf field string model_server = 2 [(.google.api.field_behavior) = OPTIONAL]; + */ + protected $model_server = ''; + /** + * Optional. The model server version to filter profiles by. If not provided, + * all model server versions are returned. Use + * [GkeInferenceQuickstart.FetchModelServerVersions][google.cloud.gkerecommender.v1.GkeInferenceQuickstart.FetchModelServerVersions] + * to find available versions for a given model and server. + * + * Generated from protobuf field string model_server_version = 3 [(.google.api.field_behavior) = OPTIONAL]; + */ + protected $model_server_version = ''; + /** + * Optional. The performance requirements to filter profiles. Profiles that do + * not meet these requirements are filtered out. If not provided, all profiles + * are returned. + * + * Generated from protobuf field .google.cloud.gkerecommender.v1.PerformanceRequirements performance_requirements = 4 [(.google.api.field_behavior) = OPTIONAL]; + */ + protected $performance_requirements = null; + /** + * Optional. The target number of results to return in a single response. If + * not specified, a default value will be chosen by the service. Note that the + * response may include a partial list and a caller should only rely on the + * response's + * [next_page_token][google.cloud.gkerecommender.v1.FetchProfilesResponse.next_page_token] + * to determine if there are more instances left to be queried. + * + * Generated from protobuf field optional int32 page_size = 5 [(.google.api.field_behavior) = OPTIONAL]; + */ + protected $page_size = null; + /** + * Optional. The value of + * [next_page_token][google.cloud.gkerecommender.v1.FetchProfilesResponse.next_page_token] + * received from a previous `FetchProfilesRequest` call. + * Provide this to retrieve the subsequent page in a multi-page list of + * results. When paginating, all other parameters provided to + * `FetchProfilesRequest` must match the call that provided the page + * token. + * + * Generated from protobuf field optional string page_token = 6 [(.google.api.field_behavior) = OPTIONAL]; + */ + protected $page_token = null; + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type string $model + * Optional. The model to filter profiles by. Open-source models follow the + * Huggingface Hub `owner/model_name` format. If not provided, all models are + * returned. Use + * [GkeInferenceQuickstart.FetchModels][google.cloud.gkerecommender.v1.GkeInferenceQuickstart.FetchModels] + * to find available models. + * @type string $model_server + * Optional. The model server to filter profiles by. If not provided, all + * model servers are returned. Use + * [GkeInferenceQuickstart.FetchModelServers][google.cloud.gkerecommender.v1.GkeInferenceQuickstart.FetchModelServers] + * to find available model servers for a given model. + * @type string $model_server_version + * Optional. The model server version to filter profiles by. If not provided, + * all model server versions are returned. Use + * [GkeInferenceQuickstart.FetchModelServerVersions][google.cloud.gkerecommender.v1.GkeInferenceQuickstart.FetchModelServerVersions] + * to find available versions for a given model and server. + * @type \Google\Cloud\GkeRecommender\V1\PerformanceRequirements $performance_requirements + * Optional. The performance requirements to filter profiles. Profiles that do + * not meet these requirements are filtered out. If not provided, all profiles + * are returned. + * @type int $page_size + * Optional. The target number of results to return in a single response. If + * not specified, a default value will be chosen by the service. Note that the + * response may include a partial list and a caller should only rely on the + * response's + * [next_page_token][google.cloud.gkerecommender.v1.FetchProfilesResponse.next_page_token] + * to determine if there are more instances left to be queried. + * @type string $page_token + * Optional. The value of + * [next_page_token][google.cloud.gkerecommender.v1.FetchProfilesResponse.next_page_token] + * received from a previous `FetchProfilesRequest` call. + * Provide this to retrieve the subsequent page in a multi-page list of + * results. When paginating, all other parameters provided to + * `FetchProfilesRequest` must match the call that provided the page + * token. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Cloud\Gkerecommender\V1\Gkerecommender::initOnce(); + parent::__construct($data); + } + + /** + * Optional. The model to filter profiles by. Open-source models follow the + * Huggingface Hub `owner/model_name` format. If not provided, all models are + * returned. Use + * [GkeInferenceQuickstart.FetchModels][google.cloud.gkerecommender.v1.GkeInferenceQuickstart.FetchModels] + * to find available models. + * + * Generated from protobuf field string model = 1 [(.google.api.field_behavior) = OPTIONAL]; + * @return string + */ + public function getModel() + { + return $this->model; + } + + /** + * Optional. The model to filter profiles by. Open-source models follow the + * Huggingface Hub `owner/model_name` format. If not provided, all models are + * returned. Use + * [GkeInferenceQuickstart.FetchModels][google.cloud.gkerecommender.v1.GkeInferenceQuickstart.FetchModels] + * to find available models. + * + * Generated from protobuf field string model = 1 [(.google.api.field_behavior) = OPTIONAL]; + * @param string $var + * @return $this + */ + public function setModel($var) + { + GPBUtil::checkString($var, True); + $this->model = $var; + + return $this; + } + + /** + * Optional. The model server to filter profiles by. If not provided, all + * model servers are returned. Use + * [GkeInferenceQuickstart.FetchModelServers][google.cloud.gkerecommender.v1.GkeInferenceQuickstart.FetchModelServers] + * to find available model servers for a given model. + * + * Generated from protobuf field string model_server = 2 [(.google.api.field_behavior) = OPTIONAL]; + * @return string + */ + public function getModelServer() + { + return $this->model_server; + } + + /** + * Optional. The model server to filter profiles by. If not provided, all + * model servers are returned. Use + * [GkeInferenceQuickstart.FetchModelServers][google.cloud.gkerecommender.v1.GkeInferenceQuickstart.FetchModelServers] + * to find available model servers for a given model. + * + * Generated from protobuf field string model_server = 2 [(.google.api.field_behavior) = OPTIONAL]; + * @param string $var + * @return $this + */ + public function setModelServer($var) + { + GPBUtil::checkString($var, True); + $this->model_server = $var; + + return $this; + } + + /** + * Optional. The model server version to filter profiles by. If not provided, + * all model server versions are returned. Use + * [GkeInferenceQuickstart.FetchModelServerVersions][google.cloud.gkerecommender.v1.GkeInferenceQuickstart.FetchModelServerVersions] + * to find available versions for a given model and server. + * + * Generated from protobuf field string model_server_version = 3 [(.google.api.field_behavior) = OPTIONAL]; + * @return string + */ + public function getModelServerVersion() + { + return $this->model_server_version; + } + + /** + * Optional. The model server version to filter profiles by. If not provided, + * all model server versions are returned. Use + * [GkeInferenceQuickstart.FetchModelServerVersions][google.cloud.gkerecommender.v1.GkeInferenceQuickstart.FetchModelServerVersions] + * to find available versions for a given model and server. + * + * Generated from protobuf field string model_server_version = 3 [(.google.api.field_behavior) = OPTIONAL]; + * @param string $var + * @return $this + */ + public function setModelServerVersion($var) + { + GPBUtil::checkString($var, True); + $this->model_server_version = $var; + + return $this; + } + + /** + * Optional. The performance requirements to filter profiles. Profiles that do + * not meet these requirements are filtered out. If not provided, all profiles + * are returned. + * + * Generated from protobuf field .google.cloud.gkerecommender.v1.PerformanceRequirements performance_requirements = 4 [(.google.api.field_behavior) = OPTIONAL]; + * @return \Google\Cloud\GkeRecommender\V1\PerformanceRequirements|null + */ + public function getPerformanceRequirements() + { + return $this->performance_requirements; + } + + public function hasPerformanceRequirements() + { + return isset($this->performance_requirements); + } + + public function clearPerformanceRequirements() + { + unset($this->performance_requirements); + } + + /** + * Optional. The performance requirements to filter profiles. Profiles that do + * not meet these requirements are filtered out. If not provided, all profiles + * are returned. + * + * Generated from protobuf field .google.cloud.gkerecommender.v1.PerformanceRequirements performance_requirements = 4 [(.google.api.field_behavior) = OPTIONAL]; + * @param \Google\Cloud\GkeRecommender\V1\PerformanceRequirements $var + * @return $this + */ + public function setPerformanceRequirements($var) + { + GPBUtil::checkMessage($var, \Google\Cloud\GkeRecommender\V1\PerformanceRequirements::class); + $this->performance_requirements = $var; + + return $this; + } + + /** + * Optional. The target number of results to return in a single response. If + * not specified, a default value will be chosen by the service. Note that the + * response may include a partial list and a caller should only rely on the + * response's + * [next_page_token][google.cloud.gkerecommender.v1.FetchProfilesResponse.next_page_token] + * to determine if there are more instances left to be queried. + * + * Generated from protobuf field optional int32 page_size = 5 [(.google.api.field_behavior) = OPTIONAL]; + * @return int + */ + public function getPageSize() + { + return isset($this->page_size) ? $this->page_size : 0; + } + + public function hasPageSize() + { + return isset($this->page_size); + } + + public function clearPageSize() + { + unset($this->page_size); + } + + /** + * Optional. The target number of results to return in a single response. If + * not specified, a default value will be chosen by the service. Note that the + * response may include a partial list and a caller should only rely on the + * response's + * [next_page_token][google.cloud.gkerecommender.v1.FetchProfilesResponse.next_page_token] + * to determine if there are more instances left to be queried. + * + * Generated from protobuf field optional int32 page_size = 5 [(.google.api.field_behavior) = OPTIONAL]; + * @param int $var + * @return $this + */ + public function setPageSize($var) + { + GPBUtil::checkInt32($var); + $this->page_size = $var; + + return $this; + } + + /** + * Optional. The value of + * [next_page_token][google.cloud.gkerecommender.v1.FetchProfilesResponse.next_page_token] + * received from a previous `FetchProfilesRequest` call. + * Provide this to retrieve the subsequent page in a multi-page list of + * results. When paginating, all other parameters provided to + * `FetchProfilesRequest` must match the call that provided the page + * token. + * + * Generated from protobuf field optional string page_token = 6 [(.google.api.field_behavior) = OPTIONAL]; + * @return string + */ + public function getPageToken() + { + return isset($this->page_token) ? $this->page_token : ''; + } + + public function hasPageToken() + { + return isset($this->page_token); + } + + public function clearPageToken() + { + unset($this->page_token); + } + + /** + * Optional. The value of + * [next_page_token][google.cloud.gkerecommender.v1.FetchProfilesResponse.next_page_token] + * received from a previous `FetchProfilesRequest` call. + * Provide this to retrieve the subsequent page in a multi-page list of + * results. When paginating, all other parameters provided to + * `FetchProfilesRequest` must match the call that provided the page + * token. + * + * Generated from protobuf field optional string page_token = 6 [(.google.api.field_behavior) = OPTIONAL]; + * @param string $var + * @return $this + */ + public function setPageToken($var) + { + GPBUtil::checkString($var, True); + $this->page_token = $var; + + return $this; + } + +} + diff --git a/GkeRecommender/src/V1/FetchProfilesResponse.php b/GkeRecommender/src/V1/FetchProfilesResponse.php new file mode 100644 index 00000000000..fe48b195235 --- /dev/null +++ b/GkeRecommender/src/V1/FetchProfilesResponse.php @@ -0,0 +1,200 @@ +google.cloud.gkerecommender.v1.FetchProfilesResponse + */ +class FetchProfilesResponse extends \Google\Protobuf\Internal\Message +{ + /** + * Output only. List of profiles that match the given model server info and + * performance requirements (if provided). + * + * Generated from protobuf field repeated .google.cloud.gkerecommender.v1.Profile profile = 1 [(.google.api.field_behavior) = OUTPUT_ONLY]; + */ + private $profile; + /** + * Output only. The combined range of performance values observed across all + * profiles in this response. + * + * Generated from protobuf field .google.cloud.gkerecommender.v1.PerformanceRange performance_range = 2 [(.google.api.field_behavior) = OUTPUT_ONLY]; + */ + protected $performance_range = null; + /** + * Output only. Additional comments related to the response. + * + * Generated from protobuf field string comments = 3 [(.google.api.field_behavior) = OUTPUT_ONLY]; + */ + protected $comments = ''; + /** + * Output only. A token which may be sent as + * [page_token][FetchProfilesResponse.page_token] in a subsequent + * `FetchProfilesResponse` call to retrieve the next page of results. If this + * field is omitted or empty, then there are no more results to return. + * + * Generated from protobuf field string next_page_token = 4 [(.google.api.field_behavior) = OUTPUT_ONLY]; + */ + protected $next_page_token = ''; + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type array<\Google\Cloud\GkeRecommender\V1\Profile>|\Google\Protobuf\Internal\RepeatedField $profile + * Output only. List of profiles that match the given model server info and + * performance requirements (if provided). + * @type \Google\Cloud\GkeRecommender\V1\PerformanceRange $performance_range + * Output only. The combined range of performance values observed across all + * profiles in this response. + * @type string $comments + * Output only. Additional comments related to the response. + * @type string $next_page_token + * Output only. A token which may be sent as + * [page_token][FetchProfilesResponse.page_token] in a subsequent + * `FetchProfilesResponse` call to retrieve the next page of results. If this + * field is omitted or empty, then there are no more results to return. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Cloud\Gkerecommender\V1\Gkerecommender::initOnce(); + parent::__construct($data); + } + + /** + * Output only. List of profiles that match the given model server info and + * performance requirements (if provided). + * + * Generated from protobuf field repeated .google.cloud.gkerecommender.v1.Profile profile = 1 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * @return \Google\Protobuf\Internal\RepeatedField + */ + public function getProfile() + { + return $this->profile; + } + + /** + * Output only. List of profiles that match the given model server info and + * performance requirements (if provided). + * + * Generated from protobuf field repeated .google.cloud.gkerecommender.v1.Profile profile = 1 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * @param array<\Google\Cloud\GkeRecommender\V1\Profile>|\Google\Protobuf\Internal\RepeatedField $var + * @return $this + */ + public function setProfile($var) + { + $arr = GPBUtil::checkRepeatedField($var, \Google\Protobuf\Internal\GPBType::MESSAGE, \Google\Cloud\GkeRecommender\V1\Profile::class); + $this->profile = $arr; + + return $this; + } + + /** + * Output only. The combined range of performance values observed across all + * profiles in this response. + * + * Generated from protobuf field .google.cloud.gkerecommender.v1.PerformanceRange performance_range = 2 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * @return \Google\Cloud\GkeRecommender\V1\PerformanceRange|null + */ + public function getPerformanceRange() + { + return $this->performance_range; + } + + public function hasPerformanceRange() + { + return isset($this->performance_range); + } + + public function clearPerformanceRange() + { + unset($this->performance_range); + } + + /** + * Output only. The combined range of performance values observed across all + * profiles in this response. + * + * Generated from protobuf field .google.cloud.gkerecommender.v1.PerformanceRange performance_range = 2 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * @param \Google\Cloud\GkeRecommender\V1\PerformanceRange $var + * @return $this + */ + public function setPerformanceRange($var) + { + GPBUtil::checkMessage($var, \Google\Cloud\GkeRecommender\V1\PerformanceRange::class); + $this->performance_range = $var; + + return $this; + } + + /** + * Output only. Additional comments related to the response. + * + * Generated from protobuf field string comments = 3 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * @return string + */ + public function getComments() + { + return $this->comments; + } + + /** + * Output only. Additional comments related to the response. + * + * Generated from protobuf field string comments = 3 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * @param string $var + * @return $this + */ + public function setComments($var) + { + GPBUtil::checkString($var, True); + $this->comments = $var; + + return $this; + } + + /** + * Output only. A token which may be sent as + * [page_token][FetchProfilesResponse.page_token] in a subsequent + * `FetchProfilesResponse` call to retrieve the next page of results. If this + * field is omitted or empty, then there are no more results to return. + * + * Generated from protobuf field string next_page_token = 4 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * @return string + */ + public function getNextPageToken() + { + return $this->next_page_token; + } + + /** + * Output only. A token which may be sent as + * [page_token][FetchProfilesResponse.page_token] in a subsequent + * `FetchProfilesResponse` call to retrieve the next page of results. If this + * field is omitted or empty, then there are no more results to return. + * + * Generated from protobuf field string next_page_token = 4 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * @param string $var + * @return $this + */ + public function setNextPageToken($var) + { + GPBUtil::checkString($var, True); + $this->next_page_token = $var; + + return $this; + } + +} + diff --git a/GkeRecommender/src/V1/GenerateOptimizedManifestRequest.php b/GkeRecommender/src/V1/GenerateOptimizedManifestRequest.php new file mode 100644 index 00000000000..29a6ad8506f --- /dev/null +++ b/GkeRecommender/src/V1/GenerateOptimizedManifestRequest.php @@ -0,0 +1,274 @@ +google.cloud.gkerecommender.v1.GenerateOptimizedManifestRequest + */ +class GenerateOptimizedManifestRequest extends \Google\Protobuf\Internal\Message +{ + /** + * Required. The model server configuration to generate the manifest for. Use + * [GkeInferenceQuickstart.FetchProfiles][google.cloud.gkerecommender.v1.GkeInferenceQuickstart.FetchProfiles] + * to find valid configurations. + * + * Generated from protobuf field .google.cloud.gkerecommender.v1.ModelServerInfo model_server_info = 1 [(.google.api.field_behavior) = REQUIRED]; + */ + protected $model_server_info = null; + /** + * Required. The accelerator type. Use + * [GkeInferenceQuickstart.FetchProfiles][google.cloud.gkerecommender.v1.GkeInferenceQuickstart.FetchProfiles] + * to find valid accelerators for a given `model_server_info`. + * + * Generated from protobuf field string accelerator_type = 2 [(.google.api.field_behavior) = REQUIRED]; + */ + protected $accelerator_type = ''; + /** + * Optional. The kubernetes namespace to deploy the manifests in. + * + * Generated from protobuf field string kubernetes_namespace = 3 [(.google.api.field_behavior) = OPTIONAL]; + */ + protected $kubernetes_namespace = ''; + /** + * Optional. The performance requirements to use for generating Horizontal Pod + * Autoscaler (HPA) resources. If provided, the manifest includes HPA + * resources to adjust the model server replica count to maintain the + * specified targets (e.g., NTPOT, TTFT) at a P50 latency. Cost targets are + * not currently supported for HPA generation. If the specified targets are + * not achievable, the HPA manifest will not be generated. + * + * Generated from protobuf field .google.cloud.gkerecommender.v1.PerformanceRequirements performance_requirements = 4 [(.google.api.field_behavior) = OPTIONAL]; + */ + protected $performance_requirements = null; + /** + * Optional. The storage configuration for the model. If not provided, the + * model is loaded from Huggingface. + * + * Generated from protobuf field .google.cloud.gkerecommender.v1.StorageConfig storage_config = 5 [(.google.api.field_behavior) = OPTIONAL]; + */ + protected $storage_config = null; + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type \Google\Cloud\GkeRecommender\V1\ModelServerInfo $model_server_info + * Required. The model server configuration to generate the manifest for. Use + * [GkeInferenceQuickstart.FetchProfiles][google.cloud.gkerecommender.v1.GkeInferenceQuickstart.FetchProfiles] + * to find valid configurations. + * @type string $accelerator_type + * Required. The accelerator type. Use + * [GkeInferenceQuickstart.FetchProfiles][google.cloud.gkerecommender.v1.GkeInferenceQuickstart.FetchProfiles] + * to find valid accelerators for a given `model_server_info`. + * @type string $kubernetes_namespace + * Optional. The kubernetes namespace to deploy the manifests in. + * @type \Google\Cloud\GkeRecommender\V1\PerformanceRequirements $performance_requirements + * Optional. The performance requirements to use for generating Horizontal Pod + * Autoscaler (HPA) resources. If provided, the manifest includes HPA + * resources to adjust the model server replica count to maintain the + * specified targets (e.g., NTPOT, TTFT) at a P50 latency. Cost targets are + * not currently supported for HPA generation. If the specified targets are + * not achievable, the HPA manifest will not be generated. + * @type \Google\Cloud\GkeRecommender\V1\StorageConfig $storage_config + * Optional. The storage configuration for the model. If not provided, the + * model is loaded from Huggingface. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Cloud\Gkerecommender\V1\Gkerecommender::initOnce(); + parent::__construct($data); + } + + /** + * Required. The model server configuration to generate the manifest for. Use + * [GkeInferenceQuickstart.FetchProfiles][google.cloud.gkerecommender.v1.GkeInferenceQuickstart.FetchProfiles] + * to find valid configurations. + * + * Generated from protobuf field .google.cloud.gkerecommender.v1.ModelServerInfo model_server_info = 1 [(.google.api.field_behavior) = REQUIRED]; + * @return \Google\Cloud\GkeRecommender\V1\ModelServerInfo|null + */ + public function getModelServerInfo() + { + return $this->model_server_info; + } + + public function hasModelServerInfo() + { + return isset($this->model_server_info); + } + + public function clearModelServerInfo() + { + unset($this->model_server_info); + } + + /** + * Required. The model server configuration to generate the manifest for. Use + * [GkeInferenceQuickstart.FetchProfiles][google.cloud.gkerecommender.v1.GkeInferenceQuickstart.FetchProfiles] + * to find valid configurations. + * + * Generated from protobuf field .google.cloud.gkerecommender.v1.ModelServerInfo model_server_info = 1 [(.google.api.field_behavior) = REQUIRED]; + * @param \Google\Cloud\GkeRecommender\V1\ModelServerInfo $var + * @return $this + */ + public function setModelServerInfo($var) + { + GPBUtil::checkMessage($var, \Google\Cloud\GkeRecommender\V1\ModelServerInfo::class); + $this->model_server_info = $var; + + return $this; + } + + /** + * Required. The accelerator type. Use + * [GkeInferenceQuickstart.FetchProfiles][google.cloud.gkerecommender.v1.GkeInferenceQuickstart.FetchProfiles] + * to find valid accelerators for a given `model_server_info`. + * + * Generated from protobuf field string accelerator_type = 2 [(.google.api.field_behavior) = REQUIRED]; + * @return string + */ + public function getAcceleratorType() + { + return $this->accelerator_type; + } + + /** + * Required. The accelerator type. Use + * [GkeInferenceQuickstart.FetchProfiles][google.cloud.gkerecommender.v1.GkeInferenceQuickstart.FetchProfiles] + * to find valid accelerators for a given `model_server_info`. + * + * Generated from protobuf field string accelerator_type = 2 [(.google.api.field_behavior) = REQUIRED]; + * @param string $var + * @return $this + */ + public function setAcceleratorType($var) + { + GPBUtil::checkString($var, True); + $this->accelerator_type = $var; + + return $this; + } + + /** + * Optional. The kubernetes namespace to deploy the manifests in. + * + * Generated from protobuf field string kubernetes_namespace = 3 [(.google.api.field_behavior) = OPTIONAL]; + * @return string + */ + public function getKubernetesNamespace() + { + return $this->kubernetes_namespace; + } + + /** + * Optional. The kubernetes namespace to deploy the manifests in. + * + * Generated from protobuf field string kubernetes_namespace = 3 [(.google.api.field_behavior) = OPTIONAL]; + * @param string $var + * @return $this + */ + public function setKubernetesNamespace($var) + { + GPBUtil::checkString($var, True); + $this->kubernetes_namespace = $var; + + return $this; + } + + /** + * Optional. The performance requirements to use for generating Horizontal Pod + * Autoscaler (HPA) resources. If provided, the manifest includes HPA + * resources to adjust the model server replica count to maintain the + * specified targets (e.g., NTPOT, TTFT) at a P50 latency. Cost targets are + * not currently supported for HPA generation. If the specified targets are + * not achievable, the HPA manifest will not be generated. + * + * Generated from protobuf field .google.cloud.gkerecommender.v1.PerformanceRequirements performance_requirements = 4 [(.google.api.field_behavior) = OPTIONAL]; + * @return \Google\Cloud\GkeRecommender\V1\PerformanceRequirements|null + */ + public function getPerformanceRequirements() + { + return $this->performance_requirements; + } + + public function hasPerformanceRequirements() + { + return isset($this->performance_requirements); + } + + public function clearPerformanceRequirements() + { + unset($this->performance_requirements); + } + + /** + * Optional. The performance requirements to use for generating Horizontal Pod + * Autoscaler (HPA) resources. If provided, the manifest includes HPA + * resources to adjust the model server replica count to maintain the + * specified targets (e.g., NTPOT, TTFT) at a P50 latency. Cost targets are + * not currently supported for HPA generation. If the specified targets are + * not achievable, the HPA manifest will not be generated. + * + * Generated from protobuf field .google.cloud.gkerecommender.v1.PerformanceRequirements performance_requirements = 4 [(.google.api.field_behavior) = OPTIONAL]; + * @param \Google\Cloud\GkeRecommender\V1\PerformanceRequirements $var + * @return $this + */ + public function setPerformanceRequirements($var) + { + GPBUtil::checkMessage($var, \Google\Cloud\GkeRecommender\V1\PerformanceRequirements::class); + $this->performance_requirements = $var; + + return $this; + } + + /** + * Optional. The storage configuration for the model. If not provided, the + * model is loaded from Huggingface. + * + * Generated from protobuf field .google.cloud.gkerecommender.v1.StorageConfig storage_config = 5 [(.google.api.field_behavior) = OPTIONAL]; + * @return \Google\Cloud\GkeRecommender\V1\StorageConfig|null + */ + public function getStorageConfig() + { + return $this->storage_config; + } + + public function hasStorageConfig() + { + return isset($this->storage_config); + } + + public function clearStorageConfig() + { + unset($this->storage_config); + } + + /** + * Optional. The storage configuration for the model. If not provided, the + * model is loaded from Huggingface. + * + * Generated from protobuf field .google.cloud.gkerecommender.v1.StorageConfig storage_config = 5 [(.google.api.field_behavior) = OPTIONAL]; + * @param \Google\Cloud\GkeRecommender\V1\StorageConfig $var + * @return $this + */ + public function setStorageConfig($var) + { + GPBUtil::checkMessage($var, \Google\Cloud\GkeRecommender\V1\StorageConfig::class); + $this->storage_config = $var; + + return $this; + } + +} + diff --git a/GkeRecommender/src/V1/GenerateOptimizedManifestResponse.php b/GkeRecommender/src/V1/GenerateOptimizedManifestResponse.php new file mode 100644 index 00000000000..0050085aaac --- /dev/null +++ b/GkeRecommender/src/V1/GenerateOptimizedManifestResponse.php @@ -0,0 +1,152 @@ +google.cloud.gkerecommender.v1.GenerateOptimizedManifestResponse + */ +class GenerateOptimizedManifestResponse extends \Google\Protobuf\Internal\Message +{ + /** + * Output only. A list of generated Kubernetes manifests. + * + * Generated from protobuf field repeated .google.cloud.gkerecommender.v1.KubernetesManifest kubernetes_manifests = 1 [(.google.api.field_behavior) = OUTPUT_ONLY]; + */ + private $kubernetes_manifests; + /** + * Output only. Comments related to deploying the generated manifests. + * + * Generated from protobuf field repeated string comments = 2 [(.google.api.field_behavior) = OUTPUT_ONLY]; + */ + private $comments; + /** + * Output only. Additional information about the versioned dependencies used + * to generate the manifests. See [Run best practice inference with GKE + * Inference Quickstart + * recipes](https://cloud.google.com/kubernetes-engine/docs/how-to/machine-learning/inference/inference-quickstart) + * for details. + * + * Generated from protobuf field string manifest_version = 3 [(.google.api.field_behavior) = OUTPUT_ONLY]; + */ + protected $manifest_version = ''; + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type array<\Google\Cloud\GkeRecommender\V1\KubernetesManifest>|\Google\Protobuf\Internal\RepeatedField $kubernetes_manifests + * Output only. A list of generated Kubernetes manifests. + * @type array|\Google\Protobuf\Internal\RepeatedField $comments + * Output only. Comments related to deploying the generated manifests. + * @type string $manifest_version + * Output only. Additional information about the versioned dependencies used + * to generate the manifests. See [Run best practice inference with GKE + * Inference Quickstart + * recipes](https://cloud.google.com/kubernetes-engine/docs/how-to/machine-learning/inference/inference-quickstart) + * for details. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Cloud\Gkerecommender\V1\Gkerecommender::initOnce(); + parent::__construct($data); + } + + /** + * Output only. A list of generated Kubernetes manifests. + * + * Generated from protobuf field repeated .google.cloud.gkerecommender.v1.KubernetesManifest kubernetes_manifests = 1 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * @return \Google\Protobuf\Internal\RepeatedField + */ + public function getKubernetesManifests() + { + return $this->kubernetes_manifests; + } + + /** + * Output only. A list of generated Kubernetes manifests. + * + * Generated from protobuf field repeated .google.cloud.gkerecommender.v1.KubernetesManifest kubernetes_manifests = 1 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * @param array<\Google\Cloud\GkeRecommender\V1\KubernetesManifest>|\Google\Protobuf\Internal\RepeatedField $var + * @return $this + */ + public function setKubernetesManifests($var) + { + $arr = GPBUtil::checkRepeatedField($var, \Google\Protobuf\Internal\GPBType::MESSAGE, \Google\Cloud\GkeRecommender\V1\KubernetesManifest::class); + $this->kubernetes_manifests = $arr; + + return $this; + } + + /** + * Output only. Comments related to deploying the generated manifests. + * + * Generated from protobuf field repeated string comments = 2 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * @return \Google\Protobuf\Internal\RepeatedField + */ + public function getComments() + { + return $this->comments; + } + + /** + * Output only. Comments related to deploying the generated manifests. + * + * Generated from protobuf field repeated string comments = 2 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * @param array|\Google\Protobuf\Internal\RepeatedField $var + * @return $this + */ + public function setComments($var) + { + $arr = GPBUtil::checkRepeatedField($var, \Google\Protobuf\Internal\GPBType::STRING); + $this->comments = $arr; + + return $this; + } + + /** + * Output only. Additional information about the versioned dependencies used + * to generate the manifests. See [Run best practice inference with GKE + * Inference Quickstart + * recipes](https://cloud.google.com/kubernetes-engine/docs/how-to/machine-learning/inference/inference-quickstart) + * for details. + * + * Generated from protobuf field string manifest_version = 3 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * @return string + */ + public function getManifestVersion() + { + return $this->manifest_version; + } + + /** + * Output only. Additional information about the versioned dependencies used + * to generate the manifests. See [Run best practice inference with GKE + * Inference Quickstart + * recipes](https://cloud.google.com/kubernetes-engine/docs/how-to/machine-learning/inference/inference-quickstart) + * for details. + * + * Generated from protobuf field string manifest_version = 3 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * @param string $var + * @return $this + */ + public function setManifestVersion($var) + { + GPBUtil::checkString($var, True); + $this->manifest_version = $var; + + return $this; + } + +} + diff --git a/GkeRecommender/src/V1/KubernetesManifest.php b/GkeRecommender/src/V1/KubernetesManifest.php new file mode 100644 index 00000000000..20676910cbe --- /dev/null +++ b/GkeRecommender/src/V1/KubernetesManifest.php @@ -0,0 +1,135 @@ +google.cloud.gkerecommender.v1.KubernetesManifest + */ +class KubernetesManifest extends \Google\Protobuf\Internal\Message +{ + /** + * Output only. Kubernetes resource kind. + * + * Generated from protobuf field string kind = 1 [(.google.api.field_behavior) = OUTPUT_ONLY]; + */ + protected $kind = ''; + /** + * Output only. Kubernetes API version. + * + * Generated from protobuf field string api_version = 2 [(.google.api.field_behavior) = OUTPUT_ONLY]; + */ + protected $api_version = ''; + /** + * Output only. YAML content. + * + * Generated from protobuf field string content = 3 [(.google.api.field_behavior) = OUTPUT_ONLY]; + */ + protected $content = ''; + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type string $kind + * Output only. Kubernetes resource kind. + * @type string $api_version + * Output only. Kubernetes API version. + * @type string $content + * Output only. YAML content. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Cloud\Gkerecommender\V1\Gkerecommender::initOnce(); + parent::__construct($data); + } + + /** + * Output only. Kubernetes resource kind. + * + * Generated from protobuf field string kind = 1 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * @return string + */ + public function getKind() + { + return $this->kind; + } + + /** + * Output only. Kubernetes resource kind. + * + * Generated from protobuf field string kind = 1 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * @param string $var + * @return $this + */ + public function setKind($var) + { + GPBUtil::checkString($var, True); + $this->kind = $var; + + return $this; + } + + /** + * Output only. Kubernetes API version. + * + * Generated from protobuf field string api_version = 2 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * @return string + */ + public function getApiVersion() + { + return $this->api_version; + } + + /** + * Output only. Kubernetes API version. + * + * Generated from protobuf field string api_version = 2 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * @param string $var + * @return $this + */ + public function setApiVersion($var) + { + GPBUtil::checkString($var, True); + $this->api_version = $var; + + return $this; + } + + /** + * Output only. YAML content. + * + * Generated from protobuf field string content = 3 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * @return string + */ + public function getContent() + { + return $this->content; + } + + /** + * Output only. YAML content. + * + * Generated from protobuf field string content = 3 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * @param string $var + * @return $this + */ + public function setContent($var) + { + GPBUtil::checkString($var, True); + $this->content = $var; + + return $this; + } + +} + diff --git a/GkeRecommender/src/V1/MillisecondRange.php b/GkeRecommender/src/V1/MillisecondRange.php new file mode 100644 index 00000000000..7bbb5b9dc97 --- /dev/null +++ b/GkeRecommender/src/V1/MillisecondRange.php @@ -0,0 +1,101 @@ +google.cloud.gkerecommender.v1.MillisecondRange + */ +class MillisecondRange extends \Google\Protobuf\Internal\Message +{ + /** + * Output only. The minimum value of the range. + * + * Generated from protobuf field int32 min = 1 [(.google.api.field_behavior) = OUTPUT_ONLY]; + */ + protected $min = 0; + /** + * Output only. The maximum value of the range. + * + * Generated from protobuf field int32 max = 2 [(.google.api.field_behavior) = OUTPUT_ONLY]; + */ + protected $max = 0; + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type int $min + * Output only. The minimum value of the range. + * @type int $max + * Output only. The maximum value of the range. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Cloud\Gkerecommender\V1\Gkerecommender::initOnce(); + parent::__construct($data); + } + + /** + * Output only. The minimum value of the range. + * + * Generated from protobuf field int32 min = 1 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * @return int + */ + public function getMin() + { + return $this->min; + } + + /** + * Output only. The minimum value of the range. + * + * Generated from protobuf field int32 min = 1 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * @param int $var + * @return $this + */ + public function setMin($var) + { + GPBUtil::checkInt32($var); + $this->min = $var; + + return $this; + } + + /** + * Output only. The maximum value of the range. + * + * Generated from protobuf field int32 max = 2 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * @return int + */ + public function getMax() + { + return $this->max; + } + + /** + * Output only. The maximum value of the range. + * + * Generated from protobuf field int32 max = 2 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * @param int $var + * @return $this + */ + public function setMax($var) + { + GPBUtil::checkInt32($var); + $this->max = $var; + + return $this; + } + +} + diff --git a/GkeRecommender/src/V1/ModelServerInfo.php b/GkeRecommender/src/V1/ModelServerInfo.php new file mode 100644 index 00000000000..e4f0e183ff6 --- /dev/null +++ b/GkeRecommender/src/V1/ModelServerInfo.php @@ -0,0 +1,173 @@ +google.cloud.gkerecommender.v1.ModelServerInfo + */ +class ModelServerInfo extends \Google\Protobuf\Internal\Message +{ + /** + * Required. The model. Open-source models follow the Huggingface Hub + * `owner/model_name` format. Use + * [GkeInferenceQuickstart.FetchModels][google.cloud.gkerecommender.v1.GkeInferenceQuickstart.FetchModels] + * to find available models. + * + * Generated from protobuf field string model = 1 [(.google.api.field_behavior) = REQUIRED]; + */ + protected $model = ''; + /** + * Required. The model server. Open-source model servers use simplified, + * lowercase names (e.g., `vllm`). Use + * [GkeInferenceQuickstart.FetchModelServers][google.cloud.gkerecommender.v1.GkeInferenceQuickstart.FetchModelServers] + * to find available servers. + * + * Generated from protobuf field string model_server = 2 [(.google.api.field_behavior) = REQUIRED]; + */ + protected $model_server = ''; + /** + * Optional. The model server version. Use + * [GkeInferenceQuickstart.FetchModelServerVersions][google.cloud.gkerecommender.v1.GkeInferenceQuickstart.FetchModelServerVersions] + * to find available versions. If not provided, the latest available version + * is used. + * + * Generated from protobuf field string model_server_version = 3 [(.google.api.field_behavior) = OPTIONAL]; + */ + protected $model_server_version = ''; + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type string $model + * Required. The model. Open-source models follow the Huggingface Hub + * `owner/model_name` format. Use + * [GkeInferenceQuickstart.FetchModels][google.cloud.gkerecommender.v1.GkeInferenceQuickstart.FetchModels] + * to find available models. + * @type string $model_server + * Required. The model server. Open-source model servers use simplified, + * lowercase names (e.g., `vllm`). Use + * [GkeInferenceQuickstart.FetchModelServers][google.cloud.gkerecommender.v1.GkeInferenceQuickstart.FetchModelServers] + * to find available servers. + * @type string $model_server_version + * Optional. The model server version. Use + * [GkeInferenceQuickstart.FetchModelServerVersions][google.cloud.gkerecommender.v1.GkeInferenceQuickstart.FetchModelServerVersions] + * to find available versions. If not provided, the latest available version + * is used. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Cloud\Gkerecommender\V1\Gkerecommender::initOnce(); + parent::__construct($data); + } + + /** + * Required. The model. Open-source models follow the Huggingface Hub + * `owner/model_name` format. Use + * [GkeInferenceQuickstart.FetchModels][google.cloud.gkerecommender.v1.GkeInferenceQuickstart.FetchModels] + * to find available models. + * + * Generated from protobuf field string model = 1 [(.google.api.field_behavior) = REQUIRED]; + * @return string + */ + public function getModel() + { + return $this->model; + } + + /** + * Required. The model. Open-source models follow the Huggingface Hub + * `owner/model_name` format. Use + * [GkeInferenceQuickstart.FetchModels][google.cloud.gkerecommender.v1.GkeInferenceQuickstart.FetchModels] + * to find available models. + * + * Generated from protobuf field string model = 1 [(.google.api.field_behavior) = REQUIRED]; + * @param string $var + * @return $this + */ + public function setModel($var) + { + GPBUtil::checkString($var, True); + $this->model = $var; + + return $this; + } + + /** + * Required. The model server. Open-source model servers use simplified, + * lowercase names (e.g., `vllm`). Use + * [GkeInferenceQuickstart.FetchModelServers][google.cloud.gkerecommender.v1.GkeInferenceQuickstart.FetchModelServers] + * to find available servers. + * + * Generated from protobuf field string model_server = 2 [(.google.api.field_behavior) = REQUIRED]; + * @return string + */ + public function getModelServer() + { + return $this->model_server; + } + + /** + * Required. The model server. Open-source model servers use simplified, + * lowercase names (e.g., `vllm`). Use + * [GkeInferenceQuickstart.FetchModelServers][google.cloud.gkerecommender.v1.GkeInferenceQuickstart.FetchModelServers] + * to find available servers. + * + * Generated from protobuf field string model_server = 2 [(.google.api.field_behavior) = REQUIRED]; + * @param string $var + * @return $this + */ + public function setModelServer($var) + { + GPBUtil::checkString($var, True); + $this->model_server = $var; + + return $this; + } + + /** + * Optional. The model server version. Use + * [GkeInferenceQuickstart.FetchModelServerVersions][google.cloud.gkerecommender.v1.GkeInferenceQuickstart.FetchModelServerVersions] + * to find available versions. If not provided, the latest available version + * is used. + * + * Generated from protobuf field string model_server_version = 3 [(.google.api.field_behavior) = OPTIONAL]; + * @return string + */ + public function getModelServerVersion() + { + return $this->model_server_version; + } + + /** + * Optional. The model server version. Use + * [GkeInferenceQuickstart.FetchModelServerVersions][google.cloud.gkerecommender.v1.GkeInferenceQuickstart.FetchModelServerVersions] + * to find available versions. If not provided, the latest available version + * is used. + * + * Generated from protobuf field string model_server_version = 3 [(.google.api.field_behavior) = OPTIONAL]; + * @param string $var + * @return $this + */ + public function setModelServerVersion($var) + { + GPBUtil::checkString($var, True); + $this->model_server_version = $var; + + return $this; + } + +} + diff --git a/GkeRecommender/src/V1/PerformanceRange.php b/GkeRecommender/src/V1/PerformanceRange.php new file mode 100644 index 00000000000..3b7585e6d92 --- /dev/null +++ b/GkeRecommender/src/V1/PerformanceRange.php @@ -0,0 +1,185 @@ +google.cloud.gkerecommender.v1.PerformanceRange + */ +class PerformanceRange extends \Google\Protobuf\Internal\Message +{ + /** + * Output only. The range of throughput in output tokens per second. This is + * measured as total_output_tokens_generated_by_server / + * elapsed_time_in_seconds. + * + * Generated from protobuf field .google.cloud.gkerecommender.v1.TokensPerSecondRange throughput_output_range = 1 [(.google.api.field_behavior) = OUTPUT_ONLY]; + */ + protected $throughput_output_range = null; + /** + * Output only. The range of TTFT (Time To First Token) in milliseconds. TTFT + * is the time it takes to generate the first token for a request. + * + * Generated from protobuf field .google.cloud.gkerecommender.v1.MillisecondRange ttft_range = 2 [(.google.api.field_behavior) = OUTPUT_ONLY]; + */ + protected $ttft_range = null; + /** + * Output only. The range of NTPOT (Normalized Time Per Output Token) in + * milliseconds. NTPOT is the request latency normalized by the number of + * output tokens, measured as request_latency / total_output_tokens. + * + * Generated from protobuf field .google.cloud.gkerecommender.v1.MillisecondRange ntpot_range = 3 [(.google.api.field_behavior) = OUTPUT_ONLY]; + */ + protected $ntpot_range = null; + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type \Google\Cloud\GkeRecommender\V1\TokensPerSecondRange $throughput_output_range + * Output only. The range of throughput in output tokens per second. This is + * measured as total_output_tokens_generated_by_server / + * elapsed_time_in_seconds. + * @type \Google\Cloud\GkeRecommender\V1\MillisecondRange $ttft_range + * Output only. The range of TTFT (Time To First Token) in milliseconds. TTFT + * is the time it takes to generate the first token for a request. + * @type \Google\Cloud\GkeRecommender\V1\MillisecondRange $ntpot_range + * Output only. The range of NTPOT (Normalized Time Per Output Token) in + * milliseconds. NTPOT is the request latency normalized by the number of + * output tokens, measured as request_latency / total_output_tokens. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Cloud\Gkerecommender\V1\Gkerecommender::initOnce(); + parent::__construct($data); + } + + /** + * Output only. The range of throughput in output tokens per second. This is + * measured as total_output_tokens_generated_by_server / + * elapsed_time_in_seconds. + * + * Generated from protobuf field .google.cloud.gkerecommender.v1.TokensPerSecondRange throughput_output_range = 1 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * @return \Google\Cloud\GkeRecommender\V1\TokensPerSecondRange|null + */ + public function getThroughputOutputRange() + { + return $this->throughput_output_range; + } + + public function hasThroughputOutputRange() + { + return isset($this->throughput_output_range); + } + + public function clearThroughputOutputRange() + { + unset($this->throughput_output_range); + } + + /** + * Output only. The range of throughput in output tokens per second. This is + * measured as total_output_tokens_generated_by_server / + * elapsed_time_in_seconds. + * + * Generated from protobuf field .google.cloud.gkerecommender.v1.TokensPerSecondRange throughput_output_range = 1 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * @param \Google\Cloud\GkeRecommender\V1\TokensPerSecondRange $var + * @return $this + */ + public function setThroughputOutputRange($var) + { + GPBUtil::checkMessage($var, \Google\Cloud\GkeRecommender\V1\TokensPerSecondRange::class); + $this->throughput_output_range = $var; + + return $this; + } + + /** + * Output only. The range of TTFT (Time To First Token) in milliseconds. TTFT + * is the time it takes to generate the first token for a request. + * + * Generated from protobuf field .google.cloud.gkerecommender.v1.MillisecondRange ttft_range = 2 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * @return \Google\Cloud\GkeRecommender\V1\MillisecondRange|null + */ + public function getTtftRange() + { + return $this->ttft_range; + } + + public function hasTtftRange() + { + return isset($this->ttft_range); + } + + public function clearTtftRange() + { + unset($this->ttft_range); + } + + /** + * Output only. The range of TTFT (Time To First Token) in milliseconds. TTFT + * is the time it takes to generate the first token for a request. + * + * Generated from protobuf field .google.cloud.gkerecommender.v1.MillisecondRange ttft_range = 2 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * @param \Google\Cloud\GkeRecommender\V1\MillisecondRange $var + * @return $this + */ + public function setTtftRange($var) + { + GPBUtil::checkMessage($var, \Google\Cloud\GkeRecommender\V1\MillisecondRange::class); + $this->ttft_range = $var; + + return $this; + } + + /** + * Output only. The range of NTPOT (Normalized Time Per Output Token) in + * milliseconds. NTPOT is the request latency normalized by the number of + * output tokens, measured as request_latency / total_output_tokens. + * + * Generated from protobuf field .google.cloud.gkerecommender.v1.MillisecondRange ntpot_range = 3 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * @return \Google\Cloud\GkeRecommender\V1\MillisecondRange|null + */ + public function getNtpotRange() + { + return $this->ntpot_range; + } + + public function hasNtpotRange() + { + return isset($this->ntpot_range); + } + + public function clearNtpotRange() + { + unset($this->ntpot_range); + } + + /** + * Output only. The range of NTPOT (Normalized Time Per Output Token) in + * milliseconds. NTPOT is the request latency normalized by the number of + * output tokens, measured as request_latency / total_output_tokens. + * + * Generated from protobuf field .google.cloud.gkerecommender.v1.MillisecondRange ntpot_range = 3 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * @param \Google\Cloud\GkeRecommender\V1\MillisecondRange $var + * @return $this + */ + public function setNtpotRange($var) + { + GPBUtil::checkMessage($var, \Google\Cloud\GkeRecommender\V1\MillisecondRange::class); + $this->ntpot_range = $var; + + return $this; + } + +} + diff --git a/GkeRecommender/src/V1/PerformanceRequirements.php b/GkeRecommender/src/V1/PerformanceRequirements.php new file mode 100644 index 00000000000..6fff47a21fd --- /dev/null +++ b/GkeRecommender/src/V1/PerformanceRequirements.php @@ -0,0 +1,185 @@ +google.cloud.gkerecommender.v1.PerformanceRequirements + */ +class PerformanceRequirements extends \Google\Protobuf\Internal\Message +{ + /** + * Optional. The target Normalized Time Per Output Token (NTPOT) in + * milliseconds. NTPOT is calculated as `request_latency / + * total_output_tokens`. If not provided, this target will not be enforced. + * + * Generated from protobuf field optional int32 target_ntpot_milliseconds = 1 [(.google.api.field_behavior) = OPTIONAL]; + */ + protected $target_ntpot_milliseconds = null; + /** + * Optional. The target Time To First Token (TTFT) in milliseconds. TTFT is + * the time it takes to generate the first token for a request. If not + * provided, this target will not be enforced. + * + * Generated from protobuf field optional int32 target_ttft_milliseconds = 2 [(.google.api.field_behavior) = OPTIONAL]; + */ + protected $target_ttft_milliseconds = null; + /** + * Optional. The target cost for running a profile's model server. If not + * provided, this requirement will not be enforced. + * + * Generated from protobuf field .google.cloud.gkerecommender.v1.Cost target_cost = 3 [(.google.api.field_behavior) = OPTIONAL]; + */ + protected $target_cost = null; + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type int $target_ntpot_milliseconds + * Optional. The target Normalized Time Per Output Token (NTPOT) in + * milliseconds. NTPOT is calculated as `request_latency / + * total_output_tokens`. If not provided, this target will not be enforced. + * @type int $target_ttft_milliseconds + * Optional. The target Time To First Token (TTFT) in milliseconds. TTFT is + * the time it takes to generate the first token for a request. If not + * provided, this target will not be enforced. + * @type \Google\Cloud\GkeRecommender\V1\Cost $target_cost + * Optional. The target cost for running a profile's model server. If not + * provided, this requirement will not be enforced. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Cloud\Gkerecommender\V1\Gkerecommender::initOnce(); + parent::__construct($data); + } + + /** + * Optional. The target Normalized Time Per Output Token (NTPOT) in + * milliseconds. NTPOT is calculated as `request_latency / + * total_output_tokens`. If not provided, this target will not be enforced. + * + * Generated from protobuf field optional int32 target_ntpot_milliseconds = 1 [(.google.api.field_behavior) = OPTIONAL]; + * @return int + */ + public function getTargetNtpotMilliseconds() + { + return isset($this->target_ntpot_milliseconds) ? $this->target_ntpot_milliseconds : 0; + } + + public function hasTargetNtpotMilliseconds() + { + return isset($this->target_ntpot_milliseconds); + } + + public function clearTargetNtpotMilliseconds() + { + unset($this->target_ntpot_milliseconds); + } + + /** + * Optional. The target Normalized Time Per Output Token (NTPOT) in + * milliseconds. NTPOT is calculated as `request_latency / + * total_output_tokens`. If not provided, this target will not be enforced. + * + * Generated from protobuf field optional int32 target_ntpot_milliseconds = 1 [(.google.api.field_behavior) = OPTIONAL]; + * @param int $var + * @return $this + */ + public function setTargetNtpotMilliseconds($var) + { + GPBUtil::checkInt32($var); + $this->target_ntpot_milliseconds = $var; + + return $this; + } + + /** + * Optional. The target Time To First Token (TTFT) in milliseconds. TTFT is + * the time it takes to generate the first token for a request. If not + * provided, this target will not be enforced. + * + * Generated from protobuf field optional int32 target_ttft_milliseconds = 2 [(.google.api.field_behavior) = OPTIONAL]; + * @return int + */ + public function getTargetTtftMilliseconds() + { + return isset($this->target_ttft_milliseconds) ? $this->target_ttft_milliseconds : 0; + } + + public function hasTargetTtftMilliseconds() + { + return isset($this->target_ttft_milliseconds); + } + + public function clearTargetTtftMilliseconds() + { + unset($this->target_ttft_milliseconds); + } + + /** + * Optional. The target Time To First Token (TTFT) in milliseconds. TTFT is + * the time it takes to generate the first token for a request. If not + * provided, this target will not be enforced. + * + * Generated from protobuf field optional int32 target_ttft_milliseconds = 2 [(.google.api.field_behavior) = OPTIONAL]; + * @param int $var + * @return $this + */ + public function setTargetTtftMilliseconds($var) + { + GPBUtil::checkInt32($var); + $this->target_ttft_milliseconds = $var; + + return $this; + } + + /** + * Optional. The target cost for running a profile's model server. If not + * provided, this requirement will not be enforced. + * + * Generated from protobuf field .google.cloud.gkerecommender.v1.Cost target_cost = 3 [(.google.api.field_behavior) = OPTIONAL]; + * @return \Google\Cloud\GkeRecommender\V1\Cost|null + */ + public function getTargetCost() + { + return $this->target_cost; + } + + public function hasTargetCost() + { + return isset($this->target_cost); + } + + public function clearTargetCost() + { + unset($this->target_cost); + } + + /** + * Optional. The target cost for running a profile's model server. If not + * provided, this requirement will not be enforced. + * + * Generated from protobuf field .google.cloud.gkerecommender.v1.Cost target_cost = 3 [(.google.api.field_behavior) = OPTIONAL]; + * @param \Google\Cloud\GkeRecommender\V1\Cost $var + * @return $this + */ + public function setTargetCost($var) + { + GPBUtil::checkMessage($var, \Google\Cloud\GkeRecommender\V1\Cost::class); + $this->target_cost = $var; + + return $this; + } + +} + diff --git a/GkeRecommender/src/V1/PerformanceStats.php b/GkeRecommender/src/V1/PerformanceStats.php new file mode 100644 index 00000000000..14b47be8ed1 --- /dev/null +++ b/GkeRecommender/src/V1/PerformanceStats.php @@ -0,0 +1,231 @@ +google.cloud.gkerecommender.v1.PerformanceStats + */ +class PerformanceStats extends \Google\Protobuf\Internal\Message +{ + /** + * Output only. The number of queries per second. + * Note: This metric can vary widely based on context length and may not be a + * reliable measure of LLM throughput. + * + * Generated from protobuf field float queries_per_second = 1 [(.google.api.field_behavior) = OUTPUT_ONLY]; + */ + protected $queries_per_second = 0.0; + /** + * Output only. The number of output tokens per second. This is the throughput + * measured as total_output_tokens_generated_by_server / + * elapsed_time_in_seconds. + * + * Generated from protobuf field int32 output_tokens_per_second = 2 [(.google.api.field_behavior) = OUTPUT_ONLY]; + */ + protected $output_tokens_per_second = 0; + /** + * Output only. The Normalized Time Per Output Token (NTPOT) in milliseconds. + * This is the request latency normalized by the number of output tokens, + * measured as request_latency / total_output_tokens. + * + * Generated from protobuf field int32 ntpot_milliseconds = 3 [(.google.api.field_behavior) = OUTPUT_ONLY]; + */ + protected $ntpot_milliseconds = 0; + /** + * Output only. The Time To First Token (TTFT) in milliseconds. This is the + * time it takes to generate the first token for a request. + * + * Generated from protobuf field int32 ttft_milliseconds = 4 [(.google.api.field_behavior) = OUTPUT_ONLY]; + */ + protected $ttft_milliseconds = 0; + /** + * Output only. The cost of running the model deployment. + * + * Generated from protobuf field repeated .google.cloud.gkerecommender.v1.Cost cost = 5 [(.google.api.field_behavior) = OUTPUT_ONLY]; + */ + private $cost; + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type float $queries_per_second + * Output only. The number of queries per second. + * Note: This metric can vary widely based on context length and may not be a + * reliable measure of LLM throughput. + * @type int $output_tokens_per_second + * Output only. The number of output tokens per second. This is the throughput + * measured as total_output_tokens_generated_by_server / + * elapsed_time_in_seconds. + * @type int $ntpot_milliseconds + * Output only. The Normalized Time Per Output Token (NTPOT) in milliseconds. + * This is the request latency normalized by the number of output tokens, + * measured as request_latency / total_output_tokens. + * @type int $ttft_milliseconds + * Output only. The Time To First Token (TTFT) in milliseconds. This is the + * time it takes to generate the first token for a request. + * @type array<\Google\Cloud\GkeRecommender\V1\Cost>|\Google\Protobuf\Internal\RepeatedField $cost + * Output only. The cost of running the model deployment. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Cloud\Gkerecommender\V1\Gkerecommender::initOnce(); + parent::__construct($data); + } + + /** + * Output only. The number of queries per second. + * Note: This metric can vary widely based on context length and may not be a + * reliable measure of LLM throughput. + * + * Generated from protobuf field float queries_per_second = 1 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * @return float + */ + public function getQueriesPerSecond() + { + return $this->queries_per_second; + } + + /** + * Output only. The number of queries per second. + * Note: This metric can vary widely based on context length and may not be a + * reliable measure of LLM throughput. + * + * Generated from protobuf field float queries_per_second = 1 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * @param float $var + * @return $this + */ + public function setQueriesPerSecond($var) + { + GPBUtil::checkFloat($var); + $this->queries_per_second = $var; + + return $this; + } + + /** + * Output only. The number of output tokens per second. This is the throughput + * measured as total_output_tokens_generated_by_server / + * elapsed_time_in_seconds. + * + * Generated from protobuf field int32 output_tokens_per_second = 2 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * @return int + */ + public function getOutputTokensPerSecond() + { + return $this->output_tokens_per_second; + } + + /** + * Output only. The number of output tokens per second. This is the throughput + * measured as total_output_tokens_generated_by_server / + * elapsed_time_in_seconds. + * + * Generated from protobuf field int32 output_tokens_per_second = 2 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * @param int $var + * @return $this + */ + public function setOutputTokensPerSecond($var) + { + GPBUtil::checkInt32($var); + $this->output_tokens_per_second = $var; + + return $this; + } + + /** + * Output only. The Normalized Time Per Output Token (NTPOT) in milliseconds. + * This is the request latency normalized by the number of output tokens, + * measured as request_latency / total_output_tokens. + * + * Generated from protobuf field int32 ntpot_milliseconds = 3 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * @return int + */ + public function getNtpotMilliseconds() + { + return $this->ntpot_milliseconds; + } + + /** + * Output only. The Normalized Time Per Output Token (NTPOT) in milliseconds. + * This is the request latency normalized by the number of output tokens, + * measured as request_latency / total_output_tokens. + * + * Generated from protobuf field int32 ntpot_milliseconds = 3 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * @param int $var + * @return $this + */ + public function setNtpotMilliseconds($var) + { + GPBUtil::checkInt32($var); + $this->ntpot_milliseconds = $var; + + return $this; + } + + /** + * Output only. The Time To First Token (TTFT) in milliseconds. This is the + * time it takes to generate the first token for a request. + * + * Generated from protobuf field int32 ttft_milliseconds = 4 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * @return int + */ + public function getTtftMilliseconds() + { + return $this->ttft_milliseconds; + } + + /** + * Output only. The Time To First Token (TTFT) in milliseconds. This is the + * time it takes to generate the first token for a request. + * + * Generated from protobuf field int32 ttft_milliseconds = 4 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * @param int $var + * @return $this + */ + public function setTtftMilliseconds($var) + { + GPBUtil::checkInt32($var); + $this->ttft_milliseconds = $var; + + return $this; + } + + /** + * Output only. The cost of running the model deployment. + * + * Generated from protobuf field repeated .google.cloud.gkerecommender.v1.Cost cost = 5 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * @return \Google\Protobuf\Internal\RepeatedField + */ + public function getCost() + { + return $this->cost; + } + + /** + * Output only. The cost of running the model deployment. + * + * Generated from protobuf field repeated .google.cloud.gkerecommender.v1.Cost cost = 5 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * @param array<\Google\Cloud\GkeRecommender\V1\Cost>|\Google\Protobuf\Internal\RepeatedField $var + * @return $this + */ + public function setCost($var) + { + $arr = GPBUtil::checkRepeatedField($var, \Google\Protobuf\Internal\GPBType::MESSAGE, \Google\Cloud\GkeRecommender\V1\Cost::class); + $this->cost = $arr; + + return $this; + } + +} + diff --git a/GkeRecommender/src/V1/Profile.php b/GkeRecommender/src/V1/Profile.php new file mode 100644 index 00000000000..3c015145d69 --- /dev/null +++ b/GkeRecommender/src/V1/Profile.php @@ -0,0 +1,265 @@ +google.cloud.gkerecommender.v1.Profile + */ +class Profile extends \Google\Protobuf\Internal\Message +{ + /** + * Output only. The model server configuration. Use + * [GkeInferenceQuickstart.FetchProfiles][google.cloud.gkerecommender.v1.GkeInferenceQuickstart.FetchProfiles] + * to find valid configurations. + * + * Generated from protobuf field .google.cloud.gkerecommender.v1.ModelServerInfo model_server_info = 1 [(.google.api.field_behavior) = OUTPUT_ONLY]; + */ + protected $model_server_info = null; + /** + * Output only. The accelerator type. Expected format: `nvidia-h100-80gb`. + * + * Generated from protobuf field string accelerator_type = 2 [(.google.api.field_behavior) = OUTPUT_ONLY]; + */ + protected $accelerator_type = ''; + /** + * Output only. The TPU topology (if applicable). + * + * Generated from protobuf field string tpu_topology = 3 [(.google.api.field_behavior) = OUTPUT_ONLY]; + */ + protected $tpu_topology = ''; + /** + * Output only. The instance type. Expected format: `a2-highgpu-1g`. + * + * Generated from protobuf field string instance_type = 4 [(.google.api.field_behavior) = OUTPUT_ONLY]; + */ + protected $instance_type = ''; + /** + * Output only. The resources used by the model deployment. + * + * Generated from protobuf field .google.cloud.gkerecommender.v1.ResourcesUsed resources_used = 5 [(.google.api.field_behavior) = OUTPUT_ONLY]; + */ + protected $resources_used = null; + /** + * Output only. The performance statistics for this profile. + * + * Generated from protobuf field repeated .google.cloud.gkerecommender.v1.PerformanceStats performance_stats = 6 [(.google.api.field_behavior) = OUTPUT_ONLY]; + */ + private $performance_stats; + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type \Google\Cloud\GkeRecommender\V1\ModelServerInfo $model_server_info + * Output only. The model server configuration. Use + * [GkeInferenceQuickstart.FetchProfiles][google.cloud.gkerecommender.v1.GkeInferenceQuickstart.FetchProfiles] + * to find valid configurations. + * @type string $accelerator_type + * Output only. The accelerator type. Expected format: `nvidia-h100-80gb`. + * @type string $tpu_topology + * Output only. The TPU topology (if applicable). + * @type string $instance_type + * Output only. The instance type. Expected format: `a2-highgpu-1g`. + * @type \Google\Cloud\GkeRecommender\V1\ResourcesUsed $resources_used + * Output only. The resources used by the model deployment. + * @type array<\Google\Cloud\GkeRecommender\V1\PerformanceStats>|\Google\Protobuf\Internal\RepeatedField $performance_stats + * Output only. The performance statistics for this profile. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Cloud\Gkerecommender\V1\Gkerecommender::initOnce(); + parent::__construct($data); + } + + /** + * Output only. The model server configuration. Use + * [GkeInferenceQuickstart.FetchProfiles][google.cloud.gkerecommender.v1.GkeInferenceQuickstart.FetchProfiles] + * to find valid configurations. + * + * Generated from protobuf field .google.cloud.gkerecommender.v1.ModelServerInfo model_server_info = 1 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * @return \Google\Cloud\GkeRecommender\V1\ModelServerInfo|null + */ + public function getModelServerInfo() + { + return $this->model_server_info; + } + + public function hasModelServerInfo() + { + return isset($this->model_server_info); + } + + public function clearModelServerInfo() + { + unset($this->model_server_info); + } + + /** + * Output only. The model server configuration. Use + * [GkeInferenceQuickstart.FetchProfiles][google.cloud.gkerecommender.v1.GkeInferenceQuickstart.FetchProfiles] + * to find valid configurations. + * + * Generated from protobuf field .google.cloud.gkerecommender.v1.ModelServerInfo model_server_info = 1 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * @param \Google\Cloud\GkeRecommender\V1\ModelServerInfo $var + * @return $this + */ + public function setModelServerInfo($var) + { + GPBUtil::checkMessage($var, \Google\Cloud\GkeRecommender\V1\ModelServerInfo::class); + $this->model_server_info = $var; + + return $this; + } + + /** + * Output only. The accelerator type. Expected format: `nvidia-h100-80gb`. + * + * Generated from protobuf field string accelerator_type = 2 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * @return string + */ + public function getAcceleratorType() + { + return $this->accelerator_type; + } + + /** + * Output only. The accelerator type. Expected format: `nvidia-h100-80gb`. + * + * Generated from protobuf field string accelerator_type = 2 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * @param string $var + * @return $this + */ + public function setAcceleratorType($var) + { + GPBUtil::checkString($var, True); + $this->accelerator_type = $var; + + return $this; + } + + /** + * Output only. The TPU topology (if applicable). + * + * Generated from protobuf field string tpu_topology = 3 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * @return string + */ + public function getTpuTopology() + { + return $this->tpu_topology; + } + + /** + * Output only. The TPU topology (if applicable). + * + * Generated from protobuf field string tpu_topology = 3 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * @param string $var + * @return $this + */ + public function setTpuTopology($var) + { + GPBUtil::checkString($var, True); + $this->tpu_topology = $var; + + return $this; + } + + /** + * Output only. The instance type. Expected format: `a2-highgpu-1g`. + * + * Generated from protobuf field string instance_type = 4 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * @return string + */ + public function getInstanceType() + { + return $this->instance_type; + } + + /** + * Output only. The instance type. Expected format: `a2-highgpu-1g`. + * + * Generated from protobuf field string instance_type = 4 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * @param string $var + * @return $this + */ + public function setInstanceType($var) + { + GPBUtil::checkString($var, True); + $this->instance_type = $var; + + return $this; + } + + /** + * Output only. The resources used by the model deployment. + * + * Generated from protobuf field .google.cloud.gkerecommender.v1.ResourcesUsed resources_used = 5 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * @return \Google\Cloud\GkeRecommender\V1\ResourcesUsed|null + */ + public function getResourcesUsed() + { + return $this->resources_used; + } + + public function hasResourcesUsed() + { + return isset($this->resources_used); + } + + public function clearResourcesUsed() + { + unset($this->resources_used); + } + + /** + * Output only. The resources used by the model deployment. + * + * Generated from protobuf field .google.cloud.gkerecommender.v1.ResourcesUsed resources_used = 5 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * @param \Google\Cloud\GkeRecommender\V1\ResourcesUsed $var + * @return $this + */ + public function setResourcesUsed($var) + { + GPBUtil::checkMessage($var, \Google\Cloud\GkeRecommender\V1\ResourcesUsed::class); + $this->resources_used = $var; + + return $this; + } + + /** + * Output only. The performance statistics for this profile. + * + * Generated from protobuf field repeated .google.cloud.gkerecommender.v1.PerformanceStats performance_stats = 6 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * @return \Google\Protobuf\Internal\RepeatedField + */ + public function getPerformanceStats() + { + return $this->performance_stats; + } + + /** + * Output only. The performance statistics for this profile. + * + * Generated from protobuf field repeated .google.cloud.gkerecommender.v1.PerformanceStats performance_stats = 6 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * @param array<\Google\Cloud\GkeRecommender\V1\PerformanceStats>|\Google\Protobuf\Internal\RepeatedField $var + * @return $this + */ + public function setPerformanceStats($var) + { + $arr = GPBUtil::checkRepeatedField($var, \Google\Protobuf\Internal\GPBType::MESSAGE, \Google\Cloud\GkeRecommender\V1\PerformanceStats::class); + $this->performance_stats = $arr; + + return $this; + } + +} + diff --git a/GkeRecommender/src/V1/ResourcesUsed.php b/GkeRecommender/src/V1/ResourcesUsed.php new file mode 100644 index 00000000000..b6e6e65ef03 --- /dev/null +++ b/GkeRecommender/src/V1/ResourcesUsed.php @@ -0,0 +1,71 @@ +google.cloud.gkerecommender.v1.ResourcesUsed + */ +class ResourcesUsed extends \Google\Protobuf\Internal\Message +{ + /** + * Output only. The number of accelerators (e.g., GPUs or TPUs) used by the + * model deployment on the Kubernetes node. + * + * Generated from protobuf field int32 accelerator_count = 1 [(.google.api.field_behavior) = OUTPUT_ONLY]; + */ + protected $accelerator_count = 0; + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type int $accelerator_count + * Output only. The number of accelerators (e.g., GPUs or TPUs) used by the + * model deployment on the Kubernetes node. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Cloud\Gkerecommender\V1\Gkerecommender::initOnce(); + parent::__construct($data); + } + + /** + * Output only. The number of accelerators (e.g., GPUs or TPUs) used by the + * model deployment on the Kubernetes node. + * + * Generated from protobuf field int32 accelerator_count = 1 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * @return int + */ + public function getAcceleratorCount() + { + return $this->accelerator_count; + } + + /** + * Output only. The number of accelerators (e.g., GPUs or TPUs) used by the + * model deployment on the Kubernetes node. + * + * Generated from protobuf field int32 accelerator_count = 1 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * @param int $var + * @return $this + */ + public function setAcceleratorCount($var) + { + GPBUtil::checkInt32($var); + $this->accelerator_count = $var; + + return $this; + } + +} + diff --git a/GkeRecommender/src/V1/StorageConfig.php b/GkeRecommender/src/V1/StorageConfig.php new file mode 100644 index 00000000000..c18e27b22d2 --- /dev/null +++ b/GkeRecommender/src/V1/StorageConfig.php @@ -0,0 +1,129 @@ +google.cloud.gkerecommender.v1.StorageConfig + */ +class StorageConfig extends \Google\Protobuf\Internal\Message +{ + /** + * Optional. The Google Cloud Storage bucket URI to load the model from. This + * URI must point to the directory containing the model's config file + * (`config.json`) and model weights. A tuned GCSFuse setup can improve + * LLM Pod startup time by more than 7x. Expected format: + * `gs:///`. + * + * Generated from protobuf field string model_bucket_uri = 1 [(.google.api.field_behavior) = OPTIONAL]; + */ + protected $model_bucket_uri = ''; + /** + * Optional. The URI for the GCS bucket containing the XLA compilation cache. + * If using TPUs, the XLA cache will be written to the same path as + * `model_bucket_uri`. This can speed up vLLM model preparation for repeated + * deployments. + * + * Generated from protobuf field string xla_cache_bucket_uri = 2 [(.google.api.field_behavior) = OPTIONAL]; + */ + protected $xla_cache_bucket_uri = ''; + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type string $model_bucket_uri + * Optional. The Google Cloud Storage bucket URI to load the model from. This + * URI must point to the directory containing the model's config file + * (`config.json`) and model weights. A tuned GCSFuse setup can improve + * LLM Pod startup time by more than 7x. Expected format: + * `gs:///`. + * @type string $xla_cache_bucket_uri + * Optional. The URI for the GCS bucket containing the XLA compilation cache. + * If using TPUs, the XLA cache will be written to the same path as + * `model_bucket_uri`. This can speed up vLLM model preparation for repeated + * deployments. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Cloud\Gkerecommender\V1\Gkerecommender::initOnce(); + parent::__construct($data); + } + + /** + * Optional. The Google Cloud Storage bucket URI to load the model from. This + * URI must point to the directory containing the model's config file + * (`config.json`) and model weights. A tuned GCSFuse setup can improve + * LLM Pod startup time by more than 7x. Expected format: + * `gs:///`. + * + * Generated from protobuf field string model_bucket_uri = 1 [(.google.api.field_behavior) = OPTIONAL]; + * @return string + */ + public function getModelBucketUri() + { + return $this->model_bucket_uri; + } + + /** + * Optional. The Google Cloud Storage bucket URI to load the model from. This + * URI must point to the directory containing the model's config file + * (`config.json`) and model weights. A tuned GCSFuse setup can improve + * LLM Pod startup time by more than 7x. Expected format: + * `gs:///`. + * + * Generated from protobuf field string model_bucket_uri = 1 [(.google.api.field_behavior) = OPTIONAL]; + * @param string $var + * @return $this + */ + public function setModelBucketUri($var) + { + GPBUtil::checkString($var, True); + $this->model_bucket_uri = $var; + + return $this; + } + + /** + * Optional. The URI for the GCS bucket containing the XLA compilation cache. + * If using TPUs, the XLA cache will be written to the same path as + * `model_bucket_uri`. This can speed up vLLM model preparation for repeated + * deployments. + * + * Generated from protobuf field string xla_cache_bucket_uri = 2 [(.google.api.field_behavior) = OPTIONAL]; + * @return string + */ + public function getXlaCacheBucketUri() + { + return $this->xla_cache_bucket_uri; + } + + /** + * Optional. The URI for the GCS bucket containing the XLA compilation cache. + * If using TPUs, the XLA cache will be written to the same path as + * `model_bucket_uri`. This can speed up vLLM model preparation for repeated + * deployments. + * + * Generated from protobuf field string xla_cache_bucket_uri = 2 [(.google.api.field_behavior) = OPTIONAL]; + * @param string $var + * @return $this + */ + public function setXlaCacheBucketUri($var) + { + GPBUtil::checkString($var, True); + $this->xla_cache_bucket_uri = $var; + + return $this; + } + +} + diff --git a/GkeRecommender/src/V1/TokensPerSecondRange.php b/GkeRecommender/src/V1/TokensPerSecondRange.php new file mode 100644 index 00000000000..a7a89555762 --- /dev/null +++ b/GkeRecommender/src/V1/TokensPerSecondRange.php @@ -0,0 +1,101 @@ +google.cloud.gkerecommender.v1.TokensPerSecondRange + */ +class TokensPerSecondRange extends \Google\Protobuf\Internal\Message +{ + /** + * Output only. The minimum value of the range. + * + * Generated from protobuf field int32 min = 1 [(.google.api.field_behavior) = OUTPUT_ONLY]; + */ + protected $min = 0; + /** + * Output only. The maximum value of the range. + * + * Generated from protobuf field int32 max = 2 [(.google.api.field_behavior) = OUTPUT_ONLY]; + */ + protected $max = 0; + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type int $min + * Output only. The minimum value of the range. + * @type int $max + * Output only. The maximum value of the range. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Cloud\Gkerecommender\V1\Gkerecommender::initOnce(); + parent::__construct($data); + } + + /** + * Output only. The minimum value of the range. + * + * Generated from protobuf field int32 min = 1 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * @return int + */ + public function getMin() + { + return $this->min; + } + + /** + * Output only. The minimum value of the range. + * + * Generated from protobuf field int32 min = 1 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * @param int $var + * @return $this + */ + public function setMin($var) + { + GPBUtil::checkInt32($var); + $this->min = $var; + + return $this; + } + + /** + * Output only. The maximum value of the range. + * + * Generated from protobuf field int32 max = 2 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * @return int + */ + public function getMax() + { + return $this->max; + } + + /** + * Output only. The maximum value of the range. + * + * Generated from protobuf field int32 max = 2 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * @param int $var + * @return $this + */ + public function setMax($var) + { + GPBUtil::checkInt32($var); + $this->max = $var; + + return $this; + } + +} + diff --git a/GkeRecommender/src/V1/gapic_metadata.json b/GkeRecommender/src/V1/gapic_metadata.json new file mode 100644 index 00000000000..06f29247d57 --- /dev/null +++ b/GkeRecommender/src/V1/gapic_metadata.json @@ -0,0 +1,48 @@ +{ + "schema": "1.0", + "comment": "This file maps proto services\/RPCs to the corresponding library clients\/methods", + "language": "php", + "protoPackage": "google.cloud.gkerecommender.v1", + "libraryPackage": "Google\\Cloud\\GkeRecommender\\V1", + "services": { + "GkeInferenceQuickstart": { + "clients": { + "grpc": { + "libraryClient": "GkeInferenceQuickstartGapicClient", + "rpcs": { + "FetchBenchmarkingData": { + "methods": [ + "fetchBenchmarkingData" + ] + }, + "FetchModelServerVersions": { + "methods": [ + "fetchModelServerVersions" + ] + }, + "FetchModelServers": { + "methods": [ + "fetchModelServers" + ] + }, + "FetchModels": { + "methods": [ + "fetchModels" + ] + }, + "FetchProfiles": { + "methods": [ + "fetchProfiles" + ] + }, + "GenerateOptimizedManifest": { + "methods": [ + "generateOptimizedManifest" + ] + } + } + } + } + } + } +} \ No newline at end of file diff --git a/GkeRecommender/src/V1/resources/gke_inference_quickstart_client_config.json b/GkeRecommender/src/V1/resources/gke_inference_quickstart_client_config.json new file mode 100644 index 00000000000..9c204ab6813 --- /dev/null +++ b/GkeRecommender/src/V1/resources/gke_inference_quickstart_client_config.json @@ -0,0 +1,62 @@ +{ + "interfaces": { + "google.cloud.gkerecommender.v1.GkeInferenceQuickstart": { + "retry_codes": { + "no_retry_codes": [], + "no_retry_1_codes": [] + }, + "retry_params": { + "no_retry_params": { + "initial_retry_delay_millis": 0, + "retry_delay_multiplier": 0.0, + "max_retry_delay_millis": 0, + "initial_rpc_timeout_millis": 0, + "rpc_timeout_multiplier": 1.0, + "max_rpc_timeout_millis": 0, + "total_timeout_millis": 0 + }, + "no_retry_1_params": { + "initial_retry_delay_millis": 0, + "retry_delay_multiplier": 0.0, + "max_retry_delay_millis": 0, + "initial_rpc_timeout_millis": 60000, + "rpc_timeout_multiplier": 1.0, + "max_rpc_timeout_millis": 60000, + "total_timeout_millis": 60000 + } + }, + "methods": { + "FetchBenchmarkingData": { + "timeout_millis": 60000, + "retry_codes_name": "no_retry_1_codes", + "retry_params_name": "no_retry_1_params" + }, + "FetchModelServerVersions": { + "timeout_millis": 60000, + "retry_codes_name": "no_retry_1_codes", + "retry_params_name": "no_retry_1_params" + }, + "FetchModelServers": { + "timeout_millis": 60000, + "retry_codes_name": "no_retry_1_codes", + "retry_params_name": "no_retry_1_params" + }, + "FetchModels": { + "timeout_millis": 60000, + "retry_codes_name": "no_retry_1_codes", + "retry_params_name": "no_retry_1_params" + }, + "FetchProfiles": { + "timeout_millis": 60000, + "retry_codes_name": "no_retry_1_codes", + "retry_params_name": "no_retry_1_params" + }, + "GenerateOptimizedManifest": { + "timeout_millis": 60000, + "retry_codes_name": "no_retry_1_codes", + "retry_params_name": "no_retry_1_params" + } + } + } + } +} diff --git a/GkeRecommender/src/V1/resources/gke_inference_quickstart_descriptor_config.php b/GkeRecommender/src/V1/resources/gke_inference_quickstart_descriptor_config.php new file mode 100644 index 00000000000..9afccfc31a5 --- /dev/null +++ b/GkeRecommender/src/V1/resources/gke_inference_quickstart_descriptor_config.php @@ -0,0 +1,84 @@ + [ + 'google.cloud.gkerecommender.v1.GkeInferenceQuickstart' => [ + 'FetchBenchmarkingData' => [ + 'callType' => \Google\ApiCore\Call::UNARY_CALL, + 'responseType' => 'Google\Cloud\GkeRecommender\V1\FetchBenchmarkingDataResponse', + ], + 'FetchModelServerVersions' => [ + 'pageStreaming' => [ + 'requestPageTokenGetMethod' => 'getPageToken', + 'requestPageTokenSetMethod' => 'setPageToken', + 'requestPageSizeGetMethod' => 'getPageSize', + 'requestPageSizeSetMethod' => 'setPageSize', + 'responsePageTokenGetMethod' => 'getNextPageToken', + 'resourcesGetMethod' => 'getModelServerVersions', + ], + 'callType' => \Google\ApiCore\Call::PAGINATED_CALL, + 'responseType' => 'Google\Cloud\GkeRecommender\V1\FetchModelServerVersionsResponse', + ], + 'FetchModelServers' => [ + 'pageStreaming' => [ + 'requestPageTokenGetMethod' => 'getPageToken', + 'requestPageTokenSetMethod' => 'setPageToken', + 'requestPageSizeGetMethod' => 'getPageSize', + 'requestPageSizeSetMethod' => 'setPageSize', + 'responsePageTokenGetMethod' => 'getNextPageToken', + 'resourcesGetMethod' => 'getModelServers', + ], + 'callType' => \Google\ApiCore\Call::PAGINATED_CALL, + 'responseType' => 'Google\Cloud\GkeRecommender\V1\FetchModelServersResponse', + ], + 'FetchModels' => [ + 'pageStreaming' => [ + 'requestPageTokenGetMethod' => 'getPageToken', + 'requestPageTokenSetMethod' => 'setPageToken', + 'requestPageSizeGetMethod' => 'getPageSize', + 'requestPageSizeSetMethod' => 'setPageSize', + 'responsePageTokenGetMethod' => 'getNextPageToken', + 'resourcesGetMethod' => 'getModels', + ], + 'callType' => \Google\ApiCore\Call::PAGINATED_CALL, + 'responseType' => 'Google\Cloud\GkeRecommender\V1\FetchModelsResponse', + ], + 'FetchProfiles' => [ + 'pageStreaming' => [ + 'requestPageTokenGetMethod' => 'getPageToken', + 'requestPageTokenSetMethod' => 'setPageToken', + 'requestPageSizeGetMethod' => 'getPageSize', + 'requestPageSizeSetMethod' => 'setPageSize', + 'responsePageTokenGetMethod' => 'getNextPageToken', + 'resourcesGetMethod' => 'getProfile', + ], + 'callType' => \Google\ApiCore\Call::PAGINATED_CALL, + 'responseType' => 'Google\Cloud\GkeRecommender\V1\FetchProfilesResponse', + ], + 'GenerateOptimizedManifest' => [ + 'callType' => \Google\ApiCore\Call::UNARY_CALL, + 'responseType' => 'Google\Cloud\GkeRecommender\V1\GenerateOptimizedManifestResponse', + ], + ], + ], +]; diff --git a/GkeRecommender/src/V1/resources/gke_inference_quickstart_rest_client_config.php b/GkeRecommender/src/V1/resources/gke_inference_quickstart_rest_client_config.php new file mode 100644 index 00000000000..4fb8960ce90 --- /dev/null +++ b/GkeRecommender/src/V1/resources/gke_inference_quickstart_rest_client_config.php @@ -0,0 +1,56 @@ + [ + 'google.cloud.gkerecommender.v1.GkeInferenceQuickstart' => [ + 'FetchBenchmarkingData' => [ + 'method' => 'post', + 'uriTemplate' => '/v1/benchmarkingData:fetch', + 'body' => '*', + ], + 'FetchModelServerVersions' => [ + 'method' => 'get', + 'uriTemplate' => '/v1/modelServerVersions:fetch', + ], + 'FetchModelServers' => [ + 'method' => 'get', + 'uriTemplate' => '/v1/modelServers:fetch', + ], + 'FetchModels' => [ + 'method' => 'get', + 'uriTemplate' => '/v1/models:fetch', + ], + 'FetchProfiles' => [ + 'method' => 'post', + 'uriTemplate' => '/v1/profiles:fetch', + 'body' => '*', + ], + 'GenerateOptimizedManifest' => [ + 'method' => 'post', + 'uriTemplate' => '/v1/optimizedManifest:generate', + 'body' => '*', + ], + ], + ], + 'numericEnums' => true, +]; diff --git a/GkeRecommender/tests/Unit/V1/Client/GkeInferenceQuickstartClientTest.php b/GkeRecommender/tests/Unit/V1/Client/GkeInferenceQuickstartClientTest.php new file mode 100644 index 00000000000..dfb6cc90a39 --- /dev/null +++ b/GkeRecommender/tests/Unit/V1/Client/GkeInferenceQuickstartClientTest.php @@ -0,0 +1,548 @@ +getMockBuilder(CredentialsWrapper::class) + ->disableOriginalConstructor() + ->getMock(); + } + + /** @return GkeInferenceQuickstartClient */ + private function createClient(array $options = []) + { + $options += [ + 'credentials' => $this->createCredentials(), + ]; + return new GkeInferenceQuickstartClient($options); + } + + /** @test */ + public function fetchBenchmarkingDataTest() + { + $transport = $this->createTransport(); + $gapicClient = $this->createClient([ + 'transport' => $transport, + ]); + $this->assertTrue($transport->isExhausted()); + // Mock response + $expectedResponse = new FetchBenchmarkingDataResponse(); + $transport->addResponse($expectedResponse); + // Mock request + $modelServerInfo = new ModelServerInfo(); + $modelServerInfoModel = 'modelServerInfoModel-637750097'; + $modelServerInfo->setModel($modelServerInfoModel); + $modelServerInfoModelServer = 'modelServerInfoModelServer191844562'; + $modelServerInfo->setModelServer($modelServerInfoModelServer); + $request = (new FetchBenchmarkingDataRequest())->setModelServerInfo($modelServerInfo); + $response = $gapicClient->fetchBenchmarkingData($request); + $this->assertEquals($expectedResponse, $response); + $actualRequests = $transport->popReceivedCalls(); + $this->assertSame(1, count($actualRequests)); + $actualFuncCall = $actualRequests[0]->getFuncCall(); + $actualRequestObject = $actualRequests[0]->getRequestObject(); + $this->assertSame( + '/google.cloud.gkerecommender.v1.GkeInferenceQuickstart/FetchBenchmarkingData', + $actualFuncCall + ); + $actualValue = $actualRequestObject->getModelServerInfo(); + $this->assertProtobufEquals($modelServerInfo, $actualValue); + $this->assertTrue($transport->isExhausted()); + } + + /** @test */ + public function fetchBenchmarkingDataExceptionTest() + { + $transport = $this->createTransport(); + $gapicClient = $this->createClient([ + 'transport' => $transport, + ]); + $this->assertTrue($transport->isExhausted()); + $status = new stdClass(); + $status->code = Code::DATA_LOSS; + $status->details = 'internal error'; + $expectedExceptionMessage = json_encode( + [ + 'message' => 'internal error', + 'code' => Code::DATA_LOSS, + 'status' => 'DATA_LOSS', + 'details' => [], + ], + JSON_PRETTY_PRINT + ); + $transport->addResponse(null, $status); + // Mock request + $modelServerInfo = new ModelServerInfo(); + $modelServerInfoModel = 'modelServerInfoModel-637750097'; + $modelServerInfo->setModel($modelServerInfoModel); + $modelServerInfoModelServer = 'modelServerInfoModelServer191844562'; + $modelServerInfo->setModelServer($modelServerInfoModelServer); + $request = (new FetchBenchmarkingDataRequest())->setModelServerInfo($modelServerInfo); + try { + $gapicClient->fetchBenchmarkingData($request); + // If the $gapicClient method call did not throw, fail the test + $this->fail('Expected an ApiException, but no exception was thrown.'); + } catch (ApiException $ex) { + $this->assertEquals($status->code, $ex->getCode()); + $this->assertEquals($expectedExceptionMessage, $ex->getMessage()); + } + // Call popReceivedCalls to ensure the stub is exhausted + $transport->popReceivedCalls(); + $this->assertTrue($transport->isExhausted()); + } + + /** @test */ + public function fetchModelServerVersionsTest() + { + $transport = $this->createTransport(); + $gapicClient = $this->createClient([ + 'transport' => $transport, + ]); + $this->assertTrue($transport->isExhausted()); + // Mock response + $nextPageToken = ''; + $modelServerVersionsElement = 'modelServerVersionsElement1714360254'; + $modelServerVersions = [$modelServerVersionsElement]; + $expectedResponse = new FetchModelServerVersionsResponse(); + $expectedResponse->setNextPageToken($nextPageToken); + $expectedResponse->setModelServerVersions($modelServerVersions); + $transport->addResponse($expectedResponse); + // Mock request + $model = 'model104069929'; + $modelServer = 'modelServer-1179367'; + $request = (new FetchModelServerVersionsRequest())->setModel($model)->setModelServer($modelServer); + $response = $gapicClient->fetchModelServerVersions($request); + $this->assertEquals($expectedResponse, $response->getPage()->getResponseObject()); + $resources = iterator_to_array($response->iterateAllElements()); + $this->assertSame(1, count($resources)); + $this->assertEquals($expectedResponse->getModelServerVersions()[0], $resources[0]); + $actualRequests = $transport->popReceivedCalls(); + $this->assertSame(1, count($actualRequests)); + $actualFuncCall = $actualRequests[0]->getFuncCall(); + $actualRequestObject = $actualRequests[0]->getRequestObject(); + $this->assertSame( + '/google.cloud.gkerecommender.v1.GkeInferenceQuickstart/FetchModelServerVersions', + $actualFuncCall + ); + $actualValue = $actualRequestObject->getModel(); + $this->assertProtobufEquals($model, $actualValue); + $actualValue = $actualRequestObject->getModelServer(); + $this->assertProtobufEquals($modelServer, $actualValue); + $this->assertTrue($transport->isExhausted()); + } + + /** @test */ + public function fetchModelServerVersionsExceptionTest() + { + $transport = $this->createTransport(); + $gapicClient = $this->createClient([ + 'transport' => $transport, + ]); + $this->assertTrue($transport->isExhausted()); + $status = new stdClass(); + $status->code = Code::DATA_LOSS; + $status->details = 'internal error'; + $expectedExceptionMessage = json_encode( + [ + 'message' => 'internal error', + 'code' => Code::DATA_LOSS, + 'status' => 'DATA_LOSS', + 'details' => [], + ], + JSON_PRETTY_PRINT + ); + $transport->addResponse(null, $status); + // Mock request + $model = 'model104069929'; + $modelServer = 'modelServer-1179367'; + $request = (new FetchModelServerVersionsRequest())->setModel($model)->setModelServer($modelServer); + try { + $gapicClient->fetchModelServerVersions($request); + // If the $gapicClient method call did not throw, fail the test + $this->fail('Expected an ApiException, but no exception was thrown.'); + } catch (ApiException $ex) { + $this->assertEquals($status->code, $ex->getCode()); + $this->assertEquals($expectedExceptionMessage, $ex->getMessage()); + } + // Call popReceivedCalls to ensure the stub is exhausted + $transport->popReceivedCalls(); + $this->assertTrue($transport->isExhausted()); + } + + /** @test */ + public function fetchModelServersTest() + { + $transport = $this->createTransport(); + $gapicClient = $this->createClient([ + 'transport' => $transport, + ]); + $this->assertTrue($transport->isExhausted()); + // Mock response + $nextPageToken = ''; + $modelServersElement = 'modelServersElement-190853577'; + $modelServers = [$modelServersElement]; + $expectedResponse = new FetchModelServersResponse(); + $expectedResponse->setNextPageToken($nextPageToken); + $expectedResponse->setModelServers($modelServers); + $transport->addResponse($expectedResponse); + // Mock request + $model = 'model104069929'; + $request = (new FetchModelServersRequest())->setModel($model); + $response = $gapicClient->fetchModelServers($request); + $this->assertEquals($expectedResponse, $response->getPage()->getResponseObject()); + $resources = iterator_to_array($response->iterateAllElements()); + $this->assertSame(1, count($resources)); + $this->assertEquals($expectedResponse->getModelServers()[0], $resources[0]); + $actualRequests = $transport->popReceivedCalls(); + $this->assertSame(1, count($actualRequests)); + $actualFuncCall = $actualRequests[0]->getFuncCall(); + $actualRequestObject = $actualRequests[0]->getRequestObject(); + $this->assertSame('/google.cloud.gkerecommender.v1.GkeInferenceQuickstart/FetchModelServers', $actualFuncCall); + $actualValue = $actualRequestObject->getModel(); + $this->assertProtobufEquals($model, $actualValue); + $this->assertTrue($transport->isExhausted()); + } + + /** @test */ + public function fetchModelServersExceptionTest() + { + $transport = $this->createTransport(); + $gapicClient = $this->createClient([ + 'transport' => $transport, + ]); + $this->assertTrue($transport->isExhausted()); + $status = new stdClass(); + $status->code = Code::DATA_LOSS; + $status->details = 'internal error'; + $expectedExceptionMessage = json_encode( + [ + 'message' => 'internal error', + 'code' => Code::DATA_LOSS, + 'status' => 'DATA_LOSS', + 'details' => [], + ], + JSON_PRETTY_PRINT + ); + $transport->addResponse(null, $status); + // Mock request + $model = 'model104069929'; + $request = (new FetchModelServersRequest())->setModel($model); + try { + $gapicClient->fetchModelServers($request); + // If the $gapicClient method call did not throw, fail the test + $this->fail('Expected an ApiException, but no exception was thrown.'); + } catch (ApiException $ex) { + $this->assertEquals($status->code, $ex->getCode()); + $this->assertEquals($expectedExceptionMessage, $ex->getMessage()); + } + // Call popReceivedCalls to ensure the stub is exhausted + $transport->popReceivedCalls(); + $this->assertTrue($transport->isExhausted()); + } + + /** @test */ + public function fetchModelsTest() + { + $transport = $this->createTransport(); + $gapicClient = $this->createClient([ + 'transport' => $transport, + ]); + $this->assertTrue($transport->isExhausted()); + // Mock response + $nextPageToken = ''; + $modelsElement = 'modelsElement688530983'; + $models = [$modelsElement]; + $expectedResponse = new FetchModelsResponse(); + $expectedResponse->setNextPageToken($nextPageToken); + $expectedResponse->setModels($models); + $transport->addResponse($expectedResponse); + $request = new FetchModelsRequest(); + $response = $gapicClient->fetchModels($request); + $this->assertEquals($expectedResponse, $response->getPage()->getResponseObject()); + $resources = iterator_to_array($response->iterateAllElements()); + $this->assertSame(1, count($resources)); + $this->assertEquals($expectedResponse->getModels()[0], $resources[0]); + $actualRequests = $transport->popReceivedCalls(); + $this->assertSame(1, count($actualRequests)); + $actualFuncCall = $actualRequests[0]->getFuncCall(); + $actualRequestObject = $actualRequests[0]->getRequestObject(); + $this->assertSame('/google.cloud.gkerecommender.v1.GkeInferenceQuickstart/FetchModels', $actualFuncCall); + $this->assertTrue($transport->isExhausted()); + } + + /** @test */ + public function fetchModelsExceptionTest() + { + $transport = $this->createTransport(); + $gapicClient = $this->createClient([ + 'transport' => $transport, + ]); + $this->assertTrue($transport->isExhausted()); + $status = new stdClass(); + $status->code = Code::DATA_LOSS; + $status->details = 'internal error'; + $expectedExceptionMessage = json_encode( + [ + 'message' => 'internal error', + 'code' => Code::DATA_LOSS, + 'status' => 'DATA_LOSS', + 'details' => [], + ], + JSON_PRETTY_PRINT + ); + $transport->addResponse(null, $status); + $request = new FetchModelsRequest(); + try { + $gapicClient->fetchModels($request); + // If the $gapicClient method call did not throw, fail the test + $this->fail('Expected an ApiException, but no exception was thrown.'); + } catch (ApiException $ex) { + $this->assertEquals($status->code, $ex->getCode()); + $this->assertEquals($expectedExceptionMessage, $ex->getMessage()); + } + // Call popReceivedCalls to ensure the stub is exhausted + $transport->popReceivedCalls(); + $this->assertTrue($transport->isExhausted()); + } + + /** @test */ + public function fetchProfilesTest() + { + $transport = $this->createTransport(); + $gapicClient = $this->createClient([ + 'transport' => $transport, + ]); + $this->assertTrue($transport->isExhausted()); + // Mock response + $comments = 'comments-602415628'; + $nextPageToken = ''; + $profileElement = new Profile(); + $profile = [$profileElement]; + $expectedResponse = new FetchProfilesResponse(); + $expectedResponse->setComments($comments); + $expectedResponse->setNextPageToken($nextPageToken); + $expectedResponse->setProfile($profile); + $transport->addResponse($expectedResponse); + $request = new FetchProfilesRequest(); + $response = $gapicClient->fetchProfiles($request); + $this->assertEquals($expectedResponse, $response->getPage()->getResponseObject()); + $resources = iterator_to_array($response->iterateAllElements()); + $this->assertSame(1, count($resources)); + $this->assertEquals($expectedResponse->getProfile()[0], $resources[0]); + $actualRequests = $transport->popReceivedCalls(); + $this->assertSame(1, count($actualRequests)); + $actualFuncCall = $actualRequests[0]->getFuncCall(); + $actualRequestObject = $actualRequests[0]->getRequestObject(); + $this->assertSame('/google.cloud.gkerecommender.v1.GkeInferenceQuickstart/FetchProfiles', $actualFuncCall); + $this->assertTrue($transport->isExhausted()); + } + + /** @test */ + public function fetchProfilesExceptionTest() + { + $transport = $this->createTransport(); + $gapicClient = $this->createClient([ + 'transport' => $transport, + ]); + $this->assertTrue($transport->isExhausted()); + $status = new stdClass(); + $status->code = Code::DATA_LOSS; + $status->details = 'internal error'; + $expectedExceptionMessage = json_encode( + [ + 'message' => 'internal error', + 'code' => Code::DATA_LOSS, + 'status' => 'DATA_LOSS', + 'details' => [], + ], + JSON_PRETTY_PRINT + ); + $transport->addResponse(null, $status); + $request = new FetchProfilesRequest(); + try { + $gapicClient->fetchProfiles($request); + // If the $gapicClient method call did not throw, fail the test + $this->fail('Expected an ApiException, but no exception was thrown.'); + } catch (ApiException $ex) { + $this->assertEquals($status->code, $ex->getCode()); + $this->assertEquals($expectedExceptionMessage, $ex->getMessage()); + } + // Call popReceivedCalls to ensure the stub is exhausted + $transport->popReceivedCalls(); + $this->assertTrue($transport->isExhausted()); + } + + /** @test */ + public function generateOptimizedManifestTest() + { + $transport = $this->createTransport(); + $gapicClient = $this->createClient([ + 'transport' => $transport, + ]); + $this->assertTrue($transport->isExhausted()); + // Mock response + $manifestVersion = 'manifestVersion1422938824'; + $expectedResponse = new GenerateOptimizedManifestResponse(); + $expectedResponse->setManifestVersion($manifestVersion); + $transport->addResponse($expectedResponse); + // Mock request + $modelServerInfo = new ModelServerInfo(); + $modelServerInfoModel = 'modelServerInfoModel-637750097'; + $modelServerInfo->setModel($modelServerInfoModel); + $modelServerInfoModelServer = 'modelServerInfoModelServer191844562'; + $modelServerInfo->setModelServer($modelServerInfoModelServer); + $acceleratorType = 'acceleratorType1748643982'; + $request = (new GenerateOptimizedManifestRequest()) + ->setModelServerInfo($modelServerInfo) + ->setAcceleratorType($acceleratorType); + $response = $gapicClient->generateOptimizedManifest($request); + $this->assertEquals($expectedResponse, $response); + $actualRequests = $transport->popReceivedCalls(); + $this->assertSame(1, count($actualRequests)); + $actualFuncCall = $actualRequests[0]->getFuncCall(); + $actualRequestObject = $actualRequests[0]->getRequestObject(); + $this->assertSame( + '/google.cloud.gkerecommender.v1.GkeInferenceQuickstart/GenerateOptimizedManifest', + $actualFuncCall + ); + $actualValue = $actualRequestObject->getModelServerInfo(); + $this->assertProtobufEquals($modelServerInfo, $actualValue); + $actualValue = $actualRequestObject->getAcceleratorType(); + $this->assertProtobufEquals($acceleratorType, $actualValue); + $this->assertTrue($transport->isExhausted()); + } + + /** @test */ + public function generateOptimizedManifestExceptionTest() + { + $transport = $this->createTransport(); + $gapicClient = $this->createClient([ + 'transport' => $transport, + ]); + $this->assertTrue($transport->isExhausted()); + $status = new stdClass(); + $status->code = Code::DATA_LOSS; + $status->details = 'internal error'; + $expectedExceptionMessage = json_encode( + [ + 'message' => 'internal error', + 'code' => Code::DATA_LOSS, + 'status' => 'DATA_LOSS', + 'details' => [], + ], + JSON_PRETTY_PRINT + ); + $transport->addResponse(null, $status); + // Mock request + $modelServerInfo = new ModelServerInfo(); + $modelServerInfoModel = 'modelServerInfoModel-637750097'; + $modelServerInfo->setModel($modelServerInfoModel); + $modelServerInfoModelServer = 'modelServerInfoModelServer191844562'; + $modelServerInfo->setModelServer($modelServerInfoModelServer); + $acceleratorType = 'acceleratorType1748643982'; + $request = (new GenerateOptimizedManifestRequest()) + ->setModelServerInfo($modelServerInfo) + ->setAcceleratorType($acceleratorType); + try { + $gapicClient->generateOptimizedManifest($request); + // If the $gapicClient method call did not throw, fail the test + $this->fail('Expected an ApiException, but no exception was thrown.'); + } catch (ApiException $ex) { + $this->assertEquals($status->code, $ex->getCode()); + $this->assertEquals($expectedExceptionMessage, $ex->getMessage()); + } + // Call popReceivedCalls to ensure the stub is exhausted + $transport->popReceivedCalls(); + $this->assertTrue($transport->isExhausted()); + } + + /** @test */ + public function fetchBenchmarkingDataAsyncTest() + { + $transport = $this->createTransport(); + $gapicClient = $this->createClient([ + 'transport' => $transport, + ]); + $this->assertTrue($transport->isExhausted()); + // Mock response + $expectedResponse = new FetchBenchmarkingDataResponse(); + $transport->addResponse($expectedResponse); + // Mock request + $modelServerInfo = new ModelServerInfo(); + $modelServerInfoModel = 'modelServerInfoModel-637750097'; + $modelServerInfo->setModel($modelServerInfoModel); + $modelServerInfoModelServer = 'modelServerInfoModelServer191844562'; + $modelServerInfo->setModelServer($modelServerInfoModelServer); + $request = (new FetchBenchmarkingDataRequest())->setModelServerInfo($modelServerInfo); + $response = $gapicClient->fetchBenchmarkingDataAsync($request)->wait(); + $this->assertEquals($expectedResponse, $response); + $actualRequests = $transport->popReceivedCalls(); + $this->assertSame(1, count($actualRequests)); + $actualFuncCall = $actualRequests[0]->getFuncCall(); + $actualRequestObject = $actualRequests[0]->getRequestObject(); + $this->assertSame( + '/google.cloud.gkerecommender.v1.GkeInferenceQuickstart/FetchBenchmarkingData', + $actualFuncCall + ); + $actualValue = $actualRequestObject->getModelServerInfo(); + $this->assertProtobufEquals($modelServerInfo, $actualValue); + $this->assertTrue($transport->isExhausted()); + } +} diff --git a/composer.json b/composer.json index 6d16867010a..80263196eb4 100644 --- a/composer.json +++ b/composer.json @@ -178,6 +178,7 @@ "google/cloud-gke-connect-gateway": "1.1.2", "google/cloud-gke-hub": "1.2.2", "google/cloud-gke-multi-cloud": "1.4.0", + "google/cloud-gkerecommender": "0.0.0", "google/cloud-gsuite-addons": "1.1.2", "google/cloud-hypercomputecluster": "0.1.0", "google/cloud-iam": "1.2.2", @@ -399,6 +400,7 @@ "GPBMetadata\\Google\\Cloud\\Gkeconnect\\Gateway\\": "GkeConnectGateway/metadata", "GPBMetadata\\Google\\Cloud\\Gkehub\\": "GkeHub/metadata", "GPBMetadata\\Google\\Cloud\\Gkemulticloud\\": "GkeMultiCloud/metadata", + "GPBMetadata\\Google\\Cloud\\Gkerecommender\\": "GkeRecommender/metadata", "GPBMetadata\\Google\\Cloud\\Gsuiteaddons\\": "GSuiteAddOns/metadata", "GPBMetadata\\Google\\Cloud\\Hypercomputecluster\\": "HypercomputeCluster/metadata", "GPBMetadata\\Google\\Cloud\\Iap\\": "Iap/metadata", @@ -646,6 +648,7 @@ "Google\\Cloud\\GkeConnect\\Gateway\\": "GkeConnectGateway/src", "Google\\Cloud\\GkeHub\\": "GkeHub/src", "Google\\Cloud\\GkeMultiCloud\\": "GkeMultiCloud/src", + "Google\\Cloud\\GkeRecommender\\": "GkeRecommender/src", "Google\\Cloud\\HypercomputeCluster\\": "HypercomputeCluster/src", "Google\\Cloud\\Iam\\": "Iam/src", "Google\\Cloud\\Iam\\Credentials\\": "IamCredentials/src",