Cloud AI Platform v1beta1 API - Class VertexRagServiceClient (1.0.0-beta11)

public abstract class VertexRagServiceClient

Reference documentation and code samples for the Cloud AI Platform v1beta1 API class VertexRagServiceClient.

VertexRagService client wrapper, for convenient use.

Inheritance

object > VertexRagServiceClient

Namespace

Google.Cloud.AIPlatform.V1Beta1

Assembly

Google.Cloud.AIPlatform.V1Beta1.dll

Remarks

A service for retrieving relevant contexts.

Properties

DefaultEndpoint

public static string DefaultEndpoint { get; }

The default endpoint for the VertexRagService service, which is a host of "aiplatform.googleapis.com" and a port of 443.

Property Value
Type Description
string

DefaultScopes

public static IReadOnlyList<string> DefaultScopes { get; }

The default VertexRagService scopes.

Property Value
Type Description
IReadOnlyListstring
Remarks

The default VertexRagService scopes are:

GrpcClient

public virtual VertexRagService.VertexRagServiceClient GrpcClient { get; }

The underlying gRPC VertexRagService client

Property Value
Type Description
VertexRagServiceVertexRagServiceClient

IAMPolicyClient

public virtual IAMPolicyClient IAMPolicyClient { get; }

The IAMPolicyClient associated with this client.

Property Value
Type Description
IAMPolicyClient

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

AugmentPrompt(LocationName, Model, VertexRagStore, CallSettings)

public virtual AugmentPromptResponse AugmentPrompt(LocationName parent, AugmentPromptRequest.Types.Model model, VertexRagStore vertexRagStore, CallSettings callSettings = null)

Given an input prompt, it returns augmented prompt from vertex rag store to guide LLM towards generating grounded responses.

Parameters
Name Description
parent LocationName

Required. The resource name of the Location from which to augment prompt. The users must have permission to make a call in the project. Format: projects/{project}/locations/{location}.

model AugmentPromptRequestTypesModel

Optional. Metadata of the backend deployed model.

vertexRagStore VertexRagStore

Optional. Retrieves contexts from the Vertex RagStore.

callSettings CallSettings

If not null, applies overrides to this RPC call.

Returns
Type Description
AugmentPromptResponse

The RPC response.

Example
// Create client
VertexRagServiceClient vertexRagServiceClient = VertexRagServiceClient.Create();
// Initialize request argument(s)
LocationName parent = LocationName.FromProjectLocation("[PROJECT]", "[LOCATION]");
AugmentPromptRequest.Types.Model model = new AugmentPromptRequest.Types.Model();
VertexRagStore vertexRagStore = new VertexRagStore();
// Make the request
AugmentPromptResponse response = vertexRagServiceClient.AugmentPrompt(parent, model, vertexRagStore);

AugmentPrompt(AugmentPromptRequest, CallSettings)

public virtual AugmentPromptResponse AugmentPrompt(AugmentPromptRequest request, CallSettings callSettings = null)

Given an input prompt, it returns augmented prompt from vertex rag store to guide LLM towards generating grounded responses.

Parameters
Name Description
request AugmentPromptRequest

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
AugmentPromptResponse

The RPC response.

Example
// Create client
VertexRagServiceClient vertexRagServiceClient = VertexRagServiceClient.Create();
// Initialize request argument(s)
AugmentPromptRequest request = new AugmentPromptRequest
{
    ParentAsLocationName = LocationName.FromProjectLocation("[PROJECT]", "[LOCATION]"),
    Contents = { new Content(), },
    Model = new AugmentPromptRequest.Types.Model(),
    VertexRagStore = new VertexRagStore(),
};
// Make the request
AugmentPromptResponse response = vertexRagServiceClient.AugmentPrompt(request);

AugmentPrompt(string, Model, VertexRagStore, CallSettings)

public virtual AugmentPromptResponse AugmentPrompt(string parent, AugmentPromptRequest.Types.Model model, VertexRagStore vertexRagStore, CallSettings callSettings = null)

Given an input prompt, it returns augmented prompt from vertex rag store to guide LLM towards generating grounded responses.

Parameters
Name Description
parent string

Required. The resource name of the Location from which to augment prompt. The users must have permission to make a call in the project. Format: projects/{project}/locations/{location}.

model AugmentPromptRequestTypesModel

Optional. Metadata of the backend deployed model.

vertexRagStore VertexRagStore

Optional. Retrieves contexts from the Vertex RagStore.

callSettings CallSettings

If not null, applies overrides to this RPC call.

Returns
Type Description
AugmentPromptResponse

The RPC response.

Example
// Create client
VertexRagServiceClient vertexRagServiceClient = VertexRagServiceClient.Create();
// Initialize request argument(s)
string parent = "projects/[PROJECT]/locations/[LOCATION]";
AugmentPromptRequest.Types.Model model = new AugmentPromptRequest.Types.Model();
VertexRagStore vertexRagStore = new VertexRagStore();
// Make the request
AugmentPromptResponse response = vertexRagServiceClient.AugmentPrompt(parent, model, vertexRagStore);

AugmentPromptAsync(LocationName, Model, VertexRagStore, CallSettings)

public virtual Task<AugmentPromptResponse> AugmentPromptAsync(LocationName parent, AugmentPromptRequest.Types.Model model, VertexRagStore vertexRagStore, CallSettings callSettings = null)

Given an input prompt, it returns augmented prompt from vertex rag store to guide LLM towards generating grounded responses.

Parameters
Name Description
parent LocationName

Required. The resource name of the Location from which to augment prompt. The users must have permission to make a call in the project. Format: projects/{project}/locations/{location}.

model AugmentPromptRequestTypesModel

Optional. Metadata of the backend deployed model.

vertexRagStore VertexRagStore

Optional. Retrieves contexts from the Vertex RagStore.

callSettings CallSettings

If not null, applies overrides to this RPC call.

Returns
Type Description
TaskAugmentPromptResponse

A Task containing the RPC response.

Example
// Create client
VertexRagServiceClient vertexRagServiceClient = await VertexRagServiceClient.CreateAsync();
// Initialize request argument(s)
LocationName parent = LocationName.FromProjectLocation("[PROJECT]", "[LOCATION]");
AugmentPromptRequest.Types.Model model = new AugmentPromptRequest.Types.Model();
VertexRagStore vertexRagStore = new VertexRagStore();
// Make the request
AugmentPromptResponse response = await vertexRagServiceClient.AugmentPromptAsync(parent, model, vertexRagStore);

AugmentPromptAsync(LocationName, Model, VertexRagStore, CancellationToken)

public virtual Task<AugmentPromptResponse> AugmentPromptAsync(LocationName parent, AugmentPromptRequest.Types.Model model, VertexRagStore vertexRagStore, CancellationToken cancellationToken)

Given an input prompt, it returns augmented prompt from vertex rag store to guide LLM towards generating grounded responses.

Parameters
Name Description
parent LocationName

Required. The resource name of the Location from which to augment prompt. The users must have permission to make a call in the project. Format: projects/{project}/locations/{location}.

model AugmentPromptRequestTypesModel

Optional. Metadata of the backend deployed model.

vertexRagStore VertexRagStore

Optional. Retrieves contexts from the Vertex RagStore.

cancellationToken CancellationToken

A CancellationToken to use for this RPC.

Returns
Type Description
TaskAugmentPromptResponse

A Task containing the RPC response.

Example
// Create client
VertexRagServiceClient vertexRagServiceClient = await VertexRagServiceClient.CreateAsync();
// Initialize request argument(s)
LocationName parent = LocationName.FromProjectLocation("[PROJECT]", "[LOCATION]");
AugmentPromptRequest.Types.Model model = new AugmentPromptRequest.Types.Model();
VertexRagStore vertexRagStore = new VertexRagStore();
// Make the request
AugmentPromptResponse response = await vertexRagServiceClient.AugmentPromptAsync(parent, model, vertexRagStore);

AugmentPromptAsync(AugmentPromptRequest, CallSettings)

public virtual Task<AugmentPromptResponse> AugmentPromptAsync(AugmentPromptRequest request, CallSettings callSettings = null)

Given an input prompt, it returns augmented prompt from vertex rag store to guide LLM towards generating grounded responses.

Parameters
Name Description
request AugmentPromptRequest

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
TaskAugmentPromptResponse

A Task containing the RPC response.

Example
// Create client
VertexRagServiceClient vertexRagServiceClient = await VertexRagServiceClient.CreateAsync();
// Initialize request argument(s)
AugmentPromptRequest request = new AugmentPromptRequest
{
    ParentAsLocationName = LocationName.FromProjectLocation("[PROJECT]", "[LOCATION]"),
    Contents = { new Content(), },
    Model = new AugmentPromptRequest.Types.Model(),
    VertexRagStore = new VertexRagStore(),
};
// Make the request
AugmentPromptResponse response = await vertexRagServiceClient.AugmentPromptAsync(request);

AugmentPromptAsync(AugmentPromptRequest, CancellationToken)

public virtual Task<AugmentPromptResponse> AugmentPromptAsync(AugmentPromptRequest request, CancellationToken cancellationToken)

Given an input prompt, it returns augmented prompt from vertex rag store to guide LLM towards generating grounded responses.

Parameters
Name Description
request AugmentPromptRequest

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

cancellationToken CancellationToken

A CancellationToken to use for this RPC.

Returns
Type Description
TaskAugmentPromptResponse

A Task containing the RPC response.

Example
// Create client
VertexRagServiceClient vertexRagServiceClient = await VertexRagServiceClient.CreateAsync();
// Initialize request argument(s)
AugmentPromptRequest request = new AugmentPromptRequest
{
    ParentAsLocationName = LocationName.FromProjectLocation("[PROJECT]", "[LOCATION]"),
    Contents = { new Content(), },
    Model = new AugmentPromptRequest.Types.Model(),
    VertexRagStore = new VertexRagStore(),
};
// Make the request
AugmentPromptResponse response = await vertexRagServiceClient.AugmentPromptAsync(request);

AugmentPromptAsync(string, Model, VertexRagStore, CallSettings)

public virtual Task<AugmentPromptResponse> AugmentPromptAsync(string parent, AugmentPromptRequest.Types.Model model, VertexRagStore vertexRagStore, CallSettings callSettings = null)

Given an input prompt, it returns augmented prompt from vertex rag store to guide LLM towards generating grounded responses.

Parameters
Name Description
parent string

Required. The resource name of the Location from which to augment prompt. The users must have permission to make a call in the project. Format: projects/{project}/locations/{location}.

model AugmentPromptRequestTypesModel

Optional. Metadata of the backend deployed model.

vertexRagStore VertexRagStore

Optional. Retrieves contexts from the Vertex RagStore.

callSettings CallSettings

If not null, applies overrides to this RPC call.

Returns
Type Description
TaskAugmentPromptResponse

A Task containing the RPC response.

Example
// Create client
VertexRagServiceClient vertexRagServiceClient = await VertexRagServiceClient.CreateAsync();
// Initialize request argument(s)
string parent = "projects/[PROJECT]/locations/[LOCATION]";
AugmentPromptRequest.Types.Model model = new AugmentPromptRequest.Types.Model();
VertexRagStore vertexRagStore = new VertexRagStore();
// Make the request
AugmentPromptResponse response = await vertexRagServiceClient.AugmentPromptAsync(parent, model, vertexRagStore);

AugmentPromptAsync(string, Model, VertexRagStore, CancellationToken)

public virtual Task<AugmentPromptResponse> AugmentPromptAsync(string parent, AugmentPromptRequest.Types.Model model, VertexRagStore vertexRagStore, CancellationToken cancellationToken)

Given an input prompt, it returns augmented prompt from vertex rag store to guide LLM towards generating grounded responses.

Parameters
Name Description
parent string

Required. The resource name of the Location from which to augment prompt. The users must have permission to make a call in the project. Format: projects/{project}/locations/{location}.

model AugmentPromptRequestTypesModel

Optional. Metadata of the backend deployed model.

vertexRagStore VertexRagStore

Optional. Retrieves contexts from the Vertex RagStore.

cancellationToken CancellationToken

A CancellationToken to use for this RPC.

Returns
Type Description
TaskAugmentPromptResponse

A Task containing the RPC response.

Example
// Create client
VertexRagServiceClient vertexRagServiceClient = await VertexRagServiceClient.CreateAsync();
// Initialize request argument(s)
string parent = "projects/[PROJECT]/locations/[LOCATION]";
AugmentPromptRequest.Types.Model model = new AugmentPromptRequest.Types.Model();
VertexRagStore vertexRagStore = new VertexRagStore();
// Make the request
AugmentPromptResponse response = await vertexRagServiceClient.AugmentPromptAsync(parent, model, vertexRagStore);

CorroborateContent(LocationName, Content, IEnumerable<Fact>, CallSettings)

public virtual CorroborateContentResponse CorroborateContent(LocationName parent, Content content, IEnumerable<Fact> facts, CallSettings callSettings = null)

Given an input text, it returns a score that evaluates the factuality of the text. It also extracts and returns claims from the text and provides supporting facts.

Parameters
Name Description
parent LocationName

Required. The resource name of the Location from which to corroborate text. The users must have permission to make a call in the project. Format: projects/{project}/locations/{location}.

content Content

Optional. Input content to corroborate, only text format is supported for now.

facts IEnumerableFact

Optional. Facts used to generate the text can also be used to corroborate the text.

callSettings CallSettings

If not null, applies overrides to this RPC call.

Returns
Type Description
CorroborateContentResponse

The RPC response.

Example
// Create client
VertexRagServiceClient vertexRagServiceClient = VertexRagServiceClient.Create();
// Initialize request argument(s)
LocationName parent = LocationName.FromProjectLocation("[PROJECT]", "[LOCATION]");
Content content = new Content();
IEnumerable<Fact> facts = new Fact[] { new Fact(), };
// Make the request
CorroborateContentResponse response = vertexRagServiceClient.CorroborateContent(parent, content, facts);

CorroborateContent(CorroborateContentRequest, CallSettings)

public virtual CorroborateContentResponse CorroborateContent(CorroborateContentRequest request, CallSettings callSettings = null)

Given an input text, it returns a score that evaluates the factuality of the text. It also extracts and returns claims from the text and provides supporting facts.

Parameters
Name Description
request CorroborateContentRequest

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
CorroborateContentResponse

The RPC response.

Example
// Create client
VertexRagServiceClient vertexRagServiceClient = VertexRagServiceClient.Create();
// Initialize request argument(s)
CorroborateContentRequest request = new CorroborateContentRequest
{
    ParentAsLocationName = LocationName.FromProjectLocation("[PROJECT]", "[LOCATION]"),
    Content = new Content(),
    Facts = { new Fact(), },
    Parameters = new CorroborateContentRequest.Types.Parameters(),
};
// Make the request
CorroborateContentResponse response = vertexRagServiceClient.CorroborateContent(request);

CorroborateContent(string, Content, IEnumerable<Fact>, CallSettings)

public virtual CorroborateContentResponse CorroborateContent(string parent, Content content, IEnumerable<Fact> facts, CallSettings callSettings = null)

Given an input text, it returns a score that evaluates the factuality of the text. It also extracts and returns claims from the text and provides supporting facts.

Parameters
Name Description
parent string

Required. The resource name of the Location from which to corroborate text. The users must have permission to make a call in the project. Format: projects/{project}/locations/{location}.

content Content

Optional. Input content to corroborate, only text format is supported for now.

facts IEnumerableFact

Optional. Facts used to generate the text can also be used to corroborate the text.

callSettings CallSettings

If not null, applies overrides to this RPC call.

Returns
Type Description
CorroborateContentResponse

The RPC response.

Example
// Create client
VertexRagServiceClient vertexRagServiceClient = VertexRagServiceClient.Create();
// Initialize request argument(s)
string parent = "projects/[PROJECT]/locations/[LOCATION]";
Content content = new Content();
IEnumerable<Fact> facts = new Fact[] { new Fact(), };
// Make the request
CorroborateContentResponse response = vertexRagServiceClient.CorroborateContent(parent, content, facts);

CorroborateContentAsync(LocationName, Content, IEnumerable<Fact>, CallSettings)

public virtual Task<CorroborateContentResponse> CorroborateContentAsync(LocationName parent, Content content, IEnumerable<Fact> facts, CallSettings callSettings = null)

Given an input text, it returns a score that evaluates the factuality of the text. It also extracts and returns claims from the text and provides supporting facts.

Parameters
Name Description
parent LocationName

Required. The resource name of the Location from which to corroborate text. The users must have permission to make a call in the project. Format: projects/{project}/locations/{location}.

content Content

Optional. Input content to corroborate, only text format is supported for now.

facts IEnumerableFact

Optional. Facts used to generate the text can also be used to corroborate the text.

callSettings CallSettings

If not null, applies overrides to this RPC call.

Returns
Type Description
TaskCorroborateContentResponse

A Task containing the RPC response.

Example
// Create client
VertexRagServiceClient vertexRagServiceClient = await VertexRagServiceClient.CreateAsync();
// Initialize request argument(s)
LocationName parent = LocationName.FromProjectLocation("[PROJECT]", "[LOCATION]");
Content content = new Content();
IEnumerable<Fact> facts = new Fact[] { new Fact(), };
// Make the request
CorroborateContentResponse response = await vertexRagServiceClient.CorroborateContentAsync(parent, content, facts);

CorroborateContentAsync(LocationName, Content, IEnumerable<Fact>, CancellationToken)

public virtual Task<CorroborateContentResponse> CorroborateContentAsync(LocationName parent, Content content, IEnumerable<Fact> facts, CancellationToken cancellationToken)

Given an input text, it returns a score that evaluates the factuality of the text. It also extracts and returns claims from the text and provides supporting facts.

Parameters
Name Description
parent LocationName

Required. The resource name of the Location from which to corroborate text. The users must have permission to make a call in the project. Format: projects/{project}/locations/{location}.

content Content

Optional. Input content to corroborate, only text format is supported for now.

facts IEnumerableFact

Optional. Facts used to generate the text can also be used to corroborate the text.

cancellationToken CancellationToken

A CancellationToken to use for this RPC.

Returns
Type Description
TaskCorroborateContentResponse

A Task containing the RPC response.

Example
// Create client
VertexRagServiceClient vertexRagServiceClient = await VertexRagServiceClient.CreateAsync();
// Initialize request argument(s)
LocationName parent = LocationName.FromProjectLocation("[PROJECT]", "[LOCATION]");
Content content = new Content();
IEnumerable<Fact> facts = new Fact[] { new Fact(), };
// Make the request
CorroborateContentResponse response = await vertexRagServiceClient.CorroborateContentAsync(parent, content, facts);

CorroborateContentAsync(CorroborateContentRequest, CallSettings)

public virtual Task<CorroborateContentResponse> CorroborateContentAsync(CorroborateContentRequest request, CallSettings callSettings = null)

Given an input text, it returns a score that evaluates the factuality of the text. It also extracts and returns claims from the text and provides supporting facts.

Parameters
Name Description
request CorroborateContentRequest

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
TaskCorroborateContentResponse

A Task containing the RPC response.

Example
// Create client
VertexRagServiceClient vertexRagServiceClient = await VertexRagServiceClient.CreateAsync();
// Initialize request argument(s)
CorroborateContentRequest request = new CorroborateContentRequest
{
    ParentAsLocationName = LocationName.FromProjectLocation("[PROJECT]", "[LOCATION]"),
    Content = new Content(),
    Facts = { new Fact(), },
    Parameters = new CorroborateContentRequest.Types.Parameters(),
};
// Make the request
CorroborateContentResponse response = await vertexRagServiceClient.CorroborateContentAsync(request);

CorroborateContentAsync(CorroborateContentRequest, CancellationToken)

public virtual Task<CorroborateContentResponse> CorroborateContentAsync(CorroborateContentRequest request, CancellationToken cancellationToken)

Given an input text, it returns a score that evaluates the factuality of the text. It also extracts and returns claims from the text and provides supporting facts.

Parameters
Name Description
request CorroborateContentRequest

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

cancellationToken CancellationToken

A CancellationToken to use for this RPC.

Returns
Type Description
TaskCorroborateContentResponse

A Task containing the RPC response.

Example
// Create client
VertexRagServiceClient vertexRagServiceClient = await VertexRagServiceClient.CreateAsync();
// Initialize request argument(s)
CorroborateContentRequest request = new CorroborateContentRequest
{
    ParentAsLocationName = LocationName.FromProjectLocation("[PROJECT]", "[LOCATION]"),
    Content = new Content(),
    Facts = { new Fact(), },
    Parameters = new CorroborateContentRequest.Types.Parameters(),
};
// Make the request
CorroborateContentResponse response = await vertexRagServiceClient.CorroborateContentAsync(request);

CorroborateContentAsync(string, Content, IEnumerable<Fact>, CallSettings)

public virtual Task<CorroborateContentResponse> CorroborateContentAsync(string parent, Content content, IEnumerable<Fact> facts, CallSettings callSettings = null)

Given an input text, it returns a score that evaluates the factuality of the text. It also extracts and returns claims from the text and provides supporting facts.

Parameters
Name Description
parent string

Required. The resource name of the Location from which to corroborate text. The users must have permission to make a call in the project. Format: projects/{project}/locations/{location}.

content Content

Optional. Input content to corroborate, only text format is supported for now.

facts IEnumerableFact

Optional. Facts used to generate the text can also be used to corroborate the text.

callSettings CallSettings

If not null, applies overrides to this RPC call.

Returns
Type Description
TaskCorroborateContentResponse

A Task containing the RPC response.

Example
// Create client
VertexRagServiceClient vertexRagServiceClient = await VertexRagServiceClient.CreateAsync();
// Initialize request argument(s)
string parent = "projects/[PROJECT]/locations/[LOCATION]";
Content content = new Content();
IEnumerable<Fact> facts = new Fact[] { new Fact(), };
// Make the request
CorroborateContentResponse response = await vertexRagServiceClient.CorroborateContentAsync(parent, content, facts);

CorroborateContentAsync(string, Content, IEnumerable<Fact>, CancellationToken)

public virtual Task<CorroborateContentResponse> CorroborateContentAsync(string parent, Content content, IEnumerable<Fact> facts, CancellationToken cancellationToken)

Given an input text, it returns a score that evaluates the factuality of the text. It also extracts and returns claims from the text and provides supporting facts.

Parameters
Name Description
parent string

Required. The resource name of the Location from which to corroborate text. The users must have permission to make a call in the project. Format: projects/{project}/locations/{location}.

content Content

Optional. Input content to corroborate, only text format is supported for now.

facts IEnumerableFact

Optional. Facts used to generate the text can also be used to corroborate the text.

cancellationToken CancellationToken

A CancellationToken to use for this RPC.

Returns
Type Description
TaskCorroborateContentResponse

A Task containing the RPC response.

Example
// Create client
VertexRagServiceClient vertexRagServiceClient = await VertexRagServiceClient.CreateAsync();
// Initialize request argument(s)
string parent = "projects/[PROJECT]/locations/[LOCATION]";
Content content = new Content();
IEnumerable<Fact> facts = new Fact[] { new Fact(), };
// Make the request
CorroborateContentResponse response = await vertexRagServiceClient.CorroborateContentAsync(parent, content, facts);

Create()

public static VertexRagServiceClient Create()

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

Returns
Type Description
VertexRagServiceClient

The created VertexRagServiceClient.

CreateAsync(CancellationToken)

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

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

Parameter
Name Description
cancellationToken CancellationToken

The CancellationToken to use while creating the client.

Returns
Type Description
TaskVertexRagServiceClient

The task representing the created VertexRagServiceClient.

RetrieveContexts(LocationName, RagQuery, CallSettings)

public virtual RetrieveContextsResponse RetrieveContexts(LocationName parent, RagQuery query, CallSettings callSettings = null)

Retrieves relevant contexts for a query.

Parameters
Name Description
parent LocationName

Required. The resource name of the Location from which to retrieve RagContexts. The users must have permission to make a call in the project. Format: projects/{project}/locations/{location}.

query RagQuery

Required. Single RAG retrieve query.

callSettings CallSettings

If not null, applies overrides to this RPC call.

Returns
Type Description
RetrieveContextsResponse

The RPC response.

Example
// Create client
VertexRagServiceClient vertexRagServiceClient = VertexRagServiceClient.Create();
// Initialize request argument(s)
LocationName parent = LocationName.FromProjectLocation("[PROJECT]", "[LOCATION]");
RagQuery query = new RagQuery();
// Make the request
RetrieveContextsResponse response = vertexRagServiceClient.RetrieveContexts(parent, query);

RetrieveContexts(RetrieveContextsRequest, CallSettings)

public virtual RetrieveContextsResponse RetrieveContexts(RetrieveContextsRequest request, CallSettings callSettings = null)

Retrieves relevant contexts for a query.

Parameters
Name Description
request RetrieveContextsRequest

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
RetrieveContextsResponse

The RPC response.

Example
// Create client
VertexRagServiceClient vertexRagServiceClient = VertexRagServiceClient.Create();
// Initialize request argument(s)
RetrieveContextsRequest request = new RetrieveContextsRequest
{
    ParentAsLocationName = LocationName.FromProjectLocation("[PROJECT]", "[LOCATION]"),
    VertexRagStore = new RetrieveContextsRequest.Types.VertexRagStore(),
    Query = new RagQuery(),
};
// Make the request
RetrieveContextsResponse response = vertexRagServiceClient.RetrieveContexts(request);

RetrieveContexts(string, RagQuery, CallSettings)

public virtual RetrieveContextsResponse RetrieveContexts(string parent, RagQuery query, CallSettings callSettings = null)

Retrieves relevant contexts for a query.

Parameters
Name Description
parent string

Required. The resource name of the Location from which to retrieve RagContexts. The users must have permission to make a call in the project. Format: projects/{project}/locations/{location}.

query RagQuery

Required. Single RAG retrieve query.

callSettings CallSettings

If not null, applies overrides to this RPC call.

Returns
Type Description
RetrieveContextsResponse

The RPC response.

Example
// Create client
VertexRagServiceClient vertexRagServiceClient = VertexRagServiceClient.Create();
// Initialize request argument(s)
string parent = "projects/[PROJECT]/locations/[LOCATION]";
RagQuery query = new RagQuery();
// Make the request
RetrieveContextsResponse response = vertexRagServiceClient.RetrieveContexts(parent, query);

RetrieveContextsAsync(LocationName, RagQuery, CallSettings)

public virtual Task<RetrieveContextsResponse> RetrieveContextsAsync(LocationName parent, RagQuery query, CallSettings callSettings = null)

Retrieves relevant contexts for a query.

Parameters
Name Description
parent LocationName

Required. The resource name of the Location from which to retrieve RagContexts. The users must have permission to make a call in the project. Format: projects/{project}/locations/{location}.

query RagQuery

Required. Single RAG retrieve query.

callSettings CallSettings

If not null, applies overrides to this RPC call.

Returns
Type Description
TaskRetrieveContextsResponse

A Task containing the RPC response.

Example
// Create client
VertexRagServiceClient vertexRagServiceClient = await VertexRagServiceClient.CreateAsync();
// Initialize request argument(s)
LocationName parent = LocationName.FromProjectLocation("[PROJECT]", "[LOCATION]");
RagQuery query = new RagQuery();
// Make the request
RetrieveContextsResponse response = await vertexRagServiceClient.RetrieveContextsAsync(parent, query);

RetrieveContextsAsync(LocationName, RagQuery, CancellationToken)

public virtual Task<RetrieveContextsResponse> RetrieveContextsAsync(LocationName parent, RagQuery query, CancellationToken cancellationToken)

Retrieves relevant contexts for a query.

Parameters
Name Description
parent LocationName

Required. The resource name of the Location from which to retrieve RagContexts. The users must have permission to make a call in the project. Format: projects/{project}/locations/{location}.

query RagQuery

Required. Single RAG retrieve query.

cancellationToken CancellationToken

A CancellationToken to use for this RPC.

Returns
Type Description
TaskRetrieveContextsResponse

A Task containing the RPC response.

Example
// Create client
VertexRagServiceClient vertexRagServiceClient = await VertexRagServiceClient.CreateAsync();
// Initialize request argument(s)
LocationName parent = LocationName.FromProjectLocation("[PROJECT]", "[LOCATION]");
RagQuery query = new RagQuery();
// Make the request
RetrieveContextsResponse response = await vertexRagServiceClient.RetrieveContextsAsync(parent, query);

RetrieveContextsAsync(RetrieveContextsRequest, CallSettings)

public virtual Task<RetrieveContextsResponse> RetrieveContextsAsync(RetrieveContextsRequest request, CallSettings callSettings = null)

Retrieves relevant contexts for a query.

Parameters
Name Description
request RetrieveContextsRequest

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
TaskRetrieveContextsResponse

A Task containing the RPC response.

Example
// Create client
VertexRagServiceClient vertexRagServiceClient = await VertexRagServiceClient.CreateAsync();
// Initialize request argument(s)
RetrieveContextsRequest request = new RetrieveContextsRequest
{
    ParentAsLocationName = LocationName.FromProjectLocation("[PROJECT]", "[LOCATION]"),
    VertexRagStore = new RetrieveContextsRequest.Types.VertexRagStore(),
    Query = new RagQuery(),
};
// Make the request
RetrieveContextsResponse response = await vertexRagServiceClient.RetrieveContextsAsync(request);

RetrieveContextsAsync(RetrieveContextsRequest, CancellationToken)

public virtual Task<RetrieveContextsResponse> RetrieveContextsAsync(RetrieveContextsRequest request, CancellationToken cancellationToken)

Retrieves relevant contexts for a query.

Parameters
Name Description
request RetrieveContextsRequest

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

cancellationToken CancellationToken

A CancellationToken to use for this RPC.

Returns
Type Description
TaskRetrieveContextsResponse

A Task containing the RPC response.

Example
// Create client
VertexRagServiceClient vertexRagServiceClient = await VertexRagServiceClient.CreateAsync();
// Initialize request argument(s)
RetrieveContextsRequest request = new RetrieveContextsRequest
{
    ParentAsLocationName = LocationName.FromProjectLocation("[PROJECT]", "[LOCATION]"),
    VertexRagStore = new RetrieveContextsRequest.Types.VertexRagStore(),
    Query = new RagQuery(),
};
// Make the request
RetrieveContextsResponse response = await vertexRagServiceClient.RetrieveContextsAsync(request);

RetrieveContextsAsync(string, RagQuery, CallSettings)

public virtual Task<RetrieveContextsResponse> RetrieveContextsAsync(string parent, RagQuery query, CallSettings callSettings = null)

Retrieves relevant contexts for a query.

Parameters
Name Description
parent string

Required. The resource name of the Location from which to retrieve RagContexts. The users must have permission to make a call in the project. Format: projects/{project}/locations/{location}.

query RagQuery

Required. Single RAG retrieve query.

callSettings CallSettings

If not null, applies overrides to this RPC call.

Returns
Type Description
TaskRetrieveContextsResponse

A Task containing the RPC response.

Example
// Create client
VertexRagServiceClient vertexRagServiceClient = await VertexRagServiceClient.CreateAsync();
// Initialize request argument(s)
string parent = "projects/[PROJECT]/locations/[LOCATION]";
RagQuery query = new RagQuery();
// Make the request
RetrieveContextsResponse response = await vertexRagServiceClient.RetrieveContextsAsync(parent, query);

RetrieveContextsAsync(string, RagQuery, CancellationToken)

public virtual Task<RetrieveContextsResponse> RetrieveContextsAsync(string parent, RagQuery query, CancellationToken cancellationToken)

Retrieves relevant contexts for a query.

Parameters
Name Description
parent string

Required. The resource name of the Location from which to retrieve RagContexts. The users must have permission to make a call in the project. Format: projects/{project}/locations/{location}.

query RagQuery

Required. Single RAG retrieve query.

cancellationToken CancellationToken

A CancellationToken to use for this RPC.

Returns
Type Description
TaskRetrieveContextsResponse

A Task containing the RPC response.

Example
// Create client
VertexRagServiceClient vertexRagServiceClient = await VertexRagServiceClient.CreateAsync();
// Initialize request argument(s)
string parent = "projects/[PROJECT]/locations/[LOCATION]";
RagQuery query = new RagQuery();
// Make the request
RetrieveContextsResponse response = await vertexRagServiceClient.RetrieveContextsAsync(parent, query);

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.