Skip to content

Commit

Permalink
feat: support blended search
Browse files Browse the repository at this point in the history
feat: support boost in multi-turn search
feat: add document processing config services
feat: add search tuning services
feat: allow setting schema on schema creation
docs: keep the API doc up-to-date with recent changes

PiperOrigin-RevId: 614046598

Source-Link: googleapis/googleapis@d66613f

Source-Link: googleapis/googleapis-gen@3d65645
Copy-Tag: eyJwIjoiYXBpcy9Hb29nbGUuQ2xvdWQuRGlzY292ZXJ5RW5naW5lLlYxQmV0YS8uT3dsQm90LnlhbWwiLCJoIjoiM2Q2NTY0NTBkM2E2NzZjZWFiNzA3OGM2NzNmMmUwNTI0M2UwMWQ4ZiJ9
  • Loading branch information
gcf-owl-bot[bot] authored and jskeet committed Mar 9, 2024
1 parent 3f92c8d commit a2187da
Show file tree
Hide file tree
Showing 38 changed files with 5,184 additions and 425 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,7 @@ public async Task ConverseConversationRequestObjectAsync()
UserLabels = { { "", "" }, },
SummarySpec = new SearchRequest.Types.ContentSearchSpec.Types.SummarySpec(),
Filter = "",
BoostSpec = new SearchRequest.Types.BoostSpec(),
};
// Make the request
ConverseConversationResponse response = await conversationalSearchServiceClient.ConverseConversationAsync(request);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,7 @@ public void ConverseConversationRequestObject()
UserLabels = { { "", "" }, },
SummarySpec = new SearchRequest.Types.ContentSearchSpec.Types.SummarySpec(),
Filter = "",
BoostSpec = new SearchRequest.Types.BoostSpec(),
};
// Make the request
ConverseConversationResponse response = conversationalSearchServiceClient.ConverseConversation(request);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -64,6 +64,10 @@ public async Task SearchRequestObjectAsync()
ContentSearchSpec = new SearchRequest.Types.ContentSearchSpec(),
RankingExpression = "",
CanonicalFilter = "",
DataStoreSpecs =
{
new SearchRequest.Types.DataStoreSpec(),
},
};
// Make the request
PagedAsyncEnumerable<SearchResponse, SearchResponse.Types.SearchResult> response = searchServiceClient.SearchAsync(request);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -62,6 +62,10 @@ public void SearchRequestObject()
ContentSearchSpec = new SearchRequest.Types.ContentSearchSpec(),
RankingExpression = "",
CanonicalFilter = "",
DataStoreSpecs =
{
new SearchRequest.Types.DataStoreSpec(),
},
};
// Make the request
PagedEnumerable<SearchResponse, SearchResponse.Types.SearchResult> response = searchServiceClient.Search(request);
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,67 @@
// Copyright 2024 Google LLC
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// https://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.

// Generated code. DO NOT EDIT!

namespace GoogleCSharpSnippets
{
// [START discoveryengine_v1beta_generated_SearchTuningService_TrainCustomModel_async]
using Google.Cloud.DiscoveryEngine.V1Beta;
using Google.LongRunning;
using System.Threading.Tasks;

public sealed partial class GeneratedSearchTuningServiceClientSnippets
{
/// <summary>Snippet for TrainCustomModelAsync</summary>
/// <remarks>
/// 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/dotnet/docs/reference/help/client-configuration#endpoint.
/// </remarks>
public async Task TrainCustomModelRequestObjectAsync()
{
// Create client
SearchTuningServiceClient searchTuningServiceClient = await SearchTuningServiceClient.CreateAsync();
// Initialize request argument(s)
TrainCustomModelRequest request = new TrainCustomModelRequest
{
DataStoreAsDataStoreName = DataStoreName.FromProjectLocationDataStore("[PROJECT]", "[LOCATION]", "[DATA_STORE]"),
GcsTrainingInput = new TrainCustomModelRequest.Types.GcsTrainingInput(),
ModelType = "",
ErrorConfig = new ImportErrorConfig(),
};
// Make the request
Operation<TrainCustomModelResponse, TrainCustomModelMetadata> response = await searchTuningServiceClient.TrainCustomModelAsync(request);

// Poll until the returned long-running operation is complete
Operation<TrainCustomModelResponse, TrainCustomModelMetadata> completedResponse = await response.PollUntilCompletedAsync();
// Retrieve the operation result
TrainCustomModelResponse result = completedResponse.Result;

// Or get the name of the operation
string operationName = response.Name;
// This name can be stored, then the long-running operation retrieved later by name
Operation<TrainCustomModelResponse, TrainCustomModelMetadata> retrievedResponse = await searchTuningServiceClient.PollOnceTrainCustomModelAsync(operationName);
// Check if the retrieved long-running operation has completed
if (retrievedResponse.IsCompleted)
{
// If it has completed, then access the result
TrainCustomModelResponse retrievedResult = retrievedResponse.Result;
}
}
}
// [END discoveryengine_v1beta_generated_SearchTuningService_TrainCustomModel_async]
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,66 @@
// Copyright 2024 Google LLC
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// https://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.

// Generated code. DO NOT EDIT!

namespace GoogleCSharpSnippets
{
// [START discoveryengine_v1beta_generated_SearchTuningService_TrainCustomModel_sync]
using Google.Cloud.DiscoveryEngine.V1Beta;
using Google.LongRunning;

public sealed partial class GeneratedSearchTuningServiceClientSnippets
{
/// <summary>Snippet for TrainCustomModel</summary>
/// <remarks>
/// 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/dotnet/docs/reference/help/client-configuration#endpoint.
/// </remarks>
public void TrainCustomModelRequestObject()
{
// Create client
SearchTuningServiceClient searchTuningServiceClient = SearchTuningServiceClient.Create();
// Initialize request argument(s)
TrainCustomModelRequest request = new TrainCustomModelRequest
{
DataStoreAsDataStoreName = DataStoreName.FromProjectLocationDataStore("[PROJECT]", "[LOCATION]", "[DATA_STORE]"),
GcsTrainingInput = new TrainCustomModelRequest.Types.GcsTrainingInput(),
ModelType = "",
ErrorConfig = new ImportErrorConfig(),
};
// Make the request
Operation<TrainCustomModelResponse, TrainCustomModelMetadata> response = searchTuningServiceClient.TrainCustomModel(request);

// Poll until the returned long-running operation is complete
Operation<TrainCustomModelResponse, TrainCustomModelMetadata> completedResponse = response.PollUntilCompleted();
// Retrieve the operation result
TrainCustomModelResponse result = completedResponse.Result;

// Or get the name of the operation
string operationName = response.Name;
// This name can be stored, then the long-running operation retrieved later by name
Operation<TrainCustomModelResponse, TrainCustomModelMetadata> retrievedResponse = searchTuningServiceClient.PollOnceTrainCustomModel(operationName);
// Check if the retrieved long-running operation has completed
if (retrievedResponse.IsCompleted)
{
// If it has completed, then access the result
TrainCustomModelResponse retrievedResult = retrievedResponse.Result;
}
}
}
// [END discoveryengine_v1beta_generated_SearchTuningService_TrainCustomModel_sync]
}
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ public async Task ListServingConfigsAsync()
// Create client
ServingConfigServiceClient servingConfigServiceClient = await ServingConfigServiceClient.CreateAsync();
// Initialize request argument(s)
string parent = "projects/[PROJECT]/locations/[LOCATION]/dataStores/[DATA_STORE]";
string parent = "projects/[PROJECT]/locations/[LOCATION]/collections/[COLLECTION]/engines/[ENGINE]";
// Make the request
PagedAsyncEnumerable<ListServingConfigsResponse, ServingConfig> response = servingConfigServiceClient.ListServingConfigsAsync(parent);

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ public async Task ListServingConfigsRequestObjectAsync()
// Initialize request argument(s)
ListServingConfigsRequest request = new ListServingConfigsRequest
{
ParentAsDataStoreName = DataStoreName.FromProjectLocationDataStore("[PROJECT]", "[LOCATION]", "[DATA_STORE]"),
ParentAsEngineName = EngineName.FromProjectLocationCollectionEngine("[PROJECT]", "[LOCATION]", "[COLLECTION]", "[ENGINE]"),
};
// Make the request
PagedAsyncEnumerable<ListServingConfigsResponse, ServingConfig> response = servingConfigServiceClient.ListServingConfigsAsync(request);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ public void ListServingConfigsRequestObject()
// Initialize request argument(s)
ListServingConfigsRequest request = new ListServingConfigsRequest
{
ParentAsDataStoreName = DataStoreName.FromProjectLocationDataStore("[PROJECT]", "[LOCATION]", "[DATA_STORE]"),
ParentAsEngineName = EngineName.FromProjectLocationCollectionEngine("[PROJECT]", "[LOCATION]", "[COLLECTION]", "[ENGINE]"),
};
// Make the request
PagedEnumerable<ListServingConfigsResponse, ServingConfig> response = servingConfigServiceClient.ListServingConfigs(request);
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,79 @@
// Copyright 2024 Google LLC
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// https://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.

// Generated code. DO NOT EDIT!

namespace GoogleCSharpSnippets
{
// [START discoveryengine_v1beta_generated_ServingConfigService_ListServingConfigs_async_flattened_resourceNames1]
using Google.Api.Gax;
using Google.Cloud.DiscoveryEngine.V1Beta;
using System;
using System.Linq;
using System.Threading.Tasks;

public sealed partial class GeneratedServingConfigServiceClientSnippets
{
/// <summary>Snippet for ListServingConfigsAsync</summary>
/// <remarks>
/// 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/dotnet/docs/reference/help/client-configuration#endpoint.
/// </remarks>
public async Task ListServingConfigsResourceNames1Async()
{
// Create client
ServingConfigServiceClient servingConfigServiceClient = await ServingConfigServiceClient.CreateAsync();
// Initialize request argument(s)
EngineName parent = EngineName.FromProjectLocationCollectionEngine("[PROJECT]", "[LOCATION]", "[COLLECTION]", "[ENGINE]");
// Make the request
PagedAsyncEnumerable<ListServingConfigsResponse, ServingConfig> response = servingConfigServiceClient.ListServingConfigsAsync(parent);

// Iterate over all response items, lazily performing RPCs as required
await response.ForEachAsync((ServingConfig item) =>
{
// Do something with each item
Console.WriteLine(item);
});

// Or iterate over pages (of server-defined size), performing one RPC per page
await response.AsRawResponses().ForEachAsync((ListServingConfigsResponse page) =>
{
// Do something with each page of items
Console.WriteLine("A page of results:");
foreach (ServingConfig item in page)
{
// Do something with each item
Console.WriteLine(item);
}
});

// Or retrieve a single page of known size (unless it's the final page), performing as many RPCs as required
int pageSize = 10;
Page<ServingConfig> singlePage = await response.ReadPageAsync(pageSize);
// Do something with the page of items
Console.WriteLine($"A page of {pageSize} results (unless it's the final page):");
foreach (ServingConfig item in singlePage)
{
// Do something with each item
Console.WriteLine(item);
}
// Store the pageToken, for when the next page is required.
string nextPageToken = singlePage.NextPageToken;
}
}
// [END discoveryengine_v1beta_generated_ServingConfigService_ListServingConfigs_async_flattened_resourceNames1]
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,77 @@
// Copyright 2024 Google LLC
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// https://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.

// Generated code. DO NOT EDIT!

namespace GoogleCSharpSnippets
{
// [START discoveryengine_v1beta_generated_ServingConfigService_ListServingConfigs_sync_flattened_resourceNames1]
using Google.Api.Gax;
using Google.Cloud.DiscoveryEngine.V1Beta;
using System;

public sealed partial class GeneratedServingConfigServiceClientSnippets
{
/// <summary>Snippet for ListServingConfigs</summary>
/// <remarks>
/// 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/dotnet/docs/reference/help/client-configuration#endpoint.
/// </remarks>
public void ListServingConfigsResourceNames1()
{
// Create client
ServingConfigServiceClient servingConfigServiceClient = ServingConfigServiceClient.Create();
// Initialize request argument(s)
EngineName parent = EngineName.FromProjectLocationCollectionEngine("[PROJECT]", "[LOCATION]", "[COLLECTION]", "[ENGINE]");
// Make the request
PagedEnumerable<ListServingConfigsResponse, ServingConfig> response = servingConfigServiceClient.ListServingConfigs(parent);

// Iterate over all response items, lazily performing RPCs as required
foreach (ServingConfig item in response)
{
// Do something with each item
Console.WriteLine(item);
}

// Or iterate over pages (of server-defined size), performing one RPC per page
foreach (ListServingConfigsResponse page in response.AsRawResponses())
{
// Do something with each page of items
Console.WriteLine("A page of results:");
foreach (ServingConfig item in page)
{
// Do something with each item
Console.WriteLine(item);
}
}

// Or retrieve a single page of known size (unless it's the final page), performing as many RPCs as required
int pageSize = 10;
Page<ServingConfig> singlePage = response.ReadPage(pageSize);
// Do something with the page of items
Console.WriteLine($"A page of {pageSize} results (unless it's the final page):");
foreach (ServingConfig item in singlePage)
{
// Do something with each item
Console.WriteLine(item);
}
// Store the pageToken, for when the next page is required.
string nextPageToken = singlePage.NextPageToken;
}
}
// [END discoveryengine_v1beta_generated_ServingConfigService_ListServingConfigs_sync_flattened_resourceNames1]
}
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@

namespace GoogleCSharpSnippets
{
// [START discoveryengine_v1beta_generated_ServingConfigService_ListServingConfigs_async_flattened_resourceNames]
// [START discoveryengine_v1beta_generated_ServingConfigService_ListServingConfigs_async_flattened_resourceNames2]
using Google.Api.Gax;
using Google.Cloud.DiscoveryEngine.V1Beta;
using System;
Expand All @@ -33,7 +33,7 @@ public sealed partial class GeneratedServingConfigServiceClientSnippets
/// - It may require specifying regional endpoints when creating the service client as shown in
/// https://cloud.google.com/dotnet/docs/reference/help/client-configuration#endpoint.
/// </remarks>
public async Task ListServingConfigsResourceNamesAsync()
public async Task ListServingConfigsResourceNames2Async()
{
// Create client
ServingConfigServiceClient servingConfigServiceClient = await ServingConfigServiceClient.CreateAsync();
Expand Down Expand Up @@ -75,5 +75,5 @@ public async Task ListServingConfigsResourceNamesAsync()
string nextPageToken = singlePage.NextPageToken;
}
}
// [END discoveryengine_v1beta_generated_ServingConfigService_ListServingConfigs_async_flattened_resourceNames]
// [END discoveryengine_v1beta_generated_ServingConfigService_ListServingConfigs_async_flattened_resourceNames2]
}
Loading

0 comments on commit a2187da

Please sign in to comment.