public abstract class AssistantServiceClient
Reference documentation and code samples for the Discovery Engine v1 API class AssistantServiceClient.
AssistantService client wrapper, for convenient use.
Derived Types
Namespace
Google.Cloud.DiscoveryEngine.V1Assembly
Google.Cloud.DiscoveryEngine.V1.dll
Remarks
Service for managing Assistant configuration and assisting users.
Properties
DefaultEndpoint
public static string DefaultEndpoint { get; }
The default endpoint for the AssistantService service, which is a host of "discoveryengine.googleapis.com" and a port of 443.
Property Value | |
---|---|
Type | Description |
string |
DefaultScopes
public static IReadOnlyList<string> DefaultScopes { get; }
The default AssistantService scopes.
Property Value | |
---|---|
Type | Description |
IReadOnlyListstring |
The default AssistantService scopes are:
GrpcClient
public virtual AssistantService.AssistantServiceClient GrpcClient { get; }
The underlying gRPC AssistantService client
Property Value | |
---|---|
Type | Description |
AssistantServiceAssistantServiceClient |
LocationsClient
public virtual LocationsClient LocationsClient { get; }
The LocationsClient associated with this client.
Property Value | |
---|---|
Type | Description |
LocationsClient |
ServiceMetadata
public static ServiceMetadata ServiceMetadata { get; }
The service metadata associated with this client type.
Property Value | |
---|---|
Type | Description |
ServiceMetadata |
Methods
Create()
public static AssistantServiceClient Create()
Synchronously creates a AssistantServiceClient using the default credentials, endpoint and settings. To specify custom credentials or other settings, use AssistantServiceClientBuilder.
Returns | |
---|---|
Type | Description |
AssistantServiceClient |
The created AssistantServiceClient. |
CreateAsync(CancellationToken)
public static Task<AssistantServiceClient> CreateAsync(CancellationToken cancellationToken = default)
Asynchronously creates a AssistantServiceClient using the default credentials, endpoint and settings. To specify custom credentials or other settings, use AssistantServiceClientBuilder.
Parameter | |
---|---|
Name | Description |
cancellationToken |
CancellationToken The CancellationToken to use while creating the client. |
Returns | |
---|---|
Type | Description |
TaskAssistantServiceClient |
The task representing the created AssistantServiceClient. |
ShutdownDefaultChannelsAsync()
public static Task ShutdownDefaultChannelsAsync()
Shuts down any channels automatically created by Create() and CreateAsync(CancellationToken). Channels which weren't automatically created are not affected.
Returns | |
---|---|
Type | Description |
Task |
A task representing the asynchronous shutdown operation. |
After calling this method, further calls to Create() and CreateAsync(CancellationToken) will create new channels, which could in turn be shut down by another call to this method.
StreamAssist(StreamAssistRequest, CallSettings)
public virtual AssistantServiceClient.StreamAssistStream StreamAssist(StreamAssistRequest request, CallSettings callSettings = null)
Assists the user with a query in a streaming fashion.
Parameters | |
---|---|
Name | Description |
request |
StreamAssistRequest The request object containing all of the parameters for the API call. |
callSettings |
CallSettings If not null, applies overrides to this RPC call. |
Returns | |
---|---|
Type | Description |
AssistantServiceClientStreamAssistStream |
The server stream. |
// Create client
AssistantServiceClient assistantServiceClient = AssistantServiceClient.Create();
// Initialize request argument(s)
StreamAssistRequest request = new StreamAssistRequest
{
AssistantName = AssistantName.FromProjectLocationCollectionEngineAssistant("[PROJECT]", "[LOCATION]", "[COLLECTION]", "[ENGINE]", "[ASSISTANT]"),
Query = new Query(),
SessionAsSessionName = SessionName.FromProjectLocationDataStoreSession("[PROJECT]", "[LOCATION]", "[DATA_STORE]", "[SESSION]"),
UserMetadata = new AssistUserMetadata(),
ToolsSpec = new StreamAssistRequest.Types.ToolsSpec(),
GenerationSpec = new StreamAssistRequest.Types.GenerationSpec(),
};
// Make the request, returning a streaming response
using AssistantServiceClient.StreamAssistStream response = assistantServiceClient.StreamAssist(request);
// Read streaming responses from server until complete
// Note that C# 8 code can use await foreach
AsyncResponseStream<StreamAssistResponse> responseStream = response.GetResponseStream();
while (await responseStream.MoveNextAsync())
{
StreamAssistResponse responseItem = responseStream.Current;
// Do something with streamed response
}
// The response stream has completed