[e3d4e0a] | 1 | <?php
|
---|
| 2 | /*
|
---|
| 3 | * Copyright 2014 Google Inc.
|
---|
| 4 | *
|
---|
| 5 | * Licensed under the Apache License, Version 2.0 (the "License"); you may not
|
---|
| 6 | * use this file except in compliance with the License. You may obtain a copy of
|
---|
| 7 | * the License at
|
---|
| 8 | *
|
---|
| 9 | * http://www.apache.org/licenses/LICENSE-2.0
|
---|
| 10 | *
|
---|
| 11 | * Unless required by applicable law or agreed to in writing, software
|
---|
| 12 | * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
|
---|
| 13 | * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
|
---|
| 14 | * License for the specific language governing permissions and limitations under
|
---|
| 15 | * the License.
|
---|
| 16 | */
|
---|
| 17 |
|
---|
| 18 | namespace Google\Service\Aiplatform\Resource;
|
---|
| 19 |
|
---|
| 20 | use Google\Service\Aiplatform\GoogleCloudAiplatformV1ComputeTokensRequest;
|
---|
| 21 | use Google\Service\Aiplatform\GoogleCloudAiplatformV1ComputeTokensResponse;
|
---|
| 22 | use Google\Service\Aiplatform\GoogleCloudAiplatformV1CountTokensRequest;
|
---|
| 23 | use Google\Service\Aiplatform\GoogleCloudAiplatformV1CountTokensResponse;
|
---|
| 24 | use Google\Service\Aiplatform\GoogleCloudAiplatformV1GenerateContentRequest;
|
---|
| 25 | use Google\Service\Aiplatform\GoogleCloudAiplatformV1GenerateContentResponse;
|
---|
| 26 |
|
---|
| 27 | /**
|
---|
| 28 | * The "endpoints" collection of methods.
|
---|
| 29 | * Typical usage is:
|
---|
| 30 | * <code>
|
---|
| 31 | * $aiplatformService = new Google\Service\Aiplatform(...);
|
---|
| 32 | * $endpoints = $aiplatformService->endpoints;
|
---|
| 33 | * </code>
|
---|
| 34 | */
|
---|
| 35 | class Endpoints extends \Google\Service\Resource
|
---|
| 36 | {
|
---|
| 37 | /**
|
---|
| 38 | * Return a list of tokens based on the input text. (endpoints.computeTokens)
|
---|
| 39 | *
|
---|
| 40 | * @param string $endpoint Required. The name of the Endpoint requested to get
|
---|
| 41 | * lists of tokens and token ids.
|
---|
| 42 | * @param GoogleCloudAiplatformV1ComputeTokensRequest $postBody
|
---|
| 43 | * @param array $optParams Optional parameters.
|
---|
| 44 | * @return GoogleCloudAiplatformV1ComputeTokensResponse
|
---|
| 45 | * @throws \Google\Service\Exception
|
---|
| 46 | */
|
---|
| 47 | public function computeTokens($endpoint, GoogleCloudAiplatformV1ComputeTokensRequest $postBody, $optParams = [])
|
---|
| 48 | {
|
---|
| 49 | $params = ['endpoint' => $endpoint, 'postBody' => $postBody];
|
---|
| 50 | $params = array_merge($params, $optParams);
|
---|
| 51 | return $this->call('computeTokens', [$params], GoogleCloudAiplatformV1ComputeTokensResponse::class);
|
---|
| 52 | }
|
---|
| 53 | /**
|
---|
| 54 | * Perform a token counting. (endpoints.countTokens)
|
---|
| 55 | *
|
---|
| 56 | * @param string $endpoint Required. The name of the Endpoint requested to
|
---|
| 57 | * perform token counting. Format:
|
---|
| 58 | * `projects/{project}/locations/{location}/endpoints/{endpoint}`
|
---|
| 59 | * @param GoogleCloudAiplatformV1CountTokensRequest $postBody
|
---|
| 60 | * @param array $optParams Optional parameters.
|
---|
| 61 | * @return GoogleCloudAiplatformV1CountTokensResponse
|
---|
| 62 | * @throws \Google\Service\Exception
|
---|
| 63 | */
|
---|
| 64 | public function countTokens($endpoint, GoogleCloudAiplatformV1CountTokensRequest $postBody, $optParams = [])
|
---|
| 65 | {
|
---|
| 66 | $params = ['endpoint' => $endpoint, 'postBody' => $postBody];
|
---|
| 67 | $params = array_merge($params, $optParams);
|
---|
| 68 | return $this->call('countTokens', [$params], GoogleCloudAiplatformV1CountTokensResponse::class);
|
---|
| 69 | }
|
---|
| 70 | /**
|
---|
| 71 | * Generate content with multimodal inputs. (endpoints.generateContent)
|
---|
| 72 | *
|
---|
| 73 | * @param string $model Required. The fully qualified name of the publisher
|
---|
| 74 | * model or tuned model endpoint to use. Publisher model format:
|
---|
| 75 | * `projects/{project}/locations/{location}/publishers/models` Tuned model
|
---|
| 76 | * endpoint format:
|
---|
| 77 | * `projects/{project}/locations/{location}/endpoints/{endpoint}`
|
---|
| 78 | * @param GoogleCloudAiplatformV1GenerateContentRequest $postBody
|
---|
| 79 | * @param array $optParams Optional parameters.
|
---|
| 80 | * @return GoogleCloudAiplatformV1GenerateContentResponse
|
---|
| 81 | * @throws \Google\Service\Exception
|
---|
| 82 | */
|
---|
| 83 | public function generateContent($model, GoogleCloudAiplatformV1GenerateContentRequest $postBody, $optParams = [])
|
---|
| 84 | {
|
---|
| 85 | $params = ['model' => $model, 'postBody' => $postBody];
|
---|
| 86 | $params = array_merge($params, $optParams);
|
---|
| 87 | return $this->call('generateContent', [$params], GoogleCloudAiplatformV1GenerateContentResponse::class);
|
---|
| 88 | }
|
---|
| 89 | /**
|
---|
| 90 | * Generate content with multimodal inputs with streaming support.
|
---|
| 91 | * (endpoints.streamGenerateContent)
|
---|
| 92 | *
|
---|
| 93 | * @param string $model Required. The fully qualified name of the publisher
|
---|
| 94 | * model or tuned model endpoint to use. Publisher model format:
|
---|
| 95 | * `projects/{project}/locations/{location}/publishers/models` Tuned model
|
---|
| 96 | * endpoint format:
|
---|
| 97 | * `projects/{project}/locations/{location}/endpoints/{endpoint}`
|
---|
| 98 | * @param GoogleCloudAiplatformV1GenerateContentRequest $postBody
|
---|
| 99 | * @param array $optParams Optional parameters.
|
---|
| 100 | * @return GoogleCloudAiplatformV1GenerateContentResponse
|
---|
| 101 | * @throws \Google\Service\Exception
|
---|
| 102 | */
|
---|
| 103 | public function streamGenerateContent($model, GoogleCloudAiplatformV1GenerateContentRequest $postBody, $optParams = [])
|
---|
| 104 | {
|
---|
| 105 | $params = ['model' => $model, 'postBody' => $postBody];
|
---|
| 106 | $params = array_merge($params, $optParams);
|
---|
| 107 | return $this->call('streamGenerateContent', [$params], GoogleCloudAiplatformV1GenerateContentResponse::class);
|
---|
| 108 | }
|
---|
| 109 | }
|
---|
| 110 |
|
---|
| 111 | // Adding a class alias for backwards compatibility with the previous class name.
|
---|
| 112 | class_alias(Endpoints::class, 'Google_Service_Aiplatform_Resource_Endpoints');
|
---|