Skip to content

Commit 43503be

Browse files
1 parent a51712e commit 43503be

3,021 files changed

Lines changed: 6245 additions & 2822055 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

google/cloud/aiplatform_v1/__init__.py

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -895,6 +895,11 @@
895895
from .types.publisher_model import PublisherModel
896896
from .types.reasoning_engine import ReasoningEngine
897897
from .types.reasoning_engine import ReasoningEngineSpec
898+
from .types.reasoning_engine_execution_service import (
899+
AsyncQueryReasoningEngineOperationMetadata,
900+
)
901+
from .types.reasoning_engine_execution_service import AsyncQueryReasoningEngineRequest
902+
from .types.reasoning_engine_execution_service import AsyncQueryReasoningEngineResponse
898903
from .types.reasoning_engine_execution_service import QueryReasoningEngineRequest
899904
from .types.reasoning_engine_execution_service import QueryReasoningEngineResponse
900905
from .types.reasoning_engine_execution_service import StreamQueryReasoningEngineRequest
@@ -1283,6 +1288,9 @@ def _get_version(dependency_name):
12831288
"AskContextsResponse",
12841289
"AssignNotebookRuntimeOperationMetadata",
12851290
"AssignNotebookRuntimeRequest",
1291+
"AsyncQueryReasoningEngineOperationMetadata",
1292+
"AsyncQueryReasoningEngineRequest",
1293+
"AsyncQueryReasoningEngineResponse",
12861294
"AsyncRetrieveContextsOperationMetadata",
12871295
"AsyncRetrieveContextsRequest",
12881296
"AsyncRetrieveContextsResponse",

google/cloud/aiplatform_v1/gapic_metadata.json

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4310,6 +4310,11 @@
43104310
"grpc": {
43114311
"libraryClient": "ReasoningEngineExecutionServiceClient",
43124312
"rpcs": {
4313+
"AsyncQueryReasoningEngine": {
4314+
"methods": [
4315+
"async_query_reasoning_engine"
4316+
]
4317+
},
43134318
"QueryReasoningEngine": {
43144319
"methods": [
43154320
"query_reasoning_engine"
@@ -4325,6 +4330,11 @@
43254330
"grpc-async": {
43264331
"libraryClient": "ReasoningEngineExecutionServiceAsyncClient",
43274332
"rpcs": {
4333+
"AsyncQueryReasoningEngine": {
4334+
"methods": [
4335+
"async_query_reasoning_engine"
4336+
]
4337+
},
43284338
"QueryReasoningEngine": {
43294339
"methods": [
43304340
"query_reasoning_engine"
@@ -4340,6 +4350,11 @@
43404350
"rest": {
43414351
"libraryClient": "ReasoningEngineExecutionServiceClient",
43424352
"rpcs": {
4353+
"AsyncQueryReasoningEngine": {
4354+
"methods": [
4355+
"async_query_reasoning_engine"
4356+
]
4357+
},
43434358
"QueryReasoningEngine": {
43444359
"methods": [
43454360
"query_reasoning_engine"

google/cloud/aiplatform_v1/services/reasoning_engine_execution_service/async_client.py

Lines changed: 113 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -53,6 +53,8 @@
5353
from google.iam.v1 import policy_pb2 # type: ignore
5454
from google.longrunning import operations_pb2 # type: ignore
5555
import google.api.httpbody_pb2 as httpbody_pb2 # type: ignore
56+
import google.api_core.operation as operation # type: ignore
57+
import google.api_core.operation_async as operation_async # type: ignore
5658
import google.protobuf.any_pb2 as any_pb2 # type: ignore
5759
import google.protobuf.struct_pb2 as struct_pb2 # type: ignore
5860
from .transports.base import (
@@ -561,6 +563,117 @@ async def sample_stream_query_reasoning_engine():
561563
# Done; return the response.
562564
return response
563565

566+
async def async_query_reasoning_engine(
567+
self,
568+
request: Optional[
569+
Union[
570+
reasoning_engine_execution_service.AsyncQueryReasoningEngineRequest,
571+
dict,
572+
]
573+
] = None,
574+
*,
575+
retry: OptionalRetry = gapic_v1.method.DEFAULT,
576+
timeout: Union[float, object] = gapic_v1.method.DEFAULT,
577+
metadata: Sequence[Tuple[str, Union[str, bytes]]] = (),
578+
) -> operation_async.AsyncOperation:
579+
r"""Async query using a reasoning engine.
580+
581+
.. code-block:: python
582+
583+
# This snippet has been automatically generated and should be regarded as a
584+
# code template only.
585+
# It will require modifications to work:
586+
# - It may require correct/in-range values for request initialization.
587+
# - It may require specifying regional endpoints when creating the service
588+
# client as shown in:
589+
# https://googleapis.dev/python/google-api-core/latest/client_options.html
590+
from google.cloud import aiplatform_v1
591+
592+
async def sample_async_query_reasoning_engine():
593+
# Create a client
594+
client = aiplatform_v1.ReasoningEngineExecutionServiceAsyncClient()
595+
596+
# Initialize request argument(s)
597+
request = aiplatform_v1.AsyncQueryReasoningEngineRequest(
598+
name="name_value",
599+
)
600+
601+
# Make the request
602+
operation = client.async_query_reasoning_engine(request=request)
603+
604+
print("Waiting for operation to complete...")
605+
606+
response = (await operation).result()
607+
608+
# Handle the response
609+
print(response)
610+
611+
Args:
612+
request (Optional[Union[google.cloud.aiplatform_v1.types.AsyncQueryReasoningEngineRequest, dict]]):
613+
The request object. Request message for
614+
[ReasoningEngineExecutionService.AsyncQueryReasoningEngine][google.cloud.aiplatform.v1.ReasoningEngineExecutionService.AsyncQueryReasoningEngine].
615+
retry (google.api_core.retry_async.AsyncRetry): Designation of what errors, if any,
616+
should be retried.
617+
timeout (float): The timeout for this request.
618+
metadata (Sequence[Tuple[str, Union[str, bytes]]]): Key/value pairs which should be
619+
sent along with the request as metadata. Normally, each value must be of type `str`,
620+
but for metadata keys ending with the suffix `-bin`, the corresponding values must
621+
be of type `bytes`.
622+
623+
Returns:
624+
google.api_core.operation_async.AsyncOperation:
625+
An object representing a long-running operation.
626+
627+
The result type for the operation will be :class:`google.cloud.aiplatform_v1.types.AsyncQueryReasoningEngineResponse` Response message for
628+
[ReasoningEngineExecutionService.AsyncQueryReasoningEngine][google.cloud.aiplatform.v1.ReasoningEngineExecutionService.AsyncQueryReasoningEngine].
629+
630+
"""
631+
# Create or coerce a protobuf request object.
632+
# - Use the request object if provided (there's no risk of modifying the input as
633+
# there are no flattened fields), or create one.
634+
if not isinstance(
635+
request, reasoning_engine_execution_service.AsyncQueryReasoningEngineRequest
636+
):
637+
request = (
638+
reasoning_engine_execution_service.AsyncQueryReasoningEngineRequest(
639+
request
640+
)
641+
)
642+
643+
# Wrap the RPC method; this adds retry and timeout information,
644+
# and friendly error handling.
645+
rpc = self._client._transport._wrapped_methods[
646+
self._client._transport.async_query_reasoning_engine
647+
]
648+
649+
# Certain fields should be provided within the metadata header;
650+
# add these here.
651+
metadata = tuple(metadata) + (
652+
gapic_v1.routing_header.to_grpc_metadata((("name", request.name),)),
653+
)
654+
655+
# Validate the universe domain.
656+
self._client._validate_universe_domain()
657+
658+
# Send the request.
659+
response = await rpc(
660+
request,
661+
retry=retry,
662+
timeout=timeout,
663+
metadata=metadata,
664+
)
665+
666+
# Wrap the response in an operation future.
667+
response = operation_async.from_gapic(
668+
response,
669+
self._client._transport.operations_client,
670+
reasoning_engine_execution_service.AsyncQueryReasoningEngineResponse,
671+
metadata_type=reasoning_engine_execution_service.AsyncQueryReasoningEngineOperationMetadata,
672+
)
673+
674+
# Done; return the response.
675+
return response
676+
564677
async def list_operations(
565678
self,
566679
request: Optional[operations_pb2.ListOperationsRequest] = None,

google/cloud/aiplatform_v1/services/reasoning_engine_execution_service/client.py

Lines changed: 113 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -68,6 +68,8 @@
6868
from google.iam.v1 import policy_pb2 # type: ignore
6969
from google.longrunning import operations_pb2 # type: ignore
7070
import google.api.httpbody_pb2 as httpbody_pb2 # type: ignore
71+
import google.api_core.operation as operation # type: ignore
72+
import google.api_core.operation_async as operation_async # type: ignore
7173
import google.protobuf.any_pb2 as any_pb2 # type: ignore
7274
import google.protobuf.struct_pb2 as struct_pb2 # type: ignore
7375
from .transports.base import (
@@ -1038,6 +1040,117 @@ def sample_stream_query_reasoning_engine():
10381040
# Done; return the response.
10391041
return response
10401042

1043+
def async_query_reasoning_engine(
1044+
self,
1045+
request: Optional[
1046+
Union[
1047+
reasoning_engine_execution_service.AsyncQueryReasoningEngineRequest,
1048+
dict,
1049+
]
1050+
] = None,
1051+
*,
1052+
retry: OptionalRetry = gapic_v1.method.DEFAULT,
1053+
timeout: Union[float, object] = gapic_v1.method.DEFAULT,
1054+
metadata: Sequence[Tuple[str, Union[str, bytes]]] = (),
1055+
) -> operation.Operation:
1056+
r"""Async query using a reasoning engine.
1057+
1058+
.. code-block:: python
1059+
1060+
# This snippet has been automatically generated and should be regarded as a
1061+
# code template only.
1062+
# It will require modifications to work:
1063+
# - It may require correct/in-range values for request initialization.
1064+
# - It may require specifying regional endpoints when creating the service
1065+
# client as shown in:
1066+
# https://googleapis.dev/python/google-api-core/latest/client_options.html
1067+
from google.cloud import aiplatform_v1
1068+
1069+
def sample_async_query_reasoning_engine():
1070+
# Create a client
1071+
client = aiplatform_v1.ReasoningEngineExecutionServiceClient()
1072+
1073+
# Initialize request argument(s)
1074+
request = aiplatform_v1.AsyncQueryReasoningEngineRequest(
1075+
name="name_value",
1076+
)
1077+
1078+
# Make the request
1079+
operation = client.async_query_reasoning_engine(request=request)
1080+
1081+
print("Waiting for operation to complete...")
1082+
1083+
response = operation.result()
1084+
1085+
# Handle the response
1086+
print(response)
1087+
1088+
Args:
1089+
request (Union[google.cloud.aiplatform_v1.types.AsyncQueryReasoningEngineRequest, dict]):
1090+
The request object. Request message for
1091+
[ReasoningEngineExecutionService.AsyncQueryReasoningEngine][google.cloud.aiplatform.v1.ReasoningEngineExecutionService.AsyncQueryReasoningEngine].
1092+
retry (google.api_core.retry.Retry): Designation of what errors, if any,
1093+
should be retried.
1094+
timeout (float): The timeout for this request.
1095+
metadata (Sequence[Tuple[str, Union[str, bytes]]]): Key/value pairs which should be
1096+
sent along with the request as metadata. Normally, each value must be of type `str`,
1097+
but for metadata keys ending with the suffix `-bin`, the corresponding values must
1098+
be of type `bytes`.
1099+
1100+
Returns:
1101+
google.api_core.operation.Operation:
1102+
An object representing a long-running operation.
1103+
1104+
The result type for the operation will be :class:`google.cloud.aiplatform_v1.types.AsyncQueryReasoningEngineResponse` Response message for
1105+
[ReasoningEngineExecutionService.AsyncQueryReasoningEngine][google.cloud.aiplatform.v1.ReasoningEngineExecutionService.AsyncQueryReasoningEngine].
1106+
1107+
"""
1108+
# Create or coerce a protobuf request object.
1109+
# - Use the request object if provided (there's no risk of modifying the input as
1110+
# there are no flattened fields), or create one.
1111+
if not isinstance(
1112+
request, reasoning_engine_execution_service.AsyncQueryReasoningEngineRequest
1113+
):
1114+
request = (
1115+
reasoning_engine_execution_service.AsyncQueryReasoningEngineRequest(
1116+
request
1117+
)
1118+
)
1119+
1120+
# Wrap the RPC method; this adds retry and timeout information,
1121+
# and friendly error handling.
1122+
rpc = self._transport._wrapped_methods[
1123+
self._transport.async_query_reasoning_engine
1124+
]
1125+
1126+
# Certain fields should be provided within the metadata header;
1127+
# add these here.
1128+
metadata = tuple(metadata) + (
1129+
gapic_v1.routing_header.to_grpc_metadata((("name", request.name),)),
1130+
)
1131+
1132+
# Validate the universe domain.
1133+
self._validate_universe_domain()
1134+
1135+
# Send the request.
1136+
response = rpc(
1137+
request,
1138+
retry=retry,
1139+
timeout=timeout,
1140+
metadata=metadata,
1141+
)
1142+
1143+
# Wrap the response in an operation future.
1144+
response = operation.from_gapic(
1145+
response,
1146+
self._transport.operations_client,
1147+
reasoning_engine_execution_service.AsyncQueryReasoningEngineResponse,
1148+
metadata_type=reasoning_engine_execution_service.AsyncQueryReasoningEngineOperationMetadata,
1149+
)
1150+
1151+
# Done; return the response.
1152+
return response
1153+
10411154
def __enter__(self) -> "ReasoningEngineExecutionServiceClient":
10421155
return self
10431156

google/cloud/aiplatform_v1/services/reasoning_engine_execution_service/transports/base.py

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,7 @@
2323
from google.api_core import exceptions as core_exceptions
2424
from google.api_core import gapic_v1
2525
from google.api_core import retry as retries
26+
from google.api_core import operations_v1
2627
from google.auth import credentials as ga_credentials # type: ignore
2728
from google.oauth2 import service_account # type: ignore
2829
import google.protobuf
@@ -152,6 +153,11 @@ def _prep_wrapped_messages(self, client_info):
152153
default_timeout=None,
153154
client_info=client_info,
154155
),
156+
self.async_query_reasoning_engine: gapic_v1.method.wrap_method(
157+
self.async_query_reasoning_engine,
158+
default_timeout=None,
159+
client_info=client_info,
160+
),
155161
self.get_location: gapic_v1.method.wrap_method(
156162
self.get_location,
157163
default_timeout=None,
@@ -213,6 +219,11 @@ def close(self):
213219
"""
214220
raise NotImplementedError()
215221

222+
@property
223+
def operations_client(self):
224+
"""Return the client designed to process long-running operations."""
225+
raise NotImplementedError()
226+
216227
@property
217228
def query_reasoning_engine(
218229
self,
@@ -234,6 +245,15 @@ def stream_query_reasoning_engine(
234245
]:
235246
raise NotImplementedError()
236247

248+
@property
249+
def async_query_reasoning_engine(
250+
self,
251+
) -> Callable[
252+
[reasoning_engine_execution_service.AsyncQueryReasoningEngineRequest],
253+
Union[operations_pb2.Operation, Awaitable[operations_pb2.Operation]],
254+
]:
255+
raise NotImplementedError()
256+
237257
@property
238258
def list_operations(
239259
self,

0 commit comments

Comments
 (0)