Skip to content

Commit dfe6d6c

Browse files
vertex-sdk-botcopybara-github
authored andcommitted
feat: Refactor rag_store and rag_retrieval to use v1 protos
PiperOrigin-RevId: 700410303
1 parent 6d43ad3 commit dfe6d6c

File tree

12 files changed

+399
-311
lines changed

12 files changed

+399
-311
lines changed

google/cloud/aiplatform/compat/services/__init__.py

+12
Original file line numberDiff line numberDiff line change
@@ -179,6 +179,15 @@
179179
from google.cloud.aiplatform_v1.services.vizier_service import (
180180
client as vizier_service_client_v1,
181181
)
182+
from google.cloud.aiplatform_v1.services.vertex_rag_service import (
183+
client as vertex_rag_service_client_v1,
184+
)
185+
from google.cloud.aiplatform_v1.services.vertex_rag_data_service import (
186+
client as vertex_rag_data_service_client_v1,
187+
)
188+
from google.cloud.aiplatform_v1.services.vertex_rag_data_service import (
189+
async_client as vertex_rag_data_service_async_client_v1,
190+
)
182191

183192
__all__ = (
184193
# v1
@@ -204,6 +213,9 @@
204213
specialist_pool_service_client_v1,
205214
tensorboard_service_client_v1,
206215
vizier_service_client_v1,
216+
vertex_rag_data_service_async_client_v1,
217+
vertex_rag_data_service_client_v1,
218+
vertex_rag_service_client_v1,
207219
# v1beta1
208220
dataset_service_client_v1beta1,
209221
deployment_resource_pool_service_client_v1beta1,

google/cloud/aiplatform/utils/__init__.py

+14-7
Original file line numberDiff line numberDiff line change
@@ -90,6 +90,9 @@
9090
tensorboard_service_client_v1,
9191
vizier_service_client_v1,
9292
persistent_resource_service_client_v1,
93+
vertex_rag_data_service_async_client_v1,
94+
vertex_rag_data_service_client_v1,
95+
vertex_rag_service_client_v1,
9396
)
9497

9598
from google.cloud.aiplatform.compat.types import (
@@ -138,6 +141,7 @@
138141
schedule_service_client_v1.ScheduleServiceClient,
139142
tensorboard_service_client_v1.TensorboardServiceClient,
140143
vizier_service_client_v1.VizierServiceClient,
144+
vertex_rag_service_client_v1.VertexRagServiceClient,
141145
)
142146

143147

@@ -967,8 +971,9 @@ class ReasoningEngineExecutionClientWithOverride(ClientWithOverride):
967971

968972
class VertexRagDataClientWithOverride(ClientWithOverride):
969973
_is_temporary = True
970-
_default_version = compat.V1BETA1
974+
_default_version = compat.DEFAULT_VERSION
971975
_version_map = (
976+
(compat.V1, vertex_rag_data_service_client_v1.VertexRagDataServiceClient),
972977
(
973978
compat.V1BETA1,
974979
vertex_rag_data_service_client_v1beta1.VertexRagDataServiceClient,
@@ -978,8 +983,12 @@ class VertexRagDataClientWithOverride(ClientWithOverride):
978983

979984
class VertexRagDataAsyncClientWithOverride(ClientWithOverride):
980985
_is_temporary = True
981-
_default_version = compat.V1BETA1
986+
_default_version = compat.DEFAULT_VERSION
982987
_version_map = (
988+
(
989+
compat.V1,
990+
vertex_rag_data_service_async_client_v1.VertexRagDataServiceAsyncClient,
991+
),
983992
(
984993
compat.V1BETA1,
985994
vertex_rag_data_service_async_client_v1beta1.VertexRagDataServiceAsyncClient,
@@ -989,12 +998,10 @@ class VertexRagDataAsyncClientWithOverride(ClientWithOverride):
989998

990999
class VertexRagClientWithOverride(ClientWithOverride):
9911000
_is_temporary = True
992-
_default_version = compat.V1BETA1
1001+
_default_version = compat.DEFAULT_VERSION
9931002
_version_map = (
994-
(
995-
compat.V1BETA1,
996-
vertex_rag_service_client_v1beta1.VertexRagServiceClient,
997-
),
1003+
(compat.V1, vertex_rag_service_client_v1.VertexRagServiceClient),
1004+
(compat.V1BETA1, vertex_rag_service_client_v1beta1.VertexRagServiceClient),
9981005
)
9991006

10001007

tests/unit/vertex_rag/test_rag_constants.py

+11-2
Original file line numberDiff line numberDiff line change
@@ -18,12 +18,14 @@
1818

1919
from google.cloud import aiplatform
2020

21-
from vertexai.preview.rag import (
21+
from vertexai.rag import (
2222
EmbeddingModelConfig,
23+
Filter,
2324
Pinecone,
2425
RagCorpus,
2526
RagFile,
2627
RagResource,
28+
RagRetrievalConfig,
2729
SharePointSource,
2830
SharePointSources,
2931
SlackChannelsSource,
@@ -34,6 +36,7 @@
3436
VertexVectorSearch,
3537
VertexFeatureStore,
3638
)
39+
3740
from google.cloud.aiplatform_v1beta1 import (
3841
GoogleDriveSource,
3942
RagFileChunkingConfig,
@@ -46,9 +49,11 @@
4649
RagFile as GapicRagFile,
4750
SharePointSources as GapicSharePointSources,
4851
SlackSource as GapicSlackSource,
52+
RagVectorDbConfig,
53+
)
54+
from google.cloud.aiplatform_v1 import (
4955
RagContexts,
5056
RetrieveContextsResponse,
51-
RagVectorDbConfig,
5257
)
5358
from google.cloud.aiplatform_v1beta1.types import api_auth
5459
from google.protobuf import timestamp_pb2
@@ -529,3 +534,7 @@
529534
rag_corpus="213lkj-1/23jkl/",
530535
rag_file_ids=[TEST_RAG_FILE_ID],
531536
)
537+
TEST_RAG_RETRIEVAL_CONFIG = RagRetrievalConfig(
538+
top_k=2,
539+
filter=Filter(vector_distance_threshold=0.5),
540+
)

0 commit comments

Comments
 (0)