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\GoogleCloudAiplatformV1AugmentPromptRequest;
|
---|
21 | use Google\Service\Aiplatform\GoogleCloudAiplatformV1AugmentPromptResponse;
|
---|
22 | use Google\Service\Aiplatform\GoogleCloudAiplatformV1CorroborateContentRequest;
|
---|
23 | use Google\Service\Aiplatform\GoogleCloudAiplatformV1CorroborateContentResponse;
|
---|
24 | use Google\Service\Aiplatform\GoogleCloudAiplatformV1EvaluateInstancesRequest;
|
---|
25 | use Google\Service\Aiplatform\GoogleCloudAiplatformV1EvaluateInstancesResponse;
|
---|
26 | use Google\Service\Aiplatform\GoogleCloudAiplatformV1RetrieveContextsRequest;
|
---|
27 | use Google\Service\Aiplatform\GoogleCloudAiplatformV1RetrieveContextsResponse;
|
---|
28 | use Google\Service\Aiplatform\GoogleCloudLocationListLocationsResponse;
|
---|
29 | use Google\Service\Aiplatform\GoogleCloudLocationLocation;
|
---|
30 |
|
---|
31 | /**
|
---|
32 | * The "locations" collection of methods.
|
---|
33 | * Typical usage is:
|
---|
34 | * <code>
|
---|
35 | * $aiplatformService = new Google\Service\Aiplatform(...);
|
---|
36 | * $locations = $aiplatformService->projects_locations;
|
---|
37 | * </code>
|
---|
38 | */
|
---|
39 | class ProjectsLocations extends \Google\Service\Resource
|
---|
40 | {
|
---|
41 | /**
|
---|
42 | * Given an input prompt, it returns augmented prompt from vertex rag store to
|
---|
43 | * guide LLM towards generating grounded responses. (locations.augmentPrompt)
|
---|
44 | *
|
---|
45 | * @param string $parent Required. The resource name of the Location from which
|
---|
46 | * to augment prompt. The users must have permission to make a call in the
|
---|
47 | * project. Format: `projects/{project}/locations/{location}`.
|
---|
48 | * @param GoogleCloudAiplatformV1AugmentPromptRequest $postBody
|
---|
49 | * @param array $optParams Optional parameters.
|
---|
50 | * @return GoogleCloudAiplatformV1AugmentPromptResponse
|
---|
51 | * @throws \Google\Service\Exception
|
---|
52 | */
|
---|
53 | public function augmentPrompt($parent, GoogleCloudAiplatformV1AugmentPromptRequest $postBody, $optParams = [])
|
---|
54 | {
|
---|
55 | $params = ['parent' => $parent, 'postBody' => $postBody];
|
---|
56 | $params = array_merge($params, $optParams);
|
---|
57 | return $this->call('augmentPrompt', [$params], GoogleCloudAiplatformV1AugmentPromptResponse::class);
|
---|
58 | }
|
---|
59 | /**
|
---|
60 | * Given an input text, it returns a score that evaluates the factuality of the
|
---|
61 | * text. It also extracts and returns claims from the text and provides
|
---|
62 | * supporting facts. (locations.corroborateContent)
|
---|
63 | *
|
---|
64 | * @param string $parent Required. The resource name of the Location from which
|
---|
65 | * to corroborate text. The users must have permission to make a call in the
|
---|
66 | * project. Format: `projects/{project}/locations/{location}`.
|
---|
67 | * @param GoogleCloudAiplatformV1CorroborateContentRequest $postBody
|
---|
68 | * @param array $optParams Optional parameters.
|
---|
69 | * @return GoogleCloudAiplatformV1CorroborateContentResponse
|
---|
70 | * @throws \Google\Service\Exception
|
---|
71 | */
|
---|
72 | public function corroborateContent($parent, GoogleCloudAiplatformV1CorroborateContentRequest $postBody, $optParams = [])
|
---|
73 | {
|
---|
74 | $params = ['parent' => $parent, 'postBody' => $postBody];
|
---|
75 | $params = array_merge($params, $optParams);
|
---|
76 | return $this->call('corroborateContent', [$params], GoogleCloudAiplatformV1CorroborateContentResponse::class);
|
---|
77 | }
|
---|
78 | /**
|
---|
79 | * Evaluates instances based on a given metric. (locations.evaluateInstances)
|
---|
80 | *
|
---|
81 | * @param string $location Required. The resource name of the Location to
|
---|
82 | * evaluate the instances. Format: `projects/{project}/locations/{location}`
|
---|
83 | * @param GoogleCloudAiplatformV1EvaluateInstancesRequest $postBody
|
---|
84 | * @param array $optParams Optional parameters.
|
---|
85 | * @return GoogleCloudAiplatformV1EvaluateInstancesResponse
|
---|
86 | * @throws \Google\Service\Exception
|
---|
87 | */
|
---|
88 | public function evaluateInstances($location, GoogleCloudAiplatformV1EvaluateInstancesRequest $postBody, $optParams = [])
|
---|
89 | {
|
---|
90 | $params = ['location' => $location, 'postBody' => $postBody];
|
---|
91 | $params = array_merge($params, $optParams);
|
---|
92 | return $this->call('evaluateInstances', [$params], GoogleCloudAiplatformV1EvaluateInstancesResponse::class);
|
---|
93 | }
|
---|
94 | /**
|
---|
95 | * Gets information about a location. (locations.get)
|
---|
96 | *
|
---|
97 | * @param string $name Resource name for the location.
|
---|
98 | * @param array $optParams Optional parameters.
|
---|
99 | * @return GoogleCloudLocationLocation
|
---|
100 | * @throws \Google\Service\Exception
|
---|
101 | */
|
---|
102 | public function get($name, $optParams = [])
|
---|
103 | {
|
---|
104 | $params = ['name' => $name];
|
---|
105 | $params = array_merge($params, $optParams);
|
---|
106 | return $this->call('get', [$params], GoogleCloudLocationLocation::class);
|
---|
107 | }
|
---|
108 | /**
|
---|
109 | * Lists information about the supported locations for this service.
|
---|
110 | * (locations.listProjectsLocations)
|
---|
111 | *
|
---|
112 | * @param string $name The resource that owns the locations collection, if
|
---|
113 | * applicable.
|
---|
114 | * @param array $optParams Optional parameters.
|
---|
115 | *
|
---|
116 | * @opt_param string filter A filter to narrow down results to a preferred
|
---|
117 | * subset. The filtering language accepts strings like `"displayName=tokyo"`,
|
---|
118 | * and is documented in more detail in [AIP-160](https://google.aip.dev/160).
|
---|
119 | * @opt_param int pageSize The maximum number of results to return. If not set,
|
---|
120 | * the service selects a default.
|
---|
121 | * @opt_param string pageToken A page token received from the `next_page_token`
|
---|
122 | * field in the response. Send that page token to receive the subsequent page.
|
---|
123 | * @return GoogleCloudLocationListLocationsResponse
|
---|
124 | * @throws \Google\Service\Exception
|
---|
125 | */
|
---|
126 | public function listProjectsLocations($name, $optParams = [])
|
---|
127 | {
|
---|
128 | $params = ['name' => $name];
|
---|
129 | $params = array_merge($params, $optParams);
|
---|
130 | return $this->call('list', [$params], GoogleCloudLocationListLocationsResponse::class);
|
---|
131 | }
|
---|
132 | /**
|
---|
133 | * Retrieves relevant contexts for a query. (locations.retrieveContexts)
|
---|
134 | *
|
---|
135 | * @param string $parent Required. The resource name of the Location from which
|
---|
136 | * to retrieve RagContexts. The users must have permission to make a call in the
|
---|
137 | * project. Format: `projects/{project}/locations/{location}`.
|
---|
138 | * @param GoogleCloudAiplatformV1RetrieveContextsRequest $postBody
|
---|
139 | * @param array $optParams Optional parameters.
|
---|
140 | * @return GoogleCloudAiplatformV1RetrieveContextsResponse
|
---|
141 | * @throws \Google\Service\Exception
|
---|
142 | */
|
---|
143 | public function retrieveContexts($parent, GoogleCloudAiplatformV1RetrieveContextsRequest $postBody, $optParams = [])
|
---|
144 | {
|
---|
145 | $params = ['parent' => $parent, 'postBody' => $postBody];
|
---|
146 | $params = array_merge($params, $optParams);
|
---|
147 | return $this->call('retrieveContexts', [$params], GoogleCloudAiplatformV1RetrieveContextsResponse::class);
|
---|
148 | }
|
---|
149 | }
|
---|
150 |
|
---|
151 | // Adding a class alias for backwards compatibility with the previous class name.
|
---|
152 | class_alias(ProjectsLocations::class, 'Google_Service_Aiplatform_Resource_ProjectsLocations');
|
---|