| GitHub Repository | Product Reference | RPC Documentation |
Service Description: The service that manages assistant-related resources in Customer Engagement Suite (CES). The assistant, Arc, is a conversational agent embedded in CES applications to help users with building their agents.
This class provides the ability to make remote calls to the backing service through method calls that map to API methods. Sample code to get started:
// 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 (AssistantServiceClient assistantServiceClient = AssistantServiceClient.create()) {
AssistantSessionName name =
AssistantSessionName.of("[PROJECT]", "[LOCATION]", "[APP]", "[ASSISTANT_SESSION]");
AssistantSession response = assistantServiceClient.getAssistantSession(name);
}
Note: close() needs to be called on the AssistantServiceClient object to clean up resources such as threads. In the example above, try-with-resources is used, which automatically calls close().
| Method | Description | Method Variants |
|---|---|---|
ListAssistantSessions |
Lists all assistant sessions in the given app. |
Request object method variants only take one parameter, a request object, which must be constructed before the call.
"Flattened" method variants have converted the fields of the request object into function parameters to enable multiple ways to call the same method.
Callable method variants take no parameters and return an immutable API callable object, which can be used to initiate calls to the service.
|
GetAssistantSession |
Gets details of the specified assistant session. |
Request object method variants only take one parameter, a request object, which must be constructed before the call.
"Flattened" method variants have converted the fields of the request object into function parameters to enable multiple ways to call the same method.
Callable method variants take no parameters and return an immutable API callable object, which can be used to initiate calls to the service.
|
CreateAssistantSession |
Creates a new assistant session in the given app. |
Request object method variants only take one parameter, a request object, which must be constructed before the call.
"Flattened" method variants have converted the fields of the request object into function parameters to enable multiple ways to call the same method.
Callable method variants take no parameters and return an immutable API callable object, which can be used to initiate calls to the service.
|
DeleteAssistantSession |
Deletes the specified assistant session. |
Request object method variants only take one parameter, a request object, which must be constructed before the call.
"Flattened" method variants have converted the fields of the request object into function parameters to enable multiple ways to call the same method.
Callable method variants take no parameters and return an immutable API callable object, which can be used to initiate calls to the service.
|
RunAssistant |
Runs the assistant agent for the specified assistant session. |
Request object method variants only take one parameter, a request object, which must be constructed before the call.
Callable method variants take no parameters and return an immutable API callable object, which can be used to initiate calls to the service.
|
ChatAiAssistant |
Runs Arc, the AI assistant, for the specified assistant session. |
Request object method variants only take one parameter, a request object, which must be constructed before the call.
Callable method variants take no parameters and return an immutable API callable object, which can be used to initiate calls to the service.
|
ListLocations |
Lists information about the supported locations for this service. This method lists locations based on the resource scope provided inthe ListLocationsRequest.name field: ***Global locations**: If For gRPC and client library implementations, the resource name ispassed as the |
Request object method variants only take one parameter, a request object, which must be constructed before the call.
Callable method variants take no parameters and return an immutable API callable object, which can be used to initiate calls to the service.
|
GetLocation |
Gets information about a location. |
Request object method variants only take one parameter, a request object, which must be constructed before the call.
Callable method variants take no parameters and return an immutable API callable object, which can be used to initiate calls to the service.
|
See the individual methods for example code.
Many parameters require resource names to be formatted in a particular way. To assist with these names, this class includes a format method for each type of name, and additionally a parse method to extract the individual identifiers contained within names that are returned.
This class can be customized by passing in a custom instance of AssistantServiceSettings to create(). For example:
To customize credentials:
// 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
AssistantServiceSettings assistantServiceSettings =
AssistantServiceSettings.newBuilder()
.setCredentialsProvider(FixedCredentialsProvider.create(myCredentials))
.build();
AssistantServiceClient assistantServiceClient =
AssistantServiceClient.create(assistantServiceSettings);
To customize the endpoint:
// 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
AssistantServiceSettings assistantServiceSettings =
AssistantServiceSettings.newBuilder().setEndpoint(myEndpoint).build();
AssistantServiceClient assistantServiceClient =
AssistantServiceClient.create(assistantServiceSettings);
To use REST (HTTP1.1/JSON) transport (instead of gRPC) for sending and receiving requests over the wire:
// 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
AssistantServiceSettings assistantServiceSettings =
AssistantServiceSettings.newHttpJsonBuilder().build();
AssistantServiceClient assistantServiceClient =
AssistantServiceClient.create(assistantServiceSettings);
Please refer to the GitHub repository's samples for more quickstart code snippets.
Static Methods
create()
public static final AssistantServiceClient create()Constructs an instance of AssistantServiceClient with default settings.
| Returns | |
|---|---|
| Type | Description |
AssistantServiceClient |
|
| Exceptions | |
|---|---|
| Type | Description |
IOException |
|
create(AssistantServiceSettings settings)
public static final AssistantServiceClient create(AssistantServiceSettings settings)Constructs an instance of AssistantServiceClient, using the given settings. The channels are created based on the settings passed in, or defaults for any settings that are not set.
| Parameter | |
|---|---|
| Name | Description |
settings |
AssistantServiceSettings |
| Returns | |
|---|---|
| Type | Description |
AssistantServiceClient |
|
| Exceptions | |
|---|---|
| Type | Description |
IOException |
|
create(AssistantServiceStub stub)
public static final AssistantServiceClient create(AssistantServiceStub stub)Constructs an instance of AssistantServiceClient, using the given stub for making calls. This is for advanced usage - prefer using create(AssistantServiceSettings).
| Parameter | |
|---|---|
| Name | Description |
stub |
AssistantServiceStub |
| Returns | |
|---|---|
| Type | Description |
AssistantServiceClient |
|
Constructors
AssistantServiceClient(AssistantServiceSettings settings)
protected AssistantServiceClient(AssistantServiceSettings settings)Constructs an instance of AssistantServiceClient, using the given settings. This is protected so that it is easy to make a subclass, but otherwise, the static factory methods should be preferred.
| Parameter | |
|---|---|
| Name | Description |
settings |
AssistantServiceSettings |
AssistantServiceClient(AssistantServiceStub stub)
protected AssistantServiceClient(AssistantServiceStub stub)| Parameter | |
|---|---|
| Name | Description |
stub |
AssistantServiceStub |
Methods
awaitTermination(long duration, TimeUnit unit)
public boolean awaitTermination(long duration, TimeUnit unit)| Parameters | |
|---|---|
| Name | Description |
duration |
long |
unit |
TimeUnit |
| Returns | |
|---|---|
| Type | Description |
boolean |
|
| Exceptions | |
|---|---|
| Type | Description |
InterruptedException |
|
chatAiAssistant(ChatAiAssistantRequest request)
public final ChatAiAssistantResponse chatAiAssistant(ChatAiAssistantRequest request)Runs Arc, the AI assistant, for the specified assistant session.
Sample 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 (AssistantServiceClient assistantServiceClient = AssistantServiceClient.create()) {
ChatAiAssistantRequest request =
ChatAiAssistantRequest.newBuilder()
.setApp(AppName.of("[PROJECT]", "[LOCATION]", "[APP]").toString())
.setAssistantSession(
AssistantSessionName.of("[PROJECT]", "[LOCATION]", "[APP]", "[ASSISTANT_SESSION]")
.toString())
.setMessage("message954925063")
.addAllAttachedGcsUris(new ArrayList<String>())
.setContextToken("contextToken1106626954")
.build();
ChatAiAssistantResponse response = assistantServiceClient.chatAiAssistant(request);
}
| Parameter | |
|---|---|
| Name | Description |
request |
ChatAiAssistantRequestThe request object containing all of the parameters for the API call. |
| Returns | |
|---|---|
| Type | Description |
ChatAiAssistantResponse |
|
chatAiAssistantCallable()
public final UnaryCallable<ChatAiAssistantRequest,ChatAiAssistantResponse> chatAiAssistantCallable()Runs Arc, the AI assistant, for the specified assistant session.
Sample 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 (AssistantServiceClient assistantServiceClient = AssistantServiceClient.create()) {
ChatAiAssistantRequest request =
ChatAiAssistantRequest.newBuilder()
.setApp(AppName.of("[PROJECT]", "[LOCATION]", "[APP]").toString())
.setAssistantSession(
AssistantSessionName.of("[PROJECT]", "[LOCATION]", "[APP]", "[ASSISTANT_SESSION]")
.toString())
.setMessage("message954925063")
.addAllAttachedGcsUris(new ArrayList<String>())
.setContextToken("contextToken1106626954")
.build();
ApiFuture<ChatAiAssistantResponse> future =
assistantServiceClient.chatAiAssistantCallable().futureCall(request);
// Do something.
ChatAiAssistantResponse response = future.get();
}
| Returns | |
|---|---|
| Type | Description |
UnaryCallable<ChatAiAssistantRequest,ChatAiAssistantResponse> |
|
close()
public final void close()createAssistantSession(@Nullable AppName parent, String assistantSessionId)
public final AssistantSession createAssistantSession(@Nullable AppName parent, String assistantSessionId)Creates a new assistant session in the given app.
Sample 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 (AssistantServiceClient assistantServiceClient = AssistantServiceClient.create()) {
AppName parent = AppName.of("[PROJECT]", "[LOCATION]", "[APP]");
String assistantSessionId = "assistantSessionId-1566358253";
AssistantSession response =
assistantServiceClient.createAssistantSession(parent, assistantSessionId);
}
| Parameters | |
|---|---|
| Name | Description |
parent |
@org.jspecify.annotations.Nullable com.google.cloud.ces.v1beta.AppNameRequired. The app to create the assistant session in Format:
|
assistantSessionId |
StringOptional. The ID to use for the assistant session, which will become the final component of the assistant session's resource name. If not provided, a unique ID will be automatically assigned for the assistant session. |
| Returns | |
|---|---|
| Type | Description |
AssistantSession |
|
createAssistantSession(CreateAssistantSessionRequest request)
public final AssistantSession createAssistantSession(CreateAssistantSessionRequest request)Creates a new assistant session in the given app.
Sample 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 (AssistantServiceClient assistantServiceClient = AssistantServiceClient.create()) {
CreateAssistantSessionRequest request =
CreateAssistantSessionRequest.newBuilder()
.setParent(AppName.of("[PROJECT]", "[LOCATION]", "[APP]").toString())
.setAssistantSessionId("assistantSessionId-1566358253")
.addAllAssistantSessionMessages(new ArrayList<AssistantMessage>())
.build();
AssistantSession response = assistantServiceClient.createAssistantSession(request);
}
| Parameter | |
|---|---|
| Name | Description |
request |
CreateAssistantSessionRequestThe request object containing all of the parameters for the API call. |
| Returns | |
|---|---|
| Type | Description |
AssistantSession |
|
createAssistantSession(String parent, String assistantSessionId)
public final AssistantSession createAssistantSession(String parent, String assistantSessionId)Creates a new assistant session in the given app.
Sample 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 (AssistantServiceClient assistantServiceClient = AssistantServiceClient.create()) {
String parent = AppName.of("[PROJECT]", "[LOCATION]", "[APP]").toString();
String assistantSessionId = "assistantSessionId-1566358253";
AssistantSession response =
assistantServiceClient.createAssistantSession(parent, assistantSessionId);
}
| Parameters | |
|---|---|
| Name | Description |
parent |
StringRequired. The app to create the assistant session in Format:
|
assistantSessionId |
StringOptional. The ID to use for the assistant session, which will become the final component of the assistant session's resource name. If not provided, a unique ID will be automatically assigned for the assistant session. |
| Returns | |
|---|---|
| Type | Description |
AssistantSession |
|
createAssistantSessionCallable()
public final UnaryCallable<CreateAssistantSessionRequest,AssistantSession> createAssistantSessionCallable()Creates a new assistant session in the given app.
Sample 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 (AssistantServiceClient assistantServiceClient = AssistantServiceClient.create()) {
CreateAssistantSessionRequest request =
CreateAssistantSessionRequest.newBuilder()
.setParent(AppName.of("[PROJECT]", "[LOCATION]", "[APP]").toString())
.setAssistantSessionId("assistantSessionId-1566358253")
.addAllAssistantSessionMessages(new ArrayList<AssistantMessage>())
.build();
ApiFuture<AssistantSession> future =
assistantServiceClient.createAssistantSessionCallable().futureCall(request);
// Do something.
AssistantSession response = future.get();
}
| Returns | |
|---|---|
| Type | Description |
UnaryCallable<CreateAssistantSessionRequest,AssistantSession> |
|
deleteAssistantSession(@Nullable AssistantSessionName name)
public final void deleteAssistantSession(@Nullable AssistantSessionName name)Deletes the specified assistant session.
Sample 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 (AssistantServiceClient assistantServiceClient = AssistantServiceClient.create()) {
AssistantSessionName name =
AssistantSessionName.of("[PROJECT]", "[LOCATION]", "[APP]", "[ASSISTANT_SESSION]");
assistantServiceClient.deleteAssistantSession(name);
}
| Parameter | |
|---|---|
| Name | Description |
name |
@org.jspecify.annotations.Nullable com.google.cloud.ces.v1beta.AssistantSessionNameRequired. The name of the assistant session to delete. Format:
|
deleteAssistantSession(DeleteAssistantSessionRequest request)
public final void deleteAssistantSession(DeleteAssistantSessionRequest request)Deletes the specified assistant session.
Sample 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 (AssistantServiceClient assistantServiceClient = AssistantServiceClient.create()) {
DeleteAssistantSessionRequest request =
DeleteAssistantSessionRequest.newBuilder()
.setName(
AssistantSessionName.of("[PROJECT]", "[LOCATION]", "[APP]", "[ASSISTANT_SESSION]")
.toString())
.build();
assistantServiceClient.deleteAssistantSession(request);
}
| Parameter | |
|---|---|
| Name | Description |
request |
DeleteAssistantSessionRequestThe request object containing all of the parameters for the API call. |
deleteAssistantSession(String name)
public final void deleteAssistantSession(String name)Deletes the specified assistant session.
Sample 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 (AssistantServiceClient assistantServiceClient = AssistantServiceClient.create()) {
String name =
AssistantSessionName.of("[PROJECT]", "[LOCATION]", "[APP]", "[ASSISTANT_SESSION]")
.toString();
assistantServiceClient.deleteAssistantSession(name);
}
| Parameter | |
|---|---|
| Name | Description |
name |
StringRequired. The name of the assistant session to delete. Format:
|
deleteAssistantSessionCallable()
public final UnaryCallable<DeleteAssistantSessionRequest,Empty> deleteAssistantSessionCallable()Deletes the specified assistant session.
Sample 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 (AssistantServiceClient assistantServiceClient = AssistantServiceClient.create()) {
DeleteAssistantSessionRequest request =
DeleteAssistantSessionRequest.newBuilder()
.setName(
AssistantSessionName.of("[PROJECT]", "[LOCATION]", "[APP]", "[ASSISTANT_SESSION]")
.toString())
.build();
ApiFuture<Empty> future =
assistantServiceClient.deleteAssistantSessionCallable().futureCall(request);
// Do something.
future.get();
}
| Returns | |
|---|---|
| Type | Description |
UnaryCallable<DeleteAssistantSessionRequest,Empty> |
|
getAssistantSession(@Nullable AssistantSessionName name)
public final AssistantSession getAssistantSession(@Nullable AssistantSessionName name)Gets details of the specified assistant session.
Sample 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 (AssistantServiceClient assistantServiceClient = AssistantServiceClient.create()) {
AssistantSessionName name =
AssistantSessionName.of("[PROJECT]", "[LOCATION]", "[APP]", "[ASSISTANT_SESSION]");
AssistantSession response = assistantServiceClient.getAssistantSession(name);
}
| Parameter | |
|---|---|
| Name | Description |
name |
@org.jspecify.annotations.Nullable com.google.cloud.ces.v1beta.AssistantSessionNameRequired. The name of the assistant session to retrieve. Format:
|
| Returns | |
|---|---|
| Type | Description |
AssistantSession |
|
getAssistantSession(GetAssistantSessionRequest request)
public final AssistantSession getAssistantSession(GetAssistantSessionRequest request)Gets details of the specified assistant session.
Sample 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 (AssistantServiceClient assistantServiceClient = AssistantServiceClient.create()) {
GetAssistantSessionRequest request =
GetAssistantSessionRequest.newBuilder()
.setName(
AssistantSessionName.of("[PROJECT]", "[LOCATION]", "[APP]", "[ASSISTANT_SESSION]")
.toString())
.build();
AssistantSession response = assistantServiceClient.getAssistantSession(request);
}
| Parameter | |
|---|---|
| Name | Description |
request |
GetAssistantSessionRequestThe request object containing all of the parameters for the API call. |
| Returns | |
|---|---|
| Type | Description |
AssistantSession |
|
getAssistantSession(String name)
public final AssistantSession getAssistantSession(String name)Gets details of the specified assistant session.
Sample 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 (AssistantServiceClient assistantServiceClient = AssistantServiceClient.create()) {
String name =
AssistantSessionName.of("[PROJECT]", "[LOCATION]", "[APP]", "[ASSISTANT_SESSION]")
.toString();
AssistantSession response = assistantServiceClient.getAssistantSession(name);
}
| Parameter | |
|---|---|
| Name | Description |
name |
StringRequired. The name of the assistant session to retrieve. Format:
|
| Returns | |
|---|---|
| Type | Description |
AssistantSession |
|
getAssistantSessionCallable()
public final UnaryCallable<GetAssistantSessionRequest,AssistantSession> getAssistantSessionCallable()Gets details of the specified assistant session.
Sample 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 (AssistantServiceClient assistantServiceClient = AssistantServiceClient.create()) {
GetAssistantSessionRequest request =
GetAssistantSessionRequest.newBuilder()
.setName(
AssistantSessionName.of("[PROJECT]", "[LOCATION]", "[APP]", "[ASSISTANT_SESSION]")
.toString())
.build();
ApiFuture<AssistantSession> future =
assistantServiceClient.getAssistantSessionCallable().futureCall(request);
// Do something.
AssistantSession response = future.get();
}
| Returns | |
|---|---|
| Type | Description |
UnaryCallable<GetAssistantSessionRequest,AssistantSession> |
|
getLocation(GetLocationRequest request)
public final Location getLocation(GetLocationRequest request)Gets information about a location.
Sample 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 (AssistantServiceClient assistantServiceClient = AssistantServiceClient.create()) {
GetLocationRequest request = GetLocationRequest.newBuilder().setName("name3373707").build();
Location response = assistantServiceClient.getLocation(request);
}
| Parameter | |
|---|---|
| Name | Description |
request |
com.google.cloud.location.GetLocationRequestThe request object containing all of the parameters for the API call. |
| Returns | |
|---|---|
| Type | Description |
com.google.cloud.location.Location |
|
getLocationCallable()
public final UnaryCallable<GetLocationRequest,Location> getLocationCallable()Gets information about a location.
Sample 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 (AssistantServiceClient assistantServiceClient = AssistantServiceClient.create()) {
GetLocationRequest request = GetLocationRequest.newBuilder().setName("name3373707").build();
ApiFuture<Location> future = assistantServiceClient.getLocationCallable().futureCall(request);
// Do something.
Location response = future.get();
}
| Returns | |
|---|---|
| Type | Description |
UnaryCallable<com.google.cloud.location.GetLocationRequest,com.google.cloud.location.Location> |
|
getSettings()
public final @Nullable AssistantServiceSettings getSettings()| Returns | |
|---|---|
| Type | Description |
@org.jspecify.annotations.Nullable com.google.cloud.ces.v1beta.AssistantServiceSettings |
|
getStub()
public AssistantServiceStub getStub()| Returns | |
|---|---|
| Type | Description |
AssistantServiceStub |
|
isShutdown()
public boolean isShutdown()| Returns | |
|---|---|
| Type | Description |
boolean |
|
isTerminated()
public boolean isTerminated()| Returns | |
|---|---|
| Type | Description |
boolean |
|
listAssistantSessions(@Nullable AppName parent)
public final AssistantServiceClient.ListAssistantSessionsPagedResponse listAssistantSessions(@Nullable AppName parent)Lists all assistant sessions in the given app.
Sample 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 (AssistantServiceClient assistantServiceClient = AssistantServiceClient.create()) {
AppName parent = AppName.of("[PROJECT]", "[LOCATION]", "[APP]");
for (AssistantSession element :
assistantServiceClient.listAssistantSessions(parent).iterateAll()) {
// doThingsWith(element);
}
}
| Parameter | |
|---|---|
| Name | Description |
parent |
@org.jspecify.annotations.Nullable com.google.cloud.ces.v1beta.AppNameRequired. The app to list assistant sessions from. Format:
|
| Returns | |
|---|---|
| Type | Description |
AssistantServiceClient.ListAssistantSessionsPagedResponse |
|
listAssistantSessions(ListAssistantSessionsRequest request)
public final AssistantServiceClient.ListAssistantSessionsPagedResponse listAssistantSessions(ListAssistantSessionsRequest request)Lists all assistant sessions in the given app.
Sample 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 (AssistantServiceClient assistantServiceClient = AssistantServiceClient.create()) {
ListAssistantSessionsRequest request =
ListAssistantSessionsRequest.newBuilder()
.setParent(AppName.of("[PROJECT]", "[LOCATION]", "[APP]").toString())
.setPageSize(883849137)
.setPageToken("pageToken873572522")
.setFilter("filter-1274492040")
.build();
for (AssistantSession element :
assistantServiceClient.listAssistantSessions(request).iterateAll()) {
// doThingsWith(element);
}
}
| Parameter | |
|---|---|
| Name | Description |
request |
ListAssistantSessionsRequestThe request object containing all of the parameters for the API call. |
| Returns | |
|---|---|
| Type | Description |
AssistantServiceClient.ListAssistantSessionsPagedResponse |
|
listAssistantSessions(String parent)
public final AssistantServiceClient.ListAssistantSessionsPagedResponse listAssistantSessions(String parent)Lists all assistant sessions in the given app.
Sample 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 (AssistantServiceClient assistantServiceClient = AssistantServiceClient.create()) {
String parent = AppName.of("[PROJECT]", "[LOCATION]", "[APP]").toString();
for (AssistantSession element :
assistantServiceClient.listAssistantSessions(parent).iterateAll()) {
// doThingsWith(element);
}
}
| Parameter | |
|---|---|
| Name | Description |
parent |
StringRequired. The app to list assistant sessions from. Format:
|
| Returns | |
|---|---|
| Type | Description |
AssistantServiceClient.ListAssistantSessionsPagedResponse |
|
listAssistantSessionsCallable()
public final UnaryCallable<ListAssistantSessionsRequest,ListAssistantSessionsResponse> listAssistantSessionsCallable()Lists all assistant sessions in the given app.
Sample 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 (AssistantServiceClient assistantServiceClient = AssistantServiceClient.create()) {
ListAssistantSessionsRequest request =
ListAssistantSessionsRequest.newBuilder()
.setParent(AppName.of("[PROJECT]", "[LOCATION]", "[APP]").toString())
.setPageSize(883849137)
.setPageToken("pageToken873572522")
.setFilter("filter-1274492040")
.build();
while (true) {
ListAssistantSessionsResponse response =
assistantServiceClient.listAssistantSessionsCallable().call(request);
for (AssistantSession element : response.getAssistantSessionsList()) {
// doThingsWith(element);
}
String nextPageToken = response.getNextPageToken();
if (!Strings.isNullOrEmpty(nextPageToken)) {
request = request.toBuilder().setPageToken(nextPageToken).build();
} else {
break;
}
}
}
| Returns | |
|---|---|
| Type | Description |
UnaryCallable<ListAssistantSessionsRequest,ListAssistantSessionsResponse> |
|
listAssistantSessionsPagedCallable()
public final UnaryCallable<ListAssistantSessionsRequest,AssistantServiceClient.ListAssistantSessionsPagedResponse> listAssistantSessionsPagedCallable()Lists all assistant sessions in the given app.
Sample 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 (AssistantServiceClient assistantServiceClient = AssistantServiceClient.create()) {
ListAssistantSessionsRequest request =
ListAssistantSessionsRequest.newBuilder()
.setParent(AppName.of("[PROJECT]", "[LOCATION]", "[APP]").toString())
.setPageSize(883849137)
.setPageToken("pageToken873572522")
.setFilter("filter-1274492040")
.build();
ApiFuture<AssistantSession> future =
assistantServiceClient.listAssistantSessionsPagedCallable().futureCall(request);
// Do something.
for (AssistantSession element : future.get().iterateAll()) {
// doThingsWith(element);
}
}
| Returns | |
|---|---|
| Type | Description |
UnaryCallable<ListAssistantSessionsRequest,ListAssistantSessionsPagedResponse> |
|
listLocations(ListLocationsRequest request)
public final AssistantServiceClient.ListLocationsPagedResponse listLocations(ListLocationsRequest request)Lists information about the supported locations for this service.
This method lists locations based on the resource scope provided inthe
ListLocationsRequest.name field:
***Global locations**: If name is empty, the method lists thepublic
locations available to all projects. * **Project-specificlocations**: If
name follows the formatprojects/{project}, the method lists locations visible to
thatspecific project. This includes public, private, or otherproject-specific locations enabled
for the project.
For gRPC and client library implementations, the resource name ispassed as the name field.
For direct service calls, the resourcename isincorporated into the request path based on the
specific serviceimplementation and version.
Sample 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 (AssistantServiceClient assistantServiceClient = AssistantServiceClient.create()) {
ListLocationsRequest request =
ListLocationsRequest.newBuilder()
.setName("name3373707")
.setFilter("filter-1274492040")
.setPageSize(883849137)
.setPageToken("pageToken873572522")
.build();
for (Location element : assistantServiceClient.listLocations(request).iterateAll()) {
// doThingsWith(element);
}
}
| Parameter | |
|---|---|
| Name | Description |
request |
com.google.cloud.location.ListLocationsRequestThe request object containing all of the parameters for the API call. |
| Returns | |
|---|---|
| Type | Description |
AssistantServiceClient.ListLocationsPagedResponse |
|
listLocationsCallable()
public final UnaryCallable<ListLocationsRequest,ListLocationsResponse> listLocationsCallable()Lists information about the supported locations for this service.
This method lists locations based on the resource scope provided inthe
ListLocationsRequest.name field:
***Global locations**: If name is empty, the method lists thepublic
locations available to all projects. * **Project-specificlocations**: If
name follows the formatprojects/{project}, the method lists locations visible to
thatspecific project. This includes public, private, or otherproject-specific locations enabled
for the project.
For gRPC and client library implementations, the resource name ispassed as the name field.
For direct service calls, the resourcename isincorporated into the request path based on the
specific serviceimplementation and version.
Sample 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 (AssistantServiceClient assistantServiceClient = AssistantServiceClient.create()) {
ListLocationsRequest request =
ListLocationsRequest.newBuilder()
.setName("name3373707")
.setFilter("filter-1274492040")
.setPageSize(883849137)
.setPageToken("pageToken873572522")
.build();
while (true) {
ListLocationsResponse response =
assistantServiceClient.listLocationsCallable().call(request);
for (Location element : response.getLocationsList()) {
// doThingsWith(element);
}
String nextPageToken = response.getNextPageToken();
if (!Strings.isNullOrEmpty(nextPageToken)) {
request = request.toBuilder().setPageToken(nextPageToken).build();
} else {
break;
}
}
}
| Returns | |
|---|---|
| Type | Description |
UnaryCallable<com.google.cloud.location.ListLocationsRequest,com.google.cloud.location.ListLocationsResponse> |
|
listLocationsPagedCallable()
public final UnaryCallable<ListLocationsRequest,AssistantServiceClient.ListLocationsPagedResponse> listLocationsPagedCallable()Lists information about the supported locations for this service.
This method lists locations based on the resource scope provided inthe
ListLocationsRequest.name field:
***Global locations**: If name is empty, the method lists thepublic
locations available to all projects. * **Project-specificlocations**: If
name follows the formatprojects/{project}, the method lists locations visible to
thatspecific project. This includes public, private, or otherproject-specific locations enabled
for the project.
For gRPC and client library implementations, the resource name ispassed as the name field.
For direct service calls, the resourcename isincorporated into the request path based on the
specific serviceimplementation and version.
Sample 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 (AssistantServiceClient assistantServiceClient = AssistantServiceClient.create()) {
ListLocationsRequest request =
ListLocationsRequest.newBuilder()
.setName("name3373707")
.setFilter("filter-1274492040")
.setPageSize(883849137)
.setPageToken("pageToken873572522")
.build();
ApiFuture<Location> future =
assistantServiceClient.listLocationsPagedCallable().futureCall(request);
// Do something.
for (Location element : future.get().iterateAll()) {
// doThingsWith(element);
}
}
| Returns | |
|---|---|
| Type | Description |
UnaryCallable<com.google.cloud.location.ListLocationsRequest,ListLocationsPagedResponse> |
|
runAssistant(RunAssistantRequest request)
public final RunAssistantResponse runAssistant(RunAssistantRequest request)Runs the assistant agent for the specified assistant session.
Sample 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 (AssistantServiceClient assistantServiceClient = AssistantServiceClient.create()) {
RunAssistantRequest request =
RunAssistantRequest.newBuilder()
.setApp(AppName.of("[PROJECT]", "[LOCATION]", "[APP]").toString())
.setAssistantSession(
AssistantSessionName.of("[PROJECT]", "[LOCATION]", "[APP]", "[ASSISTANT_SESSION]")
.toString())
.setMessage(AssistantMessage.newBuilder().build())
.build();
RunAssistantResponse response = assistantServiceClient.runAssistant(request);
}
| Parameter | |
|---|---|
| Name | Description |
request |
RunAssistantRequestThe request object containing all of the parameters for the API call. |
| Returns | |
|---|---|
| Type | Description |
RunAssistantResponse |
|
runAssistantCallable()
public final UnaryCallable<RunAssistantRequest,RunAssistantResponse> runAssistantCallable()Runs the assistant agent for the specified assistant session.
Sample 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 (AssistantServiceClient assistantServiceClient = AssistantServiceClient.create()) {
RunAssistantRequest request =
RunAssistantRequest.newBuilder()
.setApp(AppName.of("[PROJECT]", "[LOCATION]", "[APP]").toString())
.setAssistantSession(
AssistantSessionName.of("[PROJECT]", "[LOCATION]", "[APP]", "[ASSISTANT_SESSION]")
.toString())
.setMessage(AssistantMessage.newBuilder().build())
.build();
ApiFuture<RunAssistantResponse> future =
assistantServiceClient.runAssistantCallable().futureCall(request);
// Do something.
RunAssistantResponse response = future.get();
}
| Returns | |
|---|---|
| Type | Description |
UnaryCallable<RunAssistantRequest,RunAssistantResponse> |
|
shutdown()
public void shutdown()shutdownNow()
public void shutdownNow()