Discovery Engine v1beta API - Class GroundedGenerationServiceClient (1.0.0-beta17)

public abstract class GroundedGenerationServiceClient

Reference documentation and code samples for the Discovery Engine v1beta API class GroundedGenerationServiceClient.

GroundedGenerationService client wrapper, for convenient use.

Inheritance

object > GroundedGenerationServiceClient

Namespace

Google.Cloud.DiscoveryEngine.V1Beta

Assembly

Google.Cloud.DiscoveryEngine.V1Beta.dll

Remarks

Service for grounded generation.

Properties

DefaultEndpoint

public static string DefaultEndpoint { get; }

The default endpoint for the GroundedGenerationService 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 GroundedGenerationService scopes.

Property Value
Type Description
IReadOnlyListstring
Remarks

The default GroundedGenerationService scopes are:

GrpcClient

public virtual GroundedGenerationService.GroundedGenerationServiceClient GrpcClient { get; }

The underlying gRPC GroundedGenerationService client

Property Value
Type Description
GroundedGenerationServiceGroundedGenerationServiceClient

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

CheckGrounding(CheckGroundingRequest, CallSettings)

public virtual CheckGroundingResponse CheckGrounding(CheckGroundingRequest request, CallSettings callSettings = null)

Performs a grounding check.

Parameters
Name Description
request CheckGroundingRequest

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
CheckGroundingResponse

The RPC response.

Example
// Create client
GroundedGenerationServiceClient groundedGenerationServiceClient = GroundedGenerationServiceClient.Create();
// Initialize request argument(s)
CheckGroundingRequest request = new CheckGroundingRequest
{
    GroundingConfigAsGroundingConfigName = GroundingConfigName.FromProjectLocationGroundingConfig("[PROJECT]", "[LOCATION]", "[GROUNDING_CONFIG]"),
    AnswerCandidate = "",
    Facts =
    {
        new GroundingFact(),
    },
    GroundingSpec = new CheckGroundingSpec(),
    UserLabels = { { "", "" }, },
};
// Make the request
CheckGroundingResponse response = groundedGenerationServiceClient.CheckGrounding(request);

CheckGroundingAsync(CheckGroundingRequest, CallSettings)

public virtual Task<CheckGroundingResponse> CheckGroundingAsync(CheckGroundingRequest request, CallSettings callSettings = null)

Performs a grounding check.

Parameters
Name Description
request CheckGroundingRequest

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
TaskCheckGroundingResponse

A Task containing the RPC response.

Example
// Create client
GroundedGenerationServiceClient groundedGenerationServiceClient = await GroundedGenerationServiceClient.CreateAsync();
// Initialize request argument(s)
CheckGroundingRequest request = new CheckGroundingRequest
{
    GroundingConfigAsGroundingConfigName = GroundingConfigName.FromProjectLocationGroundingConfig("[PROJECT]", "[LOCATION]", "[GROUNDING_CONFIG]"),
    AnswerCandidate = "",
    Facts =
    {
        new GroundingFact(),
    },
    GroundingSpec = new CheckGroundingSpec(),
    UserLabels = { { "", "" }, },
};
// Make the request
CheckGroundingResponse response = await groundedGenerationServiceClient.CheckGroundingAsync(request);

CheckGroundingAsync(CheckGroundingRequest, CancellationToken)

public virtual Task<CheckGroundingResponse> CheckGroundingAsync(CheckGroundingRequest request, CancellationToken cancellationToken)

Performs a grounding check.

Parameters
Name Description
request CheckGroundingRequest

The request object containing all of the parameters for the API call.

cancellationToken CancellationToken

A CancellationToken to use for this RPC.

Returns
Type Description
TaskCheckGroundingResponse

A Task containing the RPC response.

Example
// Create client
GroundedGenerationServiceClient groundedGenerationServiceClient = await GroundedGenerationServiceClient.CreateAsync();
// Initialize request argument(s)
CheckGroundingRequest request = new CheckGroundingRequest
{
    GroundingConfigAsGroundingConfigName = GroundingConfigName.FromProjectLocationGroundingConfig("[PROJECT]", "[LOCATION]", "[GROUNDING_CONFIG]"),
    AnswerCandidate = "",
    Facts =
    {
        new GroundingFact(),
    },
    GroundingSpec = new CheckGroundingSpec(),
    UserLabels = { { "", "" }, },
};
// Make the request
CheckGroundingResponse response = await groundedGenerationServiceClient.CheckGroundingAsync(request);

Create()

public static GroundedGenerationServiceClient Create()

Synchronously creates a GroundedGenerationServiceClient using the default credentials, endpoint and settings. To specify custom credentials or other settings, use GroundedGenerationServiceClientBuilder.

Returns
Type Description
GroundedGenerationServiceClient

The created GroundedGenerationServiceClient.

CreateAsync(CancellationToken)

public static Task<GroundedGenerationServiceClient> CreateAsync(CancellationToken cancellationToken = default)

Asynchronously creates a GroundedGenerationServiceClient using the default credentials, endpoint and settings. To specify custom credentials or other settings, use GroundedGenerationServiceClientBuilder.

Parameter
Name Description
cancellationToken CancellationToken

The CancellationToken to use while creating the client.

Returns
Type Description
TaskGroundedGenerationServiceClient

The task representing the created GroundedGenerationServiceClient.

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.

Remarks

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.