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

Source-Link: googleapis/googleapis@475669f

Source-Link: googleapis/googleapis-gen@bbbb240
Copy-Tag: eyJwIjoicGFja2FnZXMvZ29vZ2xlLWNsb3VkLWFpcGxhdGZvcm0vLk93bEJvdC55YW1sIiwiaCI6ImJiYmIyNDBhMzhiNGE0NDU3NDUxZjYzYTNlZmFjYmI4MDY4YTY3ZWQifQ==
  • Loading branch information
gcf-owl-bot[bot] committed Oct 3, 2024
1 parent 364cf55 commit b5b4dfe
Show file tree
Hide file tree
Showing 5 changed files with 889 additions and 5 deletions.
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];
}
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
227 changes: 227 additions & 0 deletions owl-bot-staging/google-cloud-aiplatform/v1/protos/protos.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -11378,6 +11378,9 @@ export namespace google {

/** GroundingMetadata groundingSupports */
groundingSupports?: (google.cloud.aiplatform.v1.IGroundingSupport[]|null);

/** GroundingMetadata retrievalMetadata */
retrievalMetadata?: (google.cloud.aiplatform.v1.IRetrievalMetadata|null);
}

/** Represents a GroundingMetadata. */
Expand All @@ -11401,9 +11404,15 @@ export namespace google {
/** GroundingMetadata groundingSupports. */
public groundingSupports: google.cloud.aiplatform.v1.IGroundingSupport[];

/** GroundingMetadata retrievalMetadata. */
public retrievalMetadata?: (google.cloud.aiplatform.v1.IRetrievalMetadata|null);

/** GroundingMetadata _searchEntryPoint. */
public _searchEntryPoint?: "searchEntryPoint";

/** GroundingMetadata _retrievalMetadata. */
public _retrievalMetadata?: "retrievalMetadata";

/**
* Creates a new GroundingMetadata instance using the specified properties.
* @param [properties] Properties to set
Expand Down Expand Up @@ -11585,6 +11594,103 @@ export namespace google {
public static getTypeUrl(typeUrlPrefix?: string): string;
}

/** Properties of a RetrievalMetadata. */
interface IRetrievalMetadata {

/** RetrievalMetadata googleSearchDynamicRetrievalScore */
googleSearchDynamicRetrievalScore?: (number|null);
}

/** Represents a RetrievalMetadata. */
class RetrievalMetadata implements IRetrievalMetadata {

/**
* Constructs a new RetrievalMetadata.
* @param [properties] Properties to set
*/
constructor(properties?: google.cloud.aiplatform.v1.IRetrievalMetadata);

/** RetrievalMetadata googleSearchDynamicRetrievalScore. */
public googleSearchDynamicRetrievalScore: number;

/**
* Creates a new RetrievalMetadata instance using the specified properties.
* @param [properties] Properties to set
* @returns RetrievalMetadata instance
*/
public static create(properties?: google.cloud.aiplatform.v1.IRetrievalMetadata): google.cloud.aiplatform.v1.RetrievalMetadata;

/**
* Encodes the specified RetrievalMetadata message. Does not implicitly {@link google.cloud.aiplatform.v1.RetrievalMetadata.verify|verify} messages.
* @param message RetrievalMetadata message or plain object to encode
* @param [writer] Writer to encode to
* @returns Writer
*/
public static encode(message: google.cloud.aiplatform.v1.IRetrievalMetadata, writer?: $protobuf.Writer): $protobuf.Writer;

/**
* Encodes the specified RetrievalMetadata message, length delimited. Does not implicitly {@link google.cloud.aiplatform.v1.RetrievalMetadata.verify|verify} messages.
* @param message RetrievalMetadata message or plain object to encode
* @param [writer] Writer to encode to
* @returns Writer
*/
public static encodeDelimited(message: google.cloud.aiplatform.v1.IRetrievalMetadata, writer?: $protobuf.Writer): $protobuf.Writer;

/**
* Decodes a RetrievalMetadata message from the specified reader or buffer.
* @param reader Reader or buffer to decode from
* @param [length] Message length if known beforehand
* @returns RetrievalMetadata
* @throws {Error} If the payload is not a reader or valid buffer
* @throws {$protobuf.util.ProtocolError} If required fields are missing
*/
public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.aiplatform.v1.RetrievalMetadata;

/**
* Decodes a RetrievalMetadata message from the specified reader or buffer, length delimited.
* @param reader Reader or buffer to decode from
* @returns RetrievalMetadata
* @throws {Error} If the payload is not a reader or valid buffer
* @throws {$protobuf.util.ProtocolError} If required fields are missing
*/
public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.aiplatform.v1.RetrievalMetadata;

/**
* Verifies a RetrievalMetadata message.
* @param message Plain object to verify
* @returns `null` if valid, otherwise the reason why it is not
*/
public static verify(message: { [k: string]: any }): (string|null);

/**
* Creates a RetrievalMetadata message from a plain object. Also converts values to their respective internal types.
* @param object Plain object
* @returns RetrievalMetadata
*/
public static fromObject(object: { [k: string]: any }): google.cloud.aiplatform.v1.RetrievalMetadata;

/**
* Creates a plain object from a RetrievalMetadata message. Also converts values to other types if specified.
* @param message RetrievalMetadata
* @param [options] Conversion options
* @returns Plain object
*/
public static toObject(message: google.cloud.aiplatform.v1.RetrievalMetadata, options?: $protobuf.IConversionOptions): { [k: string]: any };

/**
* Converts this RetrievalMetadata to JSON.
* @returns JSON object
*/
public toJSON(): { [k: string]: any };

/**
* Gets the default type url for RetrievalMetadata
* @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com")
* @returns The default type url
*/
public static getTypeUrl(typeUrlPrefix?: string): string;
}

/** Type enum. */
enum Type {
TYPE_UNSPECIFIED = 0,
Expand Down Expand Up @@ -12448,6 +12554,9 @@ export namespace google {

/** Properties of a GoogleSearchRetrieval. */
interface IGoogleSearchRetrieval {

/** GoogleSearchRetrieval dynamicRetrievalConfig */
dynamicRetrievalConfig?: (google.cloud.aiplatform.v1.IDynamicRetrievalConfig|null);
}

/** Represents a GoogleSearchRetrieval. */
Expand All @@ -12459,6 +12568,9 @@ export namespace google {
*/
constructor(properties?: google.cloud.aiplatform.v1.IGoogleSearchRetrieval);

/** GoogleSearchRetrieval dynamicRetrievalConfig. */
public dynamicRetrievalConfig?: (google.cloud.aiplatform.v1.IDynamicRetrievalConfig|null);

/**
* Creates a new GoogleSearchRetrieval instance using the specified properties.
* @param [properties] Properties to set
Expand Down Expand Up @@ -12537,6 +12649,121 @@ export namespace google {
public static getTypeUrl(typeUrlPrefix?: string): string;
}

/** Properties of a DynamicRetrievalConfig. */
interface IDynamicRetrievalConfig {

/** DynamicRetrievalConfig mode */
mode?: (google.cloud.aiplatform.v1.DynamicRetrievalConfig.Mode|keyof typeof google.cloud.aiplatform.v1.DynamicRetrievalConfig.Mode|null);

/** DynamicRetrievalConfig dynamicThreshold */
dynamicThreshold?: (number|null);
}

/** Represents a DynamicRetrievalConfig. */
class DynamicRetrievalConfig implements IDynamicRetrievalConfig {

/**
* Constructs a new DynamicRetrievalConfig.
* @param [properties] Properties to set
*/
constructor(properties?: google.cloud.aiplatform.v1.IDynamicRetrievalConfig);

/** DynamicRetrievalConfig mode. */
public mode: (google.cloud.aiplatform.v1.DynamicRetrievalConfig.Mode|keyof typeof google.cloud.aiplatform.v1.DynamicRetrievalConfig.Mode);

/** DynamicRetrievalConfig dynamicThreshold. */
public dynamicThreshold?: (number|null);

/** DynamicRetrievalConfig _dynamicThreshold. */
public _dynamicThreshold?: "dynamicThreshold";

/**
* Creates a new DynamicRetrievalConfig instance using the specified properties.
* @param [properties] Properties to set
* @returns DynamicRetrievalConfig instance
*/
public static create(properties?: google.cloud.aiplatform.v1.IDynamicRetrievalConfig): google.cloud.aiplatform.v1.DynamicRetrievalConfig;

/**
* Encodes the specified DynamicRetrievalConfig message. Does not implicitly {@link google.cloud.aiplatform.v1.DynamicRetrievalConfig.verify|verify} messages.
* @param message DynamicRetrievalConfig message or plain object to encode
* @param [writer] Writer to encode to
* @returns Writer
*/
public static encode(message: google.cloud.aiplatform.v1.IDynamicRetrievalConfig, writer?: $protobuf.Writer): $protobuf.Writer;

/**
* Encodes the specified DynamicRetrievalConfig message, length delimited. Does not implicitly {@link google.cloud.aiplatform.v1.DynamicRetrievalConfig.verify|verify} messages.
* @param message DynamicRetrievalConfig message or plain object to encode
* @param [writer] Writer to encode to
* @returns Writer
*/
public static encodeDelimited(message: google.cloud.aiplatform.v1.IDynamicRetrievalConfig, writer?: $protobuf.Writer): $protobuf.Writer;

/**
* Decodes a DynamicRetrievalConfig message from the specified reader or buffer.
* @param reader Reader or buffer to decode from
* @param [length] Message length if known beforehand
* @returns DynamicRetrievalConfig
* @throws {Error} If the payload is not a reader or valid buffer
* @throws {$protobuf.util.ProtocolError} If required fields are missing
*/
public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.aiplatform.v1.DynamicRetrievalConfig;

/**
* Decodes a DynamicRetrievalConfig message from the specified reader or buffer, length delimited.
* @param reader Reader or buffer to decode from
* @returns DynamicRetrievalConfig
* @throws {Error} If the payload is not a reader or valid buffer
* @throws {$protobuf.util.ProtocolError} If required fields are missing
*/
public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.aiplatform.v1.DynamicRetrievalConfig;

/**
* Verifies a DynamicRetrievalConfig message.
* @param message Plain object to verify
* @returns `null` if valid, otherwise the reason why it is not
*/
public static verify(message: { [k: string]: any }): (string|null);

/**
* Creates a DynamicRetrievalConfig message from a plain object. Also converts values to their respective internal types.
* @param object Plain object
* @returns DynamicRetrievalConfig
*/
public static fromObject(object: { [k: string]: any }): google.cloud.aiplatform.v1.DynamicRetrievalConfig;

/**
* Creates a plain object from a DynamicRetrievalConfig message. Also converts values to other types if specified.
* @param message DynamicRetrievalConfig
* @param [options] Conversion options
* @returns Plain object
*/
public static toObject(message: google.cloud.aiplatform.v1.DynamicRetrievalConfig, options?: $protobuf.IConversionOptions): { [k: string]: any };

/**
* Converts this DynamicRetrievalConfig to JSON.
* @returns JSON object
*/
public toJSON(): { [k: string]: any };

/**
* Gets the default type url for DynamicRetrievalConfig
* @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com")
* @returns The default type url
*/
public static getTypeUrl(typeUrlPrefix?: string): string;
}

namespace DynamicRetrievalConfig {

/** Mode enum. */
enum Mode {
MODE_UNSPECIFIED = 0,
MODE_DYNAMIC = 1
}
}

/** Properties of a ToolConfig. */
interface IToolConfig {

Expand Down
Loading

0 comments on commit b5b4dfe

Please sign in to comment.