Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: [aiplatform] add Content #10116

Merged
merged 12 commits into from
Dec 11, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions java-aiplatform/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ If you are using Maven with [BOM][libraries-bom], add this to your pom.xml file:
<dependency>
<groupId>com.google.cloud</groupId>
<artifactId>libraries-bom</artifactId>
<version>26.27.0</version>
<version>26.28.0</version>
<type>pom</type>
<scope>import</scope>
</dependency>
Expand Down Expand Up @@ -195,7 +195,7 @@ Java is a registered trademark of Oracle and/or its affiliates.
[kokoro-badge-link-5]: http://storage.googleapis.com/cloud-devrel-public/java/badges/google-cloud-java/java11.html
[stability-image]: https://img.shields.io/badge/stability-stable-green
[maven-version-image]: https://img.shields.io/maven-central/v/com.google.cloud/google-cloud-aiplatform.svg
[maven-version-link]: https://central.sonatype.com/artifact/com.google.cloud/google-cloud-aiplatform/3.31.0
[maven-version-link]: https://central.sonatype.com/artifact/com.google.cloud/google-cloud-aiplatform/3.32.0
[authentication]: https://github.com/googleapis/google-cloud-java#authentication
[auth-scopes]: https://developers.google.com/identity/protocols/oauth2/scopes
[predefined-iam-roles]: https://cloud.google.com/iam/docs/understanding-roles#predefined_roles
Expand Down

Large diffs are not rendered by default.

Large diffs are not rendered by default.

Original file line number Diff line number Diff line change
Expand Up @@ -259,7 +259,9 @@ public final CountTokensResponse countTokens(String endpoint, List<Value> instan
* EndpointName.ofProjectLocationEndpointName(
* "[PROJECT]", "[LOCATION]", "[ENDPOINT]")
* .toString())
* .setModel("model104069929")
* .addAllInstances(new ArrayList<Value>())
* .addAllContents(new ArrayList<Content>())
* .build();
* CountTokensResponse response = llmUtilityServiceClient.countTokens(request);
* }
Expand Down Expand Up @@ -291,7 +293,9 @@ public final CountTokensResponse countTokens(CountTokensRequest request) {
* EndpointName.ofProjectLocationEndpointName(
* "[PROJECT]", "[LOCATION]", "[ENDPOINT]")
* .toString())
* .setModel("model104069929")
* .addAllInstances(new ArrayList<Value>())
* .addAllContents(new ArrayList<Content>())
* .build();
* ApiFuture<CountTokensResponse> future =
* llmUtilityServiceClient.countTokensCallable().futureCall(request);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -986,6 +986,40 @@ public final UnaryCallable<ExplainRequest, ExplainResponse> explainCallable() {
return stub.explainCallable();
}

// AUTO-GENERATED DOCUMENTATION AND METHOD.
/**
* Generate content with multimodal inputs with streaming support.
*
* <p>Sample code:
*
* <pre>{@code
* // This snippet 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 as shown in
* // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
* try (PredictionServiceClient predictionServiceClient = PredictionServiceClient.create()) {
* GenerateContentRequest request =
* GenerateContentRequest.newBuilder()
* .setModel("model104069929")
* .addAllContents(new ArrayList<Content>())
* .addAllTools(new ArrayList<Tool>())
* .addAllSafetySettings(new ArrayList<SafetySetting>())
* .setGenerationConfig(GenerationConfig.newBuilder().build())
* .build();
* ServerStream<GenerateContentResponse> stream =
* predictionServiceClient.streamGenerateContentCallable().call(request);
* for (GenerateContentResponse response : stream) {
* // Do something when a response is received.
* }
* }
* }</pre>
*/
public final ServerStreamingCallable<GenerateContentRequest, GenerateContentResponse>
streamGenerateContentCallable() {
return stub.streamGenerateContentCallable();
}

// AUTO-GENERATED DOCUMENTATION AND METHOD.
/**
* Lists information about the supported locations for this service.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -130,6 +130,12 @@ public UnaryCallSettings<ExplainRequest, ExplainResponse> explainSettings() {
return ((PredictionServiceStubSettings) getStubSettings()).explainSettings();
}

/** Returns the object with the settings used for calls to streamGenerateContent. */
public ServerStreamingCallSettings<GenerateContentRequest, GenerateContentResponse>
streamGenerateContentSettings() {
return ((PredictionServiceStubSettings) getStubSettings()).streamGenerateContentSettings();
}

/** Returns the object with the settings used for calls to listLocations. */
public PagedCallSettings<ListLocationsRequest, ListLocationsResponse, ListLocationsPagedResponse>
listLocationsSettings() {
Expand Down Expand Up @@ -299,6 +305,12 @@ public UnaryCallSettings.Builder<ExplainRequest, ExplainResponse> explainSetting
return getStubSettingsBuilder().explainSettings();
}

/** Returns the builder for the settings used for calls to streamGenerateContent. */
public ServerStreamingCallSettings.Builder<GenerateContentRequest, GenerateContentResponse>
streamGenerateContentSettings() {
return getStubSettingsBuilder().streamGenerateContentSettings();
}

/** Returns the builder for the settings used for calls to listLocations. */
public PagedCallSettings.Builder<
ListLocationsRequest, ListLocationsResponse, ListLocationsPagedResponse>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -83,6 +83,45 @@
}
}
},
"DeploymentResourcePoolService": {
"clients": {
"grpc": {
"libraryClient": "DeploymentResourcePoolServiceClient",
"rpcs": {
"CreateDeploymentResourcePool": {
"methods": ["createDeploymentResourcePoolAsync", "createDeploymentResourcePoolAsync", "createDeploymentResourcePoolAsync", "createDeploymentResourcePoolOperationCallable", "createDeploymentResourcePoolCallable"]
},
"DeleteDeploymentResourcePool": {
"methods": ["deleteDeploymentResourcePoolAsync", "deleteDeploymentResourcePoolAsync", "deleteDeploymentResourcePoolAsync", "deleteDeploymentResourcePoolOperationCallable", "deleteDeploymentResourcePoolCallable"]
},
"GetDeploymentResourcePool": {
"methods": ["getDeploymentResourcePool", "getDeploymentResourcePool", "getDeploymentResourcePool", "getDeploymentResourcePoolCallable"]
},
"GetIamPolicy": {
"methods": ["getIamPolicy", "getIamPolicyCallable"]
},
"GetLocation": {
"methods": ["getLocation", "getLocationCallable"]
},
"ListDeploymentResourcePools": {
"methods": ["listDeploymentResourcePools", "listDeploymentResourcePools", "listDeploymentResourcePools", "listDeploymentResourcePoolsPagedCallable", "listDeploymentResourcePoolsCallable"]
},
"ListLocations": {
"methods": ["listLocations", "listLocationsPagedCallable", "listLocationsCallable"]
},
"QueryDeployedModels": {
"methods": ["queryDeployedModels", "queryDeployedModels", "queryDeployedModelsPagedCallable", "queryDeployedModelsCallable"]
},
"SetIamPolicy": {
"methods": ["setIamPolicy", "setIamPolicyCallable"]
},
"TestIamPermissions": {
"methods": ["testIamPermissions", "testIamPermissionsCallable"]
}
}
}
}
},
"EndpointService": {
"clients": {
"grpc": {
Expand Down Expand Up @@ -1021,6 +1060,9 @@
"SetIamPolicy": {
"methods": ["setIamPolicy", "setIamPolicyCallable"]
},
"StreamGenerateContent": {
"methods": ["streamGenerateContentCallable"]
},
"StreamingPredict": {
"methods": ["streamingPredictCallable"]
},
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,27 @@
* }
* }</pre>
*
* <p>======================= DeploymentResourcePoolServiceClient =======================
*
* <p>Service Description: A service that manages the DeploymentResourcePool resource.
*
* <p>Sample for DeploymentResourcePoolServiceClient:
*
* <pre>{@code
* // This snippet 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 as shown in
* // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
* try (DeploymentResourcePoolServiceClient deploymentResourcePoolServiceClient =
* DeploymentResourcePoolServiceClient.create()) {
* DeploymentResourcePoolName name =
* DeploymentResourcePoolName.of("[PROJECT]", "[LOCATION]", "[DEPLOYMENT_RESOURCE_POOL]");
* DeploymentResourcePool response =
* deploymentResourcePoolServiceClient.getDeploymentResourcePool(name);
* }
* }</pre>
*
* <p>======================= EndpointServiceClient =======================
*
* <p>Service Description: A service for managing Vertex AI's Endpoints.
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,145 @@
/*
* Copyright 2023 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
*
* https://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.
*/

package com.google.cloud.aiplatform.v1.stub;

import static com.google.cloud.aiplatform.v1.DeploymentResourcePoolServiceClient.ListDeploymentResourcePoolsPagedResponse;
import static com.google.cloud.aiplatform.v1.DeploymentResourcePoolServiceClient.ListLocationsPagedResponse;
import static com.google.cloud.aiplatform.v1.DeploymentResourcePoolServiceClient.QueryDeployedModelsPagedResponse;

import com.google.api.gax.core.BackgroundResource;
import com.google.api.gax.rpc.OperationCallable;
import com.google.api.gax.rpc.UnaryCallable;
import com.google.cloud.aiplatform.v1.CreateDeploymentResourcePoolOperationMetadata;
import com.google.cloud.aiplatform.v1.CreateDeploymentResourcePoolRequest;
import com.google.cloud.aiplatform.v1.DeleteDeploymentResourcePoolRequest;
import com.google.cloud.aiplatform.v1.DeleteOperationMetadata;
import com.google.cloud.aiplatform.v1.DeploymentResourcePool;
import com.google.cloud.aiplatform.v1.GetDeploymentResourcePoolRequest;
import com.google.cloud.aiplatform.v1.ListDeploymentResourcePoolsRequest;
import com.google.cloud.aiplatform.v1.ListDeploymentResourcePoolsResponse;
import com.google.cloud.aiplatform.v1.QueryDeployedModelsRequest;
import com.google.cloud.aiplatform.v1.QueryDeployedModelsResponse;
import com.google.cloud.location.GetLocationRequest;
import com.google.cloud.location.ListLocationsRequest;
import com.google.cloud.location.ListLocationsResponse;
import com.google.cloud.location.Location;
import com.google.iam.v1.GetIamPolicyRequest;
import com.google.iam.v1.Policy;
import com.google.iam.v1.SetIamPolicyRequest;
import com.google.iam.v1.TestIamPermissionsRequest;
import com.google.iam.v1.TestIamPermissionsResponse;
import com.google.longrunning.Operation;
import com.google.longrunning.stub.OperationsStub;
import com.google.protobuf.Empty;
import javax.annotation.Generated;

// AUTO-GENERATED DOCUMENTATION AND CLASS.
/**
* Base stub class for the DeploymentResourcePoolService service API.
*
* <p>This class is for advanced usage and reflects the underlying API directly.
*/
@Generated("by gapic-generator-java")
public abstract class DeploymentResourcePoolServiceStub implements BackgroundResource {

public OperationsStub getOperationsStub() {
throw new UnsupportedOperationException("Not implemented: getOperationsStub()");
}

public OperationCallable<
CreateDeploymentResourcePoolRequest,
DeploymentResourcePool,
CreateDeploymentResourcePoolOperationMetadata>
createDeploymentResourcePoolOperationCallable() {
throw new UnsupportedOperationException(
"Not implemented: createDeploymentResourcePoolOperationCallable()");
}

public UnaryCallable<CreateDeploymentResourcePoolRequest, Operation>
createDeploymentResourcePoolCallable() {
throw new UnsupportedOperationException(
"Not implemented: createDeploymentResourcePoolCallable()");
}

public UnaryCallable<GetDeploymentResourcePoolRequest, DeploymentResourcePool>
getDeploymentResourcePoolCallable() {
throw new UnsupportedOperationException("Not implemented: getDeploymentResourcePoolCallable()");
}

public UnaryCallable<ListDeploymentResourcePoolsRequest, ListDeploymentResourcePoolsPagedResponse>
listDeploymentResourcePoolsPagedCallable() {
throw new UnsupportedOperationException(
"Not implemented: listDeploymentResourcePoolsPagedCallable()");
}

public UnaryCallable<ListDeploymentResourcePoolsRequest, ListDeploymentResourcePoolsResponse>
listDeploymentResourcePoolsCallable() {
throw new UnsupportedOperationException(
"Not implemented: listDeploymentResourcePoolsCallable()");
}

public OperationCallable<DeleteDeploymentResourcePoolRequest, Empty, DeleteOperationMetadata>
deleteDeploymentResourcePoolOperationCallable() {
throw new UnsupportedOperationException(
"Not implemented: deleteDeploymentResourcePoolOperationCallable()");
}

public UnaryCallable<DeleteDeploymentResourcePoolRequest, Operation>
deleteDeploymentResourcePoolCallable() {
throw new UnsupportedOperationException(
"Not implemented: deleteDeploymentResourcePoolCallable()");
}

public UnaryCallable<QueryDeployedModelsRequest, QueryDeployedModelsPagedResponse>
queryDeployedModelsPagedCallable() {
throw new UnsupportedOperationException("Not implemented: queryDeployedModelsPagedCallable()");
}

public UnaryCallable<QueryDeployedModelsRequest, QueryDeployedModelsResponse>
queryDeployedModelsCallable() {
throw new UnsupportedOperationException("Not implemented: queryDeployedModelsCallable()");
}

public UnaryCallable<ListLocationsRequest, ListLocationsPagedResponse>
listLocationsPagedCallable() {
throw new UnsupportedOperationException("Not implemented: listLocationsPagedCallable()");
}

public UnaryCallable<ListLocationsRequest, ListLocationsResponse> listLocationsCallable() {
throw new UnsupportedOperationException("Not implemented: listLocationsCallable()");
}

public UnaryCallable<GetLocationRequest, Location> getLocationCallable() {
throw new UnsupportedOperationException("Not implemented: getLocationCallable()");
}

public UnaryCallable<SetIamPolicyRequest, Policy> setIamPolicyCallable() {
throw new UnsupportedOperationException("Not implemented: setIamPolicyCallable()");
}

public UnaryCallable<GetIamPolicyRequest, Policy> getIamPolicyCallable() {
throw new UnsupportedOperationException("Not implemented: getIamPolicyCallable()");
}

public UnaryCallable<TestIamPermissionsRequest, TestIamPermissionsResponse>
testIamPermissionsCallable() {
throw new UnsupportedOperationException("Not implemented: testIamPermissionsCallable()");
}

@Override
public abstract void close();
}
Loading
Loading