Skip to content

Commit

Permalink
feat: add a dynamic retrieval API
Browse files Browse the repository at this point in the history
PiperOrigin-RevId: 681780557
  • Loading branch information
Google APIs authored and copybara-github committed Oct 3, 2024
1 parent 4fe2139 commit 475669f
Show file tree
Hide file tree
Showing 2 changed files with 40 additions and 1 deletion.
17 changes: 17 additions & 0 deletions google/cloud/aiplatform/v1/content.proto
Original file line number Diff line number Diff line change
Expand Up @@ -560,6 +560,12 @@ message GroundingMetadata {
// Optional. List of grounding support.
repeated GroundingSupport grounding_supports = 6
[(google.api.field_behavior) = OPTIONAL];

// Optional. Output only. Retrieval metadata.
optional RetrievalMetadata retrieval_metadata = 7 [
(google.api.field_behavior) = OPTIONAL,
(google.api.field_behavior) = OUTPUT_ONLY
];
}

// Google search entry point.
Expand All @@ -572,3 +578,14 @@ message SearchEntryPoint {
// url> tuple.
bytes sdk_blob = 2 [(google.api.field_behavior) = OPTIONAL];
}

// Metadata related to retrieval in the grounding flow.
message RetrievalMetadata {
// Optional. Score indicating how likely information from google search could
// help answer the prompt. The score is in the range `[0, 1]`, where 0 is the
// least likely and 1 is the most likely. This score is only populated when
// google search grounding and dynamic retrieval is enabled. It will be
// compared to the threshold to determine whether to trigger google search.
float google_search_dynamic_retrieval_score = 2
[(google.api.field_behavior) = OPTIONAL];
}
24 changes: 23 additions & 1 deletion google/cloud/aiplatform/v1/tool.proto
Original file line number Diff line number Diff line change
Expand Up @@ -142,7 +142,29 @@ message VertexAISearch {
}

// Tool to retrieve public web data for grounding, powered by Google.
message GoogleSearchRetrieval {}
message GoogleSearchRetrieval {
// Specifies the dynamic retrieval configuration for the given source.
DynamicRetrievalConfig dynamic_retrieval_config = 2;
}

// Describes the options to customize dynamic retrieval.
message DynamicRetrievalConfig {
// The mode of the predictor to be used in dynamic retrieval.
enum Mode {
// Always trigger retrieval.
MODE_UNSPECIFIED = 0;

// Run retrieval only when system decides it is necessary.
MODE_DYNAMIC = 1;
}

// The mode of the predictor to be used in dynamic retrieval.
Mode mode = 1;

// Optional. The threshold to be used in dynamic retrieval.
// If not set, a system default value is used.
optional float dynamic_threshold = 2 [(google.api.field_behavior) = OPTIONAL];
}

// Tool config. This config is shared for all tools provided in the request.
message ToolConfig {
Expand Down

0 comments on commit 475669f

Please sign in to comment.