Skip to content

Commit

Permalink
docs: A comment for field api_key_config in message `.google.cloud.…
Browse files Browse the repository at this point in the history
…aiplatform.v1beta1.JiraSource` is changed

docs: A comment for field `partial_failure_gcs_sink` in message `.google.cloud.aiplatform.v1beta1.ImportRagFilesConfig` is changed
docs: A comment for field `partial_failure_bigquery_sink` in message `.google.cloud.aiplatform.v1beta1.ImportRagFilesConfig` is changed
docs: A comment for field `rag_file_parsing_config` in message `.google.cloud.aiplatform.v1beta1.ImportRagFilesConfig` is changed
docs: A comment for field `source_uri` in message `.google.cloud.aiplatform.v1beta1.RagContexts` is changed
feat: Introduce HybridSearch and Ranking configuration for RAG
feat: Introduce VertexAiSearch integration for RAG

PiperOrigin-RevId: 699296635
  • Loading branch information
Google APIs authored and copybara-github committed Nov 22, 2024
1 parent 1c69885 commit 4fefaf1
Show file tree
Hide file tree
Showing 5 changed files with 374 additions and 25 deletions.
2 changes: 1 addition & 1 deletion google/cloud/aiplatform/v1beta1/aiplatform_v1beta1.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -924,7 +924,7 @@ authentication:
oauth:
canonical_scopes: |-
https://www.googleapis.com/auth/cloud-platform
- selector: google.cloud.aiplatform.v1beta1.VertexRagService.RetrieveContexts
- selector: 'google.cloud.aiplatform.v1beta1.VertexRagService.*'
oauth:
canonical_scopes: |-
https://www.googleapis.com/auth/cloud-platform
Expand Down
4 changes: 2 additions & 2 deletions google/cloud/aiplatform/v1beta1/io.proto
Original file line number Diff line number Diff line change
Expand Up @@ -193,8 +193,8 @@ message JiraSource {

// Required. The SecretManager secret version resource name (e.g.
// projects/{project}/secrets/{secret}/versions/{version}) storing the
// Jira API key
// (https://support.atlassian.com/atlassian-account/docs/manage-api-tokens-for-your-atlassian-account/).
// Jira API key. See [Manage API tokens for your Atlassian
// account](https://support.atlassian.com/atlassian-account/docs/manage-api-tokens-for-your-atlassian-account/).
ApiAuth.ApiKeyConfig api_key_config = 7
[(google.api.field_behavior) = REQUIRED];
}
Expand Down
77 changes: 76 additions & 1 deletion google/cloud/aiplatform/v1beta1/tool.proto
Original file line number Diff line number Diff line change
Expand Up @@ -281,11 +281,16 @@ message VertexRagStore {
[(google.api.field_behavior) = OPTIONAL];

// Optional. Number of top k results to return from the selected corpora.
optional int32 similarity_top_k = 2 [(google.api.field_behavior) = OPTIONAL];
optional int32 similarity_top_k = 2
[deprecated = true, (google.api.field_behavior) = OPTIONAL];

// Optional. Only return results with vector distance smaller than the
// threshold.
optional double vector_distance_threshold = 3
[deprecated = true, (google.api.field_behavior) = OPTIONAL];

// Optional. The retrieval config for the Rag query.
RagRetrievalConfig rag_retrieval_config = 6
[(google.api.field_behavior) = OPTIONAL];
}

Expand Down Expand Up @@ -361,3 +366,73 @@ message FunctionCallingConfig {
repeated string allowed_function_names = 2
[(google.api.field_behavior) = OPTIONAL];
}

// Specifies the context retrieval config.
message RagRetrievalConfig {
// Config for Hybrid Search.
message HybridSearch {
// Optional. Alpha value controls the weight between dense and sparse vector
// search results. The range is [0, 1], while 0 means sparse vector search
// only and 1 means dense vector search only. The default value is 0.5 which
// balances sparse and dense vector search equally.
optional float alpha = 1 [(google.api.field_behavior) = OPTIONAL];
}

// Config for filters.
message Filter {
// Filter contexts retrieved from the vector DB based on either vector
// distance or vector similarity.
oneof vector_db_threshold {
// Optional. Only returns contexts with vector distance smaller than the
// threshold.
double vector_distance_threshold = 3
[(google.api.field_behavior) = OPTIONAL];

// Optional. Only returns contexts with vector similarity larger than the
// threshold.
double vector_similarity_threshold = 4
[(google.api.field_behavior) = OPTIONAL];
}

// Optional. String for metadata filtering.
string metadata_filter = 2 [(google.api.field_behavior) = OPTIONAL];
}

// Config for ranking and reranking.
message Ranking {
// Config for Rank Service.
message RankService {
// Optional. The model name of the rank service.
// Format: `semantic-ranker-512@latest`
optional string model_name = 1 [(google.api.field_behavior) = OPTIONAL];
}

// Config for LlmRanker.
message LlmRanker {
// Optional. The model name used for ranking.
// Format: `gemini-1.5-pro`
optional string model_name = 1 [(google.api.field_behavior) = OPTIONAL];
}

// Config options for ranking. Currently only Rank Service is supported.
oneof ranking_config {
// Optional. Config for Rank Service.
RankService rank_service = 1 [(google.api.field_behavior) = OPTIONAL];

// Optional. Config for LlmRanker.
LlmRanker llm_ranker = 3 [(google.api.field_behavior) = OPTIONAL];
}
}

// Optional. The number of contexts to retrieve.
int32 top_k = 1 [(google.api.field_behavior) = OPTIONAL];

// Optional. Config for Hybrid Search.
HybridSearch hybrid_search = 2 [(google.api.field_behavior) = OPTIONAL];

// Optional. Config for filters.
Filter filter = 3 [(google.api.field_behavior) = OPTIONAL];

// Optional. Config for ranking and reranking.
Ranking ranking = 4 [(google.api.field_behavior) = OPTIONAL];
}
124 changes: 111 additions & 13 deletions google/cloud/aiplatform/v1beta1/vertex_rag_data.proto
Original file line number Diff line number Diff line change
Expand Up @@ -180,6 +180,12 @@ message RagVectorDbConfig {

// Authentication config for the chosen Vector DB.
ApiAuth api_auth = 5;

// Optional. Immutable. The embedding model config of the Vector DB.
RagEmbeddingModelConfig rag_embedding_model_config = 7 [
(google.api.field_behavior) = OPTIONAL,
(google.api.field_behavior) = IMMUTABLE
];
}

// RagFile status.
Expand All @@ -204,6 +210,15 @@ message FileStatus {
string error_status = 2 [(google.api.field_behavior) = OUTPUT_ONLY];
}

// Config for the Vertex AI Search.
message VertexAiSearchConfig {
// Vertex AI Search Serving Config resource full name. For example,
// `projects/{project}/locations/{location}/collections/{collection}/engines/{engine}/servingConfigs/{serving_config}`
// or
// `projects/{project}/locations/{location}/collections/{collection}/dataStores/{data_store}/servingConfigs/{serving_config}`.
string serving_config = 1;
}

// RagCorpus status.
message CorpusStatus {
// RagCorpus life state.
Expand Down Expand Up @@ -252,12 +267,14 @@ message RagCorpus {

// Optional. Immutable. The embedding model config of the RagCorpus.
RagEmbeddingModelConfig rag_embedding_model_config = 6 [
deprecated = true,
(google.api.field_behavior) = OPTIONAL,
(google.api.field_behavior) = IMMUTABLE
];

// Optional. Immutable. The Vector DB config of the RagCorpus.
RagVectorDbConfig rag_vector_db_config = 7 [
deprecated = true,
(google.api.field_behavior) = OPTIONAL,
(google.api.field_behavior) = IMMUTABLE
];
Expand All @@ -272,6 +289,22 @@ message RagCorpus {

// Output only. RagCorpus state.
CorpusStatus corpus_status = 8 [(google.api.field_behavior) = OUTPUT_ONLY];

// The backend config of the RagCorpus.
// It can be data store and/or retrieval engine.
oneof backend_config {
// Optional. Immutable. The config for the Vector DBs.
RagVectorDbConfig vector_db_config = 9 [
(google.api.field_behavior) = OPTIONAL,
(google.api.field_behavior) = IMMUTABLE
];

// Optional. Immutable. The config for the Vertex AI Search.
VertexAiSearchConfig vertex_ai_search_config = 10 [
(google.api.field_behavior) = OPTIONAL,
(google.api.field_behavior) = IMMUTABLE
];
}
}

// A RagFile contains user data for chunking, embedding and indexing.
Expand Down Expand Up @@ -353,23 +386,80 @@ message RagFile {

// Specifies the size and overlap of chunks for RagFiles.
message RagFileChunkingConfig {
// Specifies the fixed length chunking config.
message FixedLengthChunking {
// The size of the chunks.
int32 chunk_size = 1;

// The overlap between chunks.
int32 chunk_overlap = 2;
}

// Specifies the chunking config for RagFiles.
oneof chunking_config {
// Specifies the fixed length chunking config.
FixedLengthChunking fixed_length_chunking = 3;
}

// The size of the chunks.
int32 chunk_size = 1;
int32 chunk_size = 1 [deprecated = true];

// The overlap between chunks.
int32 chunk_overlap = 2;
int32 chunk_overlap = 2 [deprecated = true];
}

// Specifies the transformation config for RagFiles.
message RagFileTransformationConfig {
// Specifies the chunking config for RagFiles.
RagFileChunkingConfig rag_file_chunking_config = 1;
}

// Specifies the parsing config for RagFiles.
message RagFileParsingConfig {
// Specifies the advanced parsing for RagFiles.
message AdvancedParser {
// Whether to use advanced PDF parsing.
bool use_advanced_pdf_parsing = 1;
}

// Document AI Layout Parser config.
message LayoutParser {
// The full resource name of a Document AI processor or processor version.
// The processor must have type `LAYOUT_PARSER_PROCESSOR`. If specified, the
// `additional_config.parse_as_scanned_pdf` field must be false.
// Format:
// * `projects/{project_id}/locations/{location}/processors/{processor_id}`
// * `projects/{project_id}/locations/{location}/processors/{processor_id}/processorVersions/{processor_version_id}`
string processor_name = 1;

// The maximum number of requests the job is allowed to make to the Document
// AI processor per minute. Consult
// https://cloud.google.com/document-ai/quotas and the Quota page for your
// project to set an appropriate value here. If unspecified, a default value
// of 120 QPM would be used.
int32 max_parsing_requests_per_min = 2;
}

// The parser to use for RagFiles.
oneof parser {
// The Advanced Parser to use for RagFiles.
AdvancedParser advanced_parser = 3;

// The Layout Parser to use for RagFiles.
LayoutParser layout_parser = 4;
}

// Whether to use advanced PDF parsing.
bool use_advanced_pdf_parsing = 2;
bool use_advanced_pdf_parsing = 2 [deprecated = true];
}

// Config for uploading RagFile.
message UploadRagFileConfig {
// Specifies the size and overlap of chunks after uploading RagFile.
RagFileChunkingConfig rag_file_chunking_config = 1;
RagFileChunkingConfig rag_file_chunking_config = 1 [deprecated = true];

// Specifies the transformation config for RagFiles.
RagFileTransformationConfig rag_file_transformation_config = 3;
}

// Config for importing RagFiles.
Expand Down Expand Up @@ -397,24 +487,32 @@ message ImportRagFilesConfig {
}

// Optional. If provided, all partial failures are written to the sink.
// Deprecated. Prefer to use the `import_result_sink`.
oneof partial_failure_sink {
// The Cloud Storage path to write partial failures to.
GcsDestination partial_failure_gcs_sink = 11;
// Deprecated. Prefer to use `import_result_gcs_sink`.
GcsDestination partial_failure_gcs_sink = 11 [deprecated = true];

// The BigQuery destination to write partial failures to. It should be a
// bigquery table resource name (e.g.
// "bq://projectId.bqDatasetId.bqTableId"). If the dataset id does not
// exist, it will be created. If the table does not exist, it will be
// created with the expected schema. If the table exists, the schema will be
// validated and data will be added to this existing table.
BigQueryDestination partial_failure_bigquery_sink = 12;
// "bq://projectId.bqDatasetId.bqTableId"). The dataset must exist. If the
// table does not exist, it will be created with the expected schema. If the
// table exists, the schema will be validated and data will be added to this
// existing table.
// Deprecated. Prefer to use `import_result_bq_sink`.
BigQueryDestination partial_failure_bigquery_sink = 12 [deprecated = true];
}

// Specifies the size and overlap of chunks after importing RagFiles.
RagFileChunkingConfig rag_file_chunking_config = 4;
RagFileChunkingConfig rag_file_chunking_config = 4 [deprecated = true];

// Specifies the transformation config for RagFiles.
RagFileTransformationConfig rag_file_transformation_config = 16;

// Specifies the parsing config for RagFiles.
RagFileParsingConfig rag_file_parsing_config = 8;
// Optional. Specifies the parsing config for RagFiles.
// RAG will use the default parser if this field is not set.
RagFileParsingConfig rag_file_parsing_config = 8
[(google.api.field_behavior) = OPTIONAL];

// Optional. The max number of queries per minute that this job is allowed to
// make to the embedding model specified on the corpus. This value is specific
Expand Down
Loading

0 comments on commit 4fefaf1

Please sign in to comment.