Skip to content

Commit 787c60f

Browse files
gcf-owl-bot[bot]copybara-github
authored andcommitted
Copybara import of the project:
-- 332e36a by Owl Bot <gcf-owl-bot[bot]@users.noreply.github.com>: feat: Introduce RAG as context/memory store for Gemini Live API docs: A comment for message `RagFileParsingConfig` is updated. docs: A comment for field `global_max_embedding_requests_per_min` in message `.google.cloud.aiplatform.v1beta1.ImportRagFilesConfig` is updated. PiperOrigin-RevId: 763909021 Source-Link: googleapis/googleapis@07ab54b Source-Link: googleapis/googleapis-gen@9889798 Copy-Tag: eyJwIjoiLmdpdGh1Yi8uT3dsQm90LnlhbWwiLCJoIjoiOTg4OTc5ODA0YjlkYWNiZmVjZTBlZTlhMzVhYWYxMWFjZmNlYzRlZiJ9 -- 1964ffa by Owl Bot <gcf-owl-bot[bot]@users.noreply.github.com>: 🦉 Updates from OwlBot post-processor See https://github.com/googleapis/repo-automation-bots/blob/main/packages/owl-bot/README.md COPYBARA_INTEGRATE_REVIEW=#5358 from googleapis:owl-bot-copy 2fbaf84 PiperOrigin-RevId: 764458457
1 parent 208e500 commit 787c60f

23 files changed

+2264
-85
lines changed

google/cloud/aiplatform_v1beta1/__init__.py

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -646,6 +646,8 @@
646646
from .types.index_service import CreateIndexRequest
647647
from .types.index_service import DeleteIndexRequest
648648
from .types.index_service import GetIndexRequest
649+
from .types.index_service import ImportIndexOperationMetadata
650+
from .types.index_service import ImportIndexRequest
649651
from .types.index_service import ListIndexesRequest
650652
from .types.index_service import ListIndexesResponse
651653
from .types.index_service import NearestNeighborSearchOperationMetadata
@@ -1794,6 +1796,8 @@
17941796
"ImportFeatureValuesOperationMetadata",
17951797
"ImportFeatureValuesRequest",
17961798
"ImportFeatureValuesResponse",
1799+
"ImportIndexOperationMetadata",
1800+
"ImportIndexRequest",
17971801
"ImportModelEvaluationRequest",
17981802
"ImportRagFilesConfig",
17991803
"ImportRagFilesOperationMetadata",

google/cloud/aiplatform_v1beta1/gapic_metadata.json

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2320,6 +2320,11 @@
23202320
"get_index"
23212321
]
23222322
},
2323+
"ImportIndex": {
2324+
"methods": [
2325+
"import_index"
2326+
]
2327+
},
23232328
"ListIndexes": {
23242329
"methods": [
23252330
"list_indexes"
@@ -2360,6 +2365,11 @@
23602365
"get_index"
23612366
]
23622367
},
2368+
"ImportIndex": {
2369+
"methods": [
2370+
"import_index"
2371+
]
2372+
},
23632373
"ListIndexes": {
23642374
"methods": [
23652375
"list_indexes"
@@ -2400,6 +2410,11 @@
24002410
"get_index"
24012411
]
24022412
},
2413+
"ImportIndex": {
2414+
"methods": [
2415+
"import_index"
2416+
]
2417+
},
24032418
"ListIndexes": {
24042419
"methods": [
24052420
"list_indexes"

google/cloud/aiplatform_v1beta1/services/index_service/async_client.py

Lines changed: 108 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -556,6 +556,114 @@ async def sample_get_index():
556556
# Done; return the response.
557557
return response
558558

559+
async def import_index(
560+
self,
561+
request: Optional[Union[index_service.ImportIndexRequest, dict]] = None,
562+
*,
563+
retry: OptionalRetry = gapic_v1.method.DEFAULT,
564+
timeout: Union[float, object] = gapic_v1.method.DEFAULT,
565+
metadata: Sequence[Tuple[str, Union[str, bytes]]] = (),
566+
) -> operation_async.AsyncOperation:
567+
r"""Imports an Index from an external source (e.g.,
568+
BigQuery).
569+
570+
.. code-block:: python
571+
572+
# This snippet has been automatically generated and should be regarded as a
573+
# code template only.
574+
# It will require modifications to work:
575+
# - It may require correct/in-range values for request initialization.
576+
# - It may require specifying regional endpoints when creating the service
577+
# client as shown in:
578+
# https://googleapis.dev/python/google-api-core/latest/client_options.html
579+
from google.cloud import aiplatform_v1beta1
580+
581+
async def sample_import_index():
582+
# Create a client
583+
client = aiplatform_v1beta1.IndexServiceAsyncClient()
584+
585+
# Initialize request argument(s)
586+
config = aiplatform_v1beta1.ConnectorConfig()
587+
config.big_query_source_config.table_path = "table_path_value"
588+
config.big_query_source_config.datapoint_field_mapping.id_column = "id_column_value"
589+
config.big_query_source_config.datapoint_field_mapping.embedding_column = "embedding_column_value"
590+
591+
request = aiplatform_v1beta1.ImportIndexRequest(
592+
name="name_value",
593+
config=config,
594+
)
595+
596+
# Make the request
597+
operation = client.import_index(request=request)
598+
599+
print("Waiting for operation to complete...")
600+
601+
response = (await operation).result()
602+
603+
# Handle the response
604+
print(response)
605+
606+
Args:
607+
request (Optional[Union[google.cloud.aiplatform_v1beta1.types.ImportIndexRequest, dict]]):
608+
The request object. Request message for
609+
[IndexService.ImportIndex][google.cloud.aiplatform.v1beta1.IndexService.ImportIndex].
610+
retry (google.api_core.retry_async.AsyncRetry): Designation of what errors, if any,
611+
should be retried.
612+
timeout (float): The timeout for this request.
613+
metadata (Sequence[Tuple[str, Union[str, bytes]]]): Key/value pairs which should be
614+
sent along with the request as metadata. Normally, each value must be of type `str`,
615+
but for metadata keys ending with the suffix `-bin`, the corresponding values must
616+
be of type `bytes`.
617+
618+
Returns:
619+
google.api_core.operation_async.AsyncOperation:
620+
An object representing a long-running operation.
621+
622+
The result type for the operation will be :class:`google.cloud.aiplatform_v1beta1.types.Index` A representation of a collection of database items organized in a way that
623+
allows for approximate nearest neighbor (a.k.a ANN)
624+
algorithms search.
625+
626+
"""
627+
# Create or coerce a protobuf request object.
628+
# - Use the request object if provided (there's no risk of modifying the input as
629+
# there are no flattened fields), or create one.
630+
if not isinstance(request, index_service.ImportIndexRequest):
631+
request = index_service.ImportIndexRequest(request)
632+
633+
# Wrap the RPC method; this adds retry and timeout information,
634+
# and friendly error handling.
635+
rpc = self._client._transport._wrapped_methods[
636+
self._client._transport.import_index
637+
]
638+
639+
# Certain fields should be provided within the metadata header;
640+
# add these here.
641+
metadata = tuple(metadata) + (
642+
gapic_v1.routing_header.to_grpc_metadata((("name", request.name),)),
643+
)
644+
645+
# Validate the universe domain.
646+
self._client._validate_universe_domain()
647+
648+
# Send the request.
649+
response = await rpc(
650+
request,
651+
retry=retry,
652+
timeout=timeout,
653+
metadata=metadata,
654+
)
655+
656+
# Wrap the response in an operation future.
657+
response = operation_async.from_gapic(
658+
response,
659+
self._client._transport.operations_client,
660+
index.Index,
661+
metadata_type=index_service.ImportIndexOperationMetadata,
662+
)
663+
664+
# Done; return the response.
665+
return response
666+
559667
async def list_indexes(
560668
self,
561669
request: Optional[Union[index_service.ListIndexesRequest, dict]] = None,

google/cloud/aiplatform_v1beta1/services/index_service/client.py

Lines changed: 106 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1028,6 +1028,112 @@ def sample_get_index():
10281028
# Done; return the response.
10291029
return response
10301030

1031+
def import_index(
1032+
self,
1033+
request: Optional[Union[index_service.ImportIndexRequest, dict]] = None,
1034+
*,
1035+
retry: OptionalRetry = gapic_v1.method.DEFAULT,
1036+
timeout: Union[float, object] = gapic_v1.method.DEFAULT,
1037+
metadata: Sequence[Tuple[str, Union[str, bytes]]] = (),
1038+
) -> gac_operation.Operation:
1039+
r"""Imports an Index from an external source (e.g.,
1040+
BigQuery).
1041+
1042+
.. code-block:: python
1043+
1044+
# This snippet has been automatically generated and should be regarded as a
1045+
# code template only.
1046+
# It will require modifications to work:
1047+
# - It may require correct/in-range values for request initialization.
1048+
# - It may require specifying regional endpoints when creating the service
1049+
# client as shown in:
1050+
# https://googleapis.dev/python/google-api-core/latest/client_options.html
1051+
from google.cloud import aiplatform_v1beta1
1052+
1053+
def sample_import_index():
1054+
# Create a client
1055+
client = aiplatform_v1beta1.IndexServiceClient()
1056+
1057+
# Initialize request argument(s)
1058+
config = aiplatform_v1beta1.ConnectorConfig()
1059+
config.big_query_source_config.table_path = "table_path_value"
1060+
config.big_query_source_config.datapoint_field_mapping.id_column = "id_column_value"
1061+
config.big_query_source_config.datapoint_field_mapping.embedding_column = "embedding_column_value"
1062+
1063+
request = aiplatform_v1beta1.ImportIndexRequest(
1064+
name="name_value",
1065+
config=config,
1066+
)
1067+
1068+
# Make the request
1069+
operation = client.import_index(request=request)
1070+
1071+
print("Waiting for operation to complete...")
1072+
1073+
response = operation.result()
1074+
1075+
# Handle the response
1076+
print(response)
1077+
1078+
Args:
1079+
request (Union[google.cloud.aiplatform_v1beta1.types.ImportIndexRequest, dict]):
1080+
The request object. Request message for
1081+
[IndexService.ImportIndex][google.cloud.aiplatform.v1beta1.IndexService.ImportIndex].
1082+
retry (google.api_core.retry.Retry): Designation of what errors, if any,
1083+
should be retried.
1084+
timeout (float): The timeout for this request.
1085+
metadata (Sequence[Tuple[str, Union[str, bytes]]]): Key/value pairs which should be
1086+
sent along with the request as metadata. Normally, each value must be of type `str`,
1087+
but for metadata keys ending with the suffix `-bin`, the corresponding values must
1088+
be of type `bytes`.
1089+
1090+
Returns:
1091+
google.api_core.operation.Operation:
1092+
An object representing a long-running operation.
1093+
1094+
The result type for the operation will be :class:`google.cloud.aiplatform_v1beta1.types.Index` A representation of a collection of database items organized in a way that
1095+
allows for approximate nearest neighbor (a.k.a ANN)
1096+
algorithms search.
1097+
1098+
"""
1099+
# Create or coerce a protobuf request object.
1100+
# - Use the request object if provided (there's no risk of modifying the input as
1101+
# there are no flattened fields), or create one.
1102+
if not isinstance(request, index_service.ImportIndexRequest):
1103+
request = index_service.ImportIndexRequest(request)
1104+
1105+
# Wrap the RPC method; this adds retry and timeout information,
1106+
# and friendly error handling.
1107+
rpc = self._transport._wrapped_methods[self._transport.import_index]
1108+
1109+
# Certain fields should be provided within the metadata header;
1110+
# add these here.
1111+
metadata = tuple(metadata) + (
1112+
gapic_v1.routing_header.to_grpc_metadata((("name", request.name),)),
1113+
)
1114+
1115+
# Validate the universe domain.
1116+
self._validate_universe_domain()
1117+
1118+
# Send the request.
1119+
response = rpc(
1120+
request,
1121+
retry=retry,
1122+
timeout=timeout,
1123+
metadata=metadata,
1124+
)
1125+
1126+
# Wrap the response in an operation future.
1127+
response = gac_operation.from_gapic(
1128+
response,
1129+
self._transport.operations_client,
1130+
index.Index,
1131+
metadata_type=index_service.ImportIndexOperationMetadata,
1132+
)
1133+
1134+
# Done; return the response.
1135+
return response
1136+
10311137
def list_indexes(
10321138
self,
10331139
request: Optional[Union[index_service.ListIndexesRequest, dict]] = None,

google/cloud/aiplatform_v1beta1/services/index_service/transports/base.py

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -149,6 +149,11 @@ def _prep_wrapped_messages(self, client_info):
149149
default_timeout=5.0,
150150
client_info=client_info,
151151
),
152+
self.import_index: gapic_v1.method.wrap_method(
153+
self.import_index,
154+
default_timeout=None,
155+
client_info=client_info,
156+
),
152157
self.list_indexes: gapic_v1.method.wrap_method(
153158
self.list_indexes,
154159
default_timeout=5.0,
@@ -257,6 +262,15 @@ def get_index(
257262
]:
258263
raise NotImplementedError()
259264

265+
@property
266+
def import_index(
267+
self,
268+
) -> Callable[
269+
[index_service.ImportIndexRequest],
270+
Union[operations_pb2.Operation, Awaitable[operations_pb2.Operation]],
271+
]:
272+
raise NotImplementedError()
273+
260274
@property
261275
def list_indexes(
262276
self,

google/cloud/aiplatform_v1beta1/services/index_service/transports/grpc.py

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -394,6 +394,33 @@ def get_index(self) -> Callable[[index_service.GetIndexRequest], index.Index]:
394394
)
395395
return self._stubs["get_index"]
396396

397+
@property
398+
def import_index(
399+
self,
400+
) -> Callable[[index_service.ImportIndexRequest], operations_pb2.Operation]:
401+
r"""Return a callable for the import index method over gRPC.
402+
403+
Imports an Index from an external source (e.g.,
404+
BigQuery).
405+
406+
Returns:
407+
Callable[[~.ImportIndexRequest],
408+
~.Operation]:
409+
A function that, when called, will call the underlying RPC
410+
on the server.
411+
"""
412+
# Generate a "stub function" on-the-fly which will actually make
413+
# the request.
414+
# gRPC handles serialization and deserialization, so we just need
415+
# to pass in the functions for each.
416+
if "import_index" not in self._stubs:
417+
self._stubs["import_index"] = self._logged_channel.unary_unary(
418+
"/google.cloud.aiplatform.v1beta1.IndexService/ImportIndex",
419+
request_serializer=index_service.ImportIndexRequest.serialize,
420+
response_deserializer=operations_pb2.Operation.FromString,
421+
)
422+
return self._stubs["import_index"]
423+
397424
@property
398425
def list_indexes(
399426
self,

google/cloud/aiplatform_v1beta1/services/index_service/transports/grpc_asyncio.py

Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -406,6 +406,35 @@ def get_index(
406406
)
407407
return self._stubs["get_index"]
408408

409+
@property
410+
def import_index(
411+
self,
412+
) -> Callable[
413+
[index_service.ImportIndexRequest], Awaitable[operations_pb2.Operation]
414+
]:
415+
r"""Return a callable for the import index method over gRPC.
416+
417+
Imports an Index from an external source (e.g.,
418+
BigQuery).
419+
420+
Returns:
421+
Callable[[~.ImportIndexRequest],
422+
Awaitable[~.Operation]]:
423+
A function that, when called, will call the underlying RPC
424+
on the server.
425+
"""
426+
# Generate a "stub function" on-the-fly which will actually make
427+
# the request.
428+
# gRPC handles serialization and deserialization, so we just need
429+
# to pass in the functions for each.
430+
if "import_index" not in self._stubs:
431+
self._stubs["import_index"] = self._logged_channel.unary_unary(
432+
"/google.cloud.aiplatform.v1beta1.IndexService/ImportIndex",
433+
request_serializer=index_service.ImportIndexRequest.serialize,
434+
response_deserializer=operations_pb2.Operation.FromString,
435+
)
436+
return self._stubs["import_index"]
437+
409438
@property
410439
def list_indexes(
411440
self,
@@ -563,6 +592,11 @@ def _prep_wrapped_messages(self, client_info):
563592
default_timeout=5.0,
564593
client_info=client_info,
565594
),
595+
self.import_index: self._wrap_method(
596+
self.import_index,
597+
default_timeout=None,
598+
client_info=client_info,
599+
),
566600
self.list_indexes: self._wrap_method(
567601
self.list_indexes,
568602
default_timeout=5.0,

0 commit comments

Comments
 (0)