googleapis/google/cloud/discoveryengine/v1/assist_answer.proto
Google APIs 29c6015e95 feat: add AssistantService
PiperOrigin-RevId: 785997711
2025-07-22 14:28:44 -07:00

251 lines
7.8 KiB
Protocol Buffer

// Copyright 2025 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.v1;
import "google/api/field_behavior.proto";
import "google/api/resource.proto";
option csharp_namespace = "Google.Cloud.DiscoveryEngine.V1";
option go_package = "cloud.google.com/go/discoveryengine/apiv1/discoveryenginepb;discoveryenginepb";
option java_multiple_files = true;
option java_outer_classname = "AssistAnswerProto";
option java_package = "com.google.cloud.discoveryengine.v1";
option objc_class_prefix = "DISCOVERYENGINE";
option php_namespace = "Google\\Cloud\\DiscoveryEngine\\V1";
option ruby_package = "Google::Cloud::DiscoveryEngine::V1";
// AssistAnswer resource, main part of
// [AssistResponse][google.cloud.discoveryengine.v1.AssistResponse].
message AssistAnswer {
option (google.api.resource) = {
type: "discoveryengine.googleapis.com/AssistAnswer"
pattern: "projects/{project}/locations/{location}/collections/{collection}/engines/{engine}/sessions/{session}/assistAnswers/{assist_answer}"
};
// One part of the multi-part response of the assist call.
message Reply {
// Alternatives for the assistant reply.
oneof reply {
// Possibly grounded response text or media from the assistant.
AssistantGroundedContent grounded_content = 1;
}
}
// State of the answer generation.
enum State {
// Unknown.
STATE_UNSPECIFIED = 0;
// Assist operation is currently in progress.
IN_PROGRESS = 1;
// Assist operation has failed.
FAILED = 2;
// Assist operation has succeeded.
SUCCEEDED = 3;
// Assist operation has been skipped.
SKIPPED = 4;
}
// Possible reasons for not answering an assist call.
enum AssistSkippedReason {
// Default value. Skip reason is not specified.
ASSIST_SKIPPED_REASON_UNSPECIFIED = 0;
// The assistant ignored the query, because it did not appear to be
// answer-seeking.
NON_ASSIST_SEEKING_QUERY_IGNORED = 1;
// The assistant ignored the query or refused to answer because of a
// customer policy violation (e.g., the query or the answer contained a
// banned phrase).
CUSTOMER_POLICY_VIOLATION = 2;
}
// Immutable. Resource name of the `AssistAnswer`.
// Format:
// `projects/{project}/locations/{location}/collections/{collection}/engines/{engine}/sessions/{session}/assistAnswers/{assist_answer}`
//
// This field must be a UTF-8 encoded string with a length limit of 1024
// characters.
string name = 1 [(google.api.field_behavior) = IMMUTABLE];
// State of the answer generation.
State state = 2;
// Replies of the assistant.
repeated Reply replies = 3;
// Reasons for not answering the assist call.
repeated AssistSkippedReason assist_skipped_reasons = 5;
}
// Multi-modal content.
message AssistantContent {
// Inline blob.
message Blob {
// Required. The media type (MIME type) of the generated data.
string mime_type = 1 [(google.api.field_behavior) = REQUIRED];
// Required. Raw bytes.
bytes data = 2 [(google.api.field_behavior) = REQUIRED];
}
// A file, e.g., an audio summary.
message File {
// Required. The media type (MIME type) of the file.
string mime_type = 1 [(google.api.field_behavior) = REQUIRED];
// Required. The file ID.
string file_id = 2 [(google.api.field_behavior) = REQUIRED];
}
// Code generated by the model that is meant to be executed by the model.
message ExecutableCode {
// Required. The code content. Currently only supports Python.
string code = 2 [(google.api.field_behavior) = REQUIRED];
}
// Result of executing ExecutableCode.
message CodeExecutionResult {
// Enumeration of possible outcomes of the code execution.
enum Outcome {
// Unspecified status. This value should not be used.
OUTCOME_UNSPECIFIED = 0;
// Code execution completed successfully.
OUTCOME_OK = 1;
// Code execution finished but with a failure. `stderr` should contain the
// reason.
OUTCOME_FAILED = 2;
// Code execution ran for too long, and was cancelled. There may or may
// not be a partial output present.
OUTCOME_DEADLINE_EXCEEDED = 3;
}
// Required. Outcome of the code execution.
Outcome outcome = 1 [(google.api.field_behavior) = REQUIRED];
// Optional. Contains stdout when code execution is successful, stderr or
// other description otherwise.
string output = 2 [(google.api.field_behavior) = OPTIONAL];
}
// Contained data.
oneof data {
// Inline text.
string text = 2;
// Inline binary data.
Blob inline_data = 3;
// A file, e.g., an audio summary.
File file = 4;
// Code generated by the model that is meant to be executed.
ExecutableCode executable_code = 7;
// Result of executing an ExecutableCode.
CodeExecutionResult code_execution_result = 8;
}
// The producer of the content. Can be "model" or "user".
string role = 1;
// Optional. Indicates if the part is thought from the model.
bool thought = 6 [(google.api.field_behavior) = OPTIONAL];
}
// A piece of content and possibly its grounding information.
//
// Not all content needs grounding. Phrases like "Of course, I will gladly
// search it for you." do not need grounding.
message AssistantGroundedContent {
// Grounding details for text sources.
message TextGroundingMetadata {
// Grounding information for a segment of the text.
message Segment {
// Zero-based index indicating the start of the segment, measured in bytes
// of a UTF-8 string (i.e. characters encoded on multiple bytes have a
// length of more than one).
int64 start_index = 1;
// End of the segment, exclusive.
int64 end_index = 2;
// References for the segment.
repeated int32 reference_indices = 4;
// Score for the segment.
float grounding_score = 5;
// The text segment itself.
string text = 6;
}
// Referenced content and related document metadata.
message Reference {
// Document metadata.
message DocumentMetadata {
// Document resource name.
optional string document = 1 [(google.api.resource_reference) = {
type: "discoveryengine.googleapis.com/Document"
}];
// URI for the document. It may contain a URL that redirects to the
// actual website.
optional string uri = 2;
// Title.
optional string title = 3;
// Page identifier.
optional string page_identifier = 4;
// Domain name from the document URI. Note that the `uri` field may
// contain a URL that redirects to the actual website, in which case
// this will contain the domain name of the target site.
optional string domain = 5;
}
// Referenced text content.
string content = 1;
// Document metadata.
DocumentMetadata document_metadata = 2;
}
// Grounding information for parts of the text.
repeated Segment segments = 4;
// References for the grounded text.
repeated Reference references = 2;
}
// Grounding metadata for various modals. It only supports text for now.
oneof metadata {
// Metadata for grounding based on text sources.
TextGroundingMetadata text_grounding_metadata = 3;
}
// The content.
AssistantContent content = 1;
}