Skip to content

Commit

Permalink
feat: support import data from Cloud Spanner, BigTable, SQL and Fires…
Browse files Browse the repository at this point in the history
…tore

feat: add answer generation APIs
feat: add standalone grounding API
feat: add standalone ranking API
feat: support advanced search boosting
feat: add advanced engine model APIs
docs: keep the API doc up-to-date with recent changes

PiperOrigin-RevId: 623543290
  • Loading branch information
Google APIs authored and Copybara-Service committed Apr 10, 2024
1 parent fc89055 commit 5fadb63
Show file tree
Hide file tree
Showing 18 changed files with 1,863 additions and 60 deletions.
10 changes: 9 additions & 1 deletion google/cloud/discoveryengine/v1beta/BUILD.bazel
Expand Up @@ -24,6 +24,7 @@ load("@rules_proto//proto:defs.bzl", "proto_library")
proto_library(
name = "discoveryengine_proto",
srcs = [
"answer.proto",
"common.proto",
"completion.proto",
"completion_service.proto",
Expand All @@ -36,15 +37,19 @@ proto_library(
"document_service.proto",
"engine.proto",
"engine_service.proto",
"grounded_generation_service.proto",
"grounding.proto",
"import_config.proto",
"purge_config.proto",
"rank_service.proto",
"recommendation_service.proto",
"schema.proto",
"schema_service.proto",
"search_service.proto",
"search_tuning_service.proto",
"serving_config.proto",
"serving_config_service.proto",
"session.proto",
"site_search_engine.proto",
"site_search_engine_service.proto",
"user_event.proto",
Expand Down Expand Up @@ -132,6 +137,10 @@ java_gapic_test(
"com.google.cloud.discoveryengine.v1beta.DocumentServiceClientTest",
"com.google.cloud.discoveryengine.v1beta.EngineServiceClientHttpJsonTest",
"com.google.cloud.discoveryengine.v1beta.EngineServiceClientTest",
"com.google.cloud.discoveryengine.v1beta.GroundedGenerationServiceClientHttpJsonTest",
"com.google.cloud.discoveryengine.v1beta.GroundedGenerationServiceClientTest",
"com.google.cloud.discoveryengine.v1beta.RankServiceClientHttpJsonTest",
"com.google.cloud.discoveryengine.v1beta.RankServiceClientTest",
"com.google.cloud.discoveryengine.v1beta.RecommendationServiceClientHttpJsonTest",
"com.google.cloud.discoveryengine.v1beta.RecommendationServiceClientTest",
"com.google.cloud.discoveryengine.v1beta.SchemaServiceClientHttpJsonTest",
Expand Down Expand Up @@ -392,7 +401,6 @@ load(

csharp_proto_library(
name = "discoveryengine_csharp_proto",
extra_opts = [],
deps = [":discoveryengine_proto"],
)

Expand Down
328 changes: 328 additions & 0 deletions google/cloud/discoveryengine/v1beta/answer.proto
@@ -0,0 +1,328 @@
// Copyright 2022 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
//
// http://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.

syntax = "proto3";

package google.cloud.discoveryengine.v1beta;

import "google/api/field_behavior.proto";
import "google/api/resource.proto";
import "google/protobuf/timestamp.proto";

option csharp_namespace = "Google.Cloud.DiscoveryEngine.V1Beta";
option go_package = "cloud.google.com/go/discoveryengine/apiv1beta/discoveryenginepb;discoveryenginepb";
option java_multiple_files = true;
option java_outer_classname = "AnswerProto";
option java_package = "com.google.cloud.discoveryengine.v1beta";
option objc_class_prefix = "DISCOVERYENGINE";
option php_namespace = "Google\\Cloud\\DiscoveryEngine\\V1beta";
option ruby_package = "Google::Cloud::DiscoveryEngine::V1beta";

// Defines an answer.
message Answer {
option (google.api.resource) = {
type: "discoveryengine.googleapis.com/Answer"
pattern: "projects/{project}/locations/{location}/dataStores/{data_store}/sessions/{session}/answers/{answer}"
pattern: "projects/{project}/locations/{location}/collections/{collection}/dataStores/{data_store}/sessions/{session}/answers/{answer}"
pattern: "projects/{project}/locations/{location}/collections/{collection}/engines/{engine}/sessions/{session}/answers/{answer}"
};

// Citation info for a segment.
message Citation {
// Index indicates the start of the segment, measured in bytes (UTF-8
// unicode).
int64 start_index = 1;

// End of the attributed segment, exclusive.
int64 end_index = 2;

// Citation sources for the attributed segment.
repeated CitationSource sources = 3;
}

// Citation source.
message CitationSource {
// ID of the citation source.
string reference_id = 1;
}

// Reference.
message Reference {
// Unstructured document information.
message UnstructuredDocumentInfo {
// Chunk content.
message ChunkContent {
// Chunk textual content.
string content = 1;

// Page identifier.
string page_identifier = 2;
}

// Document resource name.
string document = 1 [(google.api.resource_reference) = {
type: "discoveryengine.googleapis.com/Document"
}];

// URI for the document.
string uri = 2;

// Title.
string title = 3;

// List of cited chunk contents derived from document content.
repeated ChunkContent chunk_contents = 4;
}

// Chunk information.
message ChunkInfo {
// Document metadata.
message DocumentMetadata {
// Document resource name.
string document = 1 [(google.api.resource_reference) = {
type: "discoveryengine.googleapis.com/Document"
}];

// URI for the document.
string uri = 2;

// Title.
string title = 3;

// Page identifier.
string page_identifier = 4;
}

// Chunk resource name.
string chunk = 1 [(google.api.resource_reference) = {
type: "discoveryengine.googleapis.com/Chunk"
}];

// Chunk textual content.
string content = 2;

// Relevance score.
optional float relevance_score = 3;

// Document metadata.
DocumentMetadata document_metadata = 4;
}

// Search result content.
oneof content {
// Unstructured document information.
UnstructuredDocumentInfo unstructured_document_info = 1;

// Chunk information.
ChunkInfo chunk_info = 2;
}
}

// Step information.
message Step {
// Action.
message Action {
// Search action.
message SearchAction {
// The query to search.
string query = 1;
}

// Observation.
message Observation {
message SearchResult {
// Snippet information.
message SnippetInfo {
// Snippet content.
string snippet = 1;

// Status of the snippet defined by the search team.
string snippet_status = 2;
}

// Chunk information.
message ChunkInfo {
// Chunk resource name.
string chunk = 1;

// Chunk textual content.
string content = 2;

// Relevance score.
optional float relevance_score = 3;
}

// Document resource name.
string document = 1;

// URI for the document.
string uri = 2;

// Title.
string title = 3;

// If citation_type is DOCUMENT_LEVEL_CITATION, populate document
// level snippets.
repeated SnippetInfo snippet_info = 4;

// If citation_type is CHUNK_LEVEL_CITATION and chunk mode is on,
// populate chunk info.
repeated ChunkInfo chunk_info = 5;
}

// Search results observed by the search action, it can be snippets info
// or chunk info, depending on the citation type set by the user.
repeated SearchResult search_results = 2;
}

// The action.
oneof action {
// Search action.
SearchAction search_action = 2;
}

// Observation.
Observation observation = 3;
}

// Enumeration of the state of the step.
enum State {
// Unknown.
STATE_UNSPECIFIED = 0;

// Step is currently in progress.
IN_PROGRESS = 1;

// Step currently failed.
FAILED = 2;

// Step has succeeded.
SUCCEEDED = 3;
}

// The state of the step.
State state = 1;

// The description of the step.
string description = 2;

// The thought of the step.
string thought = 3;

// Actions.
repeated Action actions = 4;
}

// Query understanding information.
message QueryUnderstandingInfo {
// Query classification information.
message QueryClassificationInfo {
// Query classification types.
enum Type {
// Unspecified query classification type.
TYPE_UNSPECIFIED = 0;

// Adversarial query classification type.
ADVERSARIAL_QUERY = 1;

// Non-answer-seeking query classification type.
NON_ANSWER_SEEKING_QUERY = 2;
}

// Query classification type.
Type type = 1;

// Classification output.
bool positive = 2;
}

// Query classification information.
repeated QueryClassificationInfo query_classification_info = 1;
}

// Enumeration of the state of the answer generation.
enum State {
// Unknown.
STATE_UNSPECIFIED = 0;

// Answer generation is currently in progress.
IN_PROGRESS = 1;

// Answer generation currently failed.
FAILED = 2;

// Answer generation has succeeded.
SUCCEEDED = 3;
}

// An enum for answer skipped reasons.
enum AnswerSkippedReason {
// Default value. The answer skipped reason is not specified.
ANSWER_SKIPPED_REASON_UNSPECIFIED = 0;

// The adversarial query ignored case.
ADVERSARIAL_QUERY_IGNORED = 1;

// The non-answer seeking query ignored case.
NON_ANSWER_SEEKING_QUERY_IGNORED = 2;

// The out-of-domain query ignored case.
//
// Google skips the answer if there are no high-relevance search results.
OUT_OF_DOMAIN_QUERY_IGNORED = 3;

// The potential policy violation case.
//
// Google skips the answer if there is a potential policy violation
// detected. This includes content that may be violent or toxic.
POTENTIAL_POLICY_VIOLATION = 4;
}

// Immutable. Fully qualified name
// `project/*/locations/global/collections/{collection}/engines/{engine}/sessions/*/answers/*`
string name = 1 [(google.api.field_behavior) = IMMUTABLE];

// The state of the answer generation.
State state = 2;

// The textual answer.
string answer_text = 3;

// Citations.
repeated Citation citations = 4;

// References.
repeated Reference references = 5;

// Suggested related questions.
repeated string related_questions = 6;

// Answer generation steps.
repeated Step steps = 7;

// Query understanding information.
QueryUnderstandingInfo query_understanding_info = 10;

// Additional answer-skipped reasons. This provides the reason for ignored
// cases. If nothing is skipped, this field is not set.
repeated AnswerSkippedReason answer_skipped_reasons = 11;

// Output only. Answer creation timestamp.
google.protobuf.Timestamp create_time = 8
[(google.api.field_behavior) = OUTPUT_ONLY];

// Output only. Answer completed timestamp.
google.protobuf.Timestamp complete_time = 9
[(google.api.field_behavior) = OUTPUT_ONLY];
}

0 comments on commit 5fadb63

Please sign in to comment.