| |
- google.cloud.aiplatform_v1.services.prediction_service.transports.rest.PredictionServiceRestInterceptor(builtins.object)
-
- GenAIHubPredictionServiceRestInterceptor
- google.cloud.aiplatform_v1.services.prediction_service.transports.rest_asyncio.AsyncPredictionServiceRestInterceptor(builtins.object)
-
- GenAIHubAsyncPredictionServiceRestInterceptor
- vertexai.generative_models.GenerativeModel(vertexai.generative_models._generative_models._GenerativeModel)
-
- GenerativeModel
class GenAIHubAsyncPredictionServiceRestInterceptor(google.cloud.aiplatform_v1.services.prediction_service.transports.rest_asyncio.AsyncPredictionServiceRestInterceptor) |
|
GenAIHubAsyncPredictionServiceRestInterceptor(*args, aicore_proxy_client: gen_ai_hub.proxy.core.base.BaseProxyClient, credentials_reference: google.auth.aio.credentials.Credentials, **kwargs) -> None
Interceptor class compatible with
google.cloud.aiplatform_v1.services.prediction_service.transports.AsyncPredictionServiceRestInterceptor |
|
- Method resolution order:
- GenAIHubAsyncPredictionServiceRestInterceptor
- google.cloud.aiplatform_v1.services.prediction_service.transports.rest_asyncio.AsyncPredictionServiceRestInterceptor
- builtins.object
Methods defined here:
- __init__(self, *args, aicore_proxy_client: gen_ai_hub.proxy.core.base.BaseProxyClient, credentials_reference: google.auth.aio.credentials.Credentials, **kwargs) -> None
- Initialize self. See help(type(self)) for accurate signature.
- async post_stream_generate_content(self, response: google.api_core.rest_streaming_async.AsyncResponseIterator) -> google.api_core.rest_streaming_async.AsyncResponseIterator
- Post-rpc interceptor for stream_generate_content
DEPRECATED. Please use the `post_stream_generate_content_with_metadata`
interceptor instead.
Override in a subclass to read or manipulate the response
after it is returned by the PredictionService server but before
it is returned to user code. This `post_stream_generate_content` interceptor runs
before the `post_stream_generate_content_with_metadata` interceptor.
- async pre_generate_content(self, request: google.cloud.aiplatform_v1.types.prediction_service.GenerateContentRequest, metadata: Sequence[Tuple[str, str]]) -> Tuple[google.cloud.aiplatform_v1.types.prediction_service.GenerateContentRequest, Sequence[Tuple[str, str]]]
- Pre-rpc interceptor for generate_content
Override in a subclass to manipulate the request or metadata
before they are sent to the PredictionService server.
- async pre_stream_generate_content(self, request: google.cloud.aiplatform_v1.types.prediction_service.GenerateContentRequest, metadata: Sequence[Tuple[str, Union[str, bytes]]]) -> Tuple[google.cloud.aiplatform_v1.types.prediction_service.GenerateContentRequest, Sequence[Tuple[str, Union[str, bytes]]]]
- Pre-rpc interceptor for stream_generate_content
Override in a subclass to manipulate the request or metadata
before they are sent to the PredictionService server.
Methods inherited from google.cloud.aiplatform_v1.services.prediction_service.transports.rest_asyncio.AsyncPredictionServiceRestInterceptor:
- async post_cancel_operation(self, response: None) -> None
- Post-rpc interceptor for cancel_operation
Override in a subclass to manipulate the response
after it is returned by the PredictionService server but before
it is returned to user code.
- async post_delete_operation(self, response: None) -> None
- Post-rpc interceptor for delete_operation
Override in a subclass to manipulate the response
after it is returned by the PredictionService server but before
it is returned to user code.
- async post_direct_predict(self, response: google.cloud.aiplatform_v1.types.prediction_service.DirectPredictResponse) -> google.cloud.aiplatform_v1.types.prediction_service.DirectPredictResponse
- Post-rpc interceptor for direct_predict
DEPRECATED. Please use the `post_direct_predict_with_metadata`
interceptor instead.
Override in a subclass to read or manipulate the response
after it is returned by the PredictionService server but before
it is returned to user code. This `post_direct_predict` interceptor runs
before the `post_direct_predict_with_metadata` interceptor.
- async post_direct_predict_with_metadata(self, response: google.cloud.aiplatform_v1.types.prediction_service.DirectPredictResponse, metadata: Sequence[Tuple[str, Union[str, bytes]]]) -> Tuple[google.cloud.aiplatform_v1.types.prediction_service.DirectPredictResponse, Sequence[Tuple[str, Union[str, bytes]]]]
- Post-rpc interceptor for direct_predict
Override in a subclass to read or manipulate the response or metadata after it
is returned by the PredictionService server but before it is returned to user code.
We recommend only using this `post_direct_predict_with_metadata`
interceptor in new development instead of the `post_direct_predict` interceptor.
When both interceptors are used, this `post_direct_predict_with_metadata` interceptor runs after the
`post_direct_predict` interceptor. The (possibly modified) response returned by
`post_direct_predict` will be passed to
`post_direct_predict_with_metadata`.
- async post_direct_raw_predict(self, response: google.cloud.aiplatform_v1.types.prediction_service.DirectRawPredictResponse) -> google.cloud.aiplatform_v1.types.prediction_service.DirectRawPredictResponse
- Post-rpc interceptor for direct_raw_predict
DEPRECATED. Please use the `post_direct_raw_predict_with_metadata`
interceptor instead.
Override in a subclass to read or manipulate the response
after it is returned by the PredictionService server but before
it is returned to user code. This `post_direct_raw_predict` interceptor runs
before the `post_direct_raw_predict_with_metadata` interceptor.
- async post_direct_raw_predict_with_metadata(self, response: google.cloud.aiplatform_v1.types.prediction_service.DirectRawPredictResponse, metadata: Sequence[Tuple[str, Union[str, bytes]]]) -> Tuple[google.cloud.aiplatform_v1.types.prediction_service.DirectRawPredictResponse, Sequence[Tuple[str, Union[str, bytes]]]]
- Post-rpc interceptor for direct_raw_predict
Override in a subclass to read or manipulate the response or metadata after it
is returned by the PredictionService server but before it is returned to user code.
We recommend only using this `post_direct_raw_predict_with_metadata`
interceptor in new development instead of the `post_direct_raw_predict` interceptor.
When both interceptors are used, this `post_direct_raw_predict_with_metadata` interceptor runs after the
`post_direct_raw_predict` interceptor. The (possibly modified) response returned by
`post_direct_raw_predict` will be passed to
`post_direct_raw_predict_with_metadata`.
- async post_explain(self, response: google.cloud.aiplatform_v1.types.prediction_service.ExplainResponse) -> google.cloud.aiplatform_v1.types.prediction_service.ExplainResponse
- Post-rpc interceptor for explain
DEPRECATED. Please use the `post_explain_with_metadata`
interceptor instead.
Override in a subclass to read or manipulate the response
after it is returned by the PredictionService server but before
it is returned to user code. This `post_explain` interceptor runs
before the `post_explain_with_metadata` interceptor.
- async post_explain_with_metadata(self, response: google.cloud.aiplatform_v1.types.prediction_service.ExplainResponse, metadata: Sequence[Tuple[str, Union[str, bytes]]]) -> Tuple[google.cloud.aiplatform_v1.types.prediction_service.ExplainResponse, Sequence[Tuple[str, Union[str, bytes]]]]
- Post-rpc interceptor for explain
Override in a subclass to read or manipulate the response or metadata after it
is returned by the PredictionService server but before it is returned to user code.
We recommend only using this `post_explain_with_metadata`
interceptor in new development instead of the `post_explain` interceptor.
When both interceptors are used, this `post_explain_with_metadata` interceptor runs after the
`post_explain` interceptor. The (possibly modified) response returned by
`post_explain` will be passed to
`post_explain_with_metadata`.
- async post_generate_content(self, response: google.cloud.aiplatform_v1.types.prediction_service.GenerateContentResponse) -> google.cloud.aiplatform_v1.types.prediction_service.GenerateContentResponse
- Post-rpc interceptor for generate_content
DEPRECATED. Please use the `post_generate_content_with_metadata`
interceptor instead.
Override in a subclass to read or manipulate the response
after it is returned by the PredictionService server but before
it is returned to user code. This `post_generate_content` interceptor runs
before the `post_generate_content_with_metadata` interceptor.
- async post_generate_content_with_metadata(self, response: google.cloud.aiplatform_v1.types.prediction_service.GenerateContentResponse, metadata: Sequence[Tuple[str, Union[str, bytes]]]) -> Tuple[google.cloud.aiplatform_v1.types.prediction_service.GenerateContentResponse, Sequence[Tuple[str, Union[str, bytes]]]]
- Post-rpc interceptor for generate_content
Override in a subclass to read or manipulate the response or metadata after it
is returned by the PredictionService server but before it is returned to user code.
We recommend only using this `post_generate_content_with_metadata`
interceptor in new development instead of the `post_generate_content` interceptor.
When both interceptors are used, this `post_generate_content_with_metadata` interceptor runs after the
`post_generate_content` interceptor. The (possibly modified) response returned by
`post_generate_content` will be passed to
`post_generate_content_with_metadata`.
- async post_get_iam_policy(self, response: google.iam.v1.policy_pb2.Policy) -> google.iam.v1.policy_pb2.Policy
- Post-rpc interceptor for get_iam_policy
Override in a subclass to manipulate the response
after it is returned by the PredictionService server but before
it is returned to user code.
- async post_get_location(self, response: google.cloud.location.locations_pb2.Location) -> google.cloud.location.locations_pb2.Location
- Post-rpc interceptor for get_location
Override in a subclass to manipulate the response
after it is returned by the PredictionService server but before
it is returned to user code.
- async post_get_operation(self, response: google.longrunning.operations_pb2.Operation) -> google.longrunning.operations_pb2.Operation
- Post-rpc interceptor for get_operation
Override in a subclass to manipulate the response
after it is returned by the PredictionService server but before
it is returned to user code.
- async post_list_locations(self, response: google.cloud.location.locations_pb2.ListLocationsResponse) -> google.cloud.location.locations_pb2.ListLocationsResponse
- Post-rpc interceptor for list_locations
Override in a subclass to manipulate the response
after it is returned by the PredictionService server but before
it is returned to user code.
- async post_list_operations(self, response: google.longrunning.operations_pb2.ListOperationsResponse) -> google.longrunning.operations_pb2.ListOperationsResponse
- Post-rpc interceptor for list_operations
Override in a subclass to manipulate the response
after it is returned by the PredictionService server but before
it is returned to user code.
- async post_predict(self, response: google.cloud.aiplatform_v1.types.prediction_service.PredictResponse) -> google.cloud.aiplatform_v1.types.prediction_service.PredictResponse
- Post-rpc interceptor for predict
DEPRECATED. Please use the `post_predict_with_metadata`
interceptor instead.
Override in a subclass to read or manipulate the response
after it is returned by the PredictionService server but before
it is returned to user code. This `post_predict` interceptor runs
before the `post_predict_with_metadata` interceptor.
- async post_predict_with_metadata(self, response: google.cloud.aiplatform_v1.types.prediction_service.PredictResponse, metadata: Sequence[Tuple[str, Union[str, bytes]]]) -> Tuple[google.cloud.aiplatform_v1.types.prediction_service.PredictResponse, Sequence[Tuple[str, Union[str, bytes]]]]
- Post-rpc interceptor for predict
Override in a subclass to read or manipulate the response or metadata after it
is returned by the PredictionService server but before it is returned to user code.
We recommend only using this `post_predict_with_metadata`
interceptor in new development instead of the `post_predict` interceptor.
When both interceptors are used, this `post_predict_with_metadata` interceptor runs after the
`post_predict` interceptor. The (possibly modified) response returned by
`post_predict` will be passed to
`post_predict_with_metadata`.
- async post_raw_predict(self, response: google.api.httpbody_pb2.HttpBody) -> google.api.httpbody_pb2.HttpBody
- Post-rpc interceptor for raw_predict
DEPRECATED. Please use the `post_raw_predict_with_metadata`
interceptor instead.
Override in a subclass to read or manipulate the response
after it is returned by the PredictionService server but before
it is returned to user code. This `post_raw_predict` interceptor runs
before the `post_raw_predict_with_metadata` interceptor.
- async post_raw_predict_with_metadata(self, response: google.api.httpbody_pb2.HttpBody, metadata: Sequence[Tuple[str, Union[str, bytes]]]) -> Tuple[google.api.httpbody_pb2.HttpBody, Sequence[Tuple[str, Union[str, bytes]]]]
- Post-rpc interceptor for raw_predict
Override in a subclass to read or manipulate the response or metadata after it
is returned by the PredictionService server but before it is returned to user code.
We recommend only using this `post_raw_predict_with_metadata`
interceptor in new development instead of the `post_raw_predict` interceptor.
When both interceptors are used, this `post_raw_predict_with_metadata` interceptor runs after the
`post_raw_predict` interceptor. The (possibly modified) response returned by
`post_raw_predict` will be passed to
`post_raw_predict_with_metadata`.
- async post_server_streaming_predict(self, response: google.api_core.rest_streaming_async.AsyncResponseIterator) -> google.api_core.rest_streaming_async.AsyncResponseIterator
- Post-rpc interceptor for server_streaming_predict
DEPRECATED. Please use the `post_server_streaming_predict_with_metadata`
interceptor instead.
Override in a subclass to read or manipulate the response
after it is returned by the PredictionService server but before
it is returned to user code. This `post_server_streaming_predict` interceptor runs
before the `post_server_streaming_predict_with_metadata` interceptor.
- async post_server_streaming_predict_with_metadata(self, response: google.api_core.rest_streaming_async.AsyncResponseIterator, metadata: Sequence[Tuple[str, Union[str, bytes]]]) -> Tuple[google.api_core.rest_streaming_async.AsyncResponseIterator, Sequence[Tuple[str, Union[str, bytes]]]]
- Post-rpc interceptor for server_streaming_predict
Override in a subclass to read or manipulate the response or metadata after it
is returned by the PredictionService server but before it is returned to user code.
We recommend only using this `post_server_streaming_predict_with_metadata`
interceptor in new development instead of the `post_server_streaming_predict` interceptor.
When both interceptors are used, this `post_server_streaming_predict_with_metadata` interceptor runs after the
`post_server_streaming_predict` interceptor. The (possibly modified) response returned by
`post_server_streaming_predict` will be passed to
`post_server_streaming_predict_with_metadata`.
- async post_set_iam_policy(self, response: google.iam.v1.policy_pb2.Policy) -> google.iam.v1.policy_pb2.Policy
- Post-rpc interceptor for set_iam_policy
Override in a subclass to manipulate the response
after it is returned by the PredictionService server but before
it is returned to user code.
- async post_stream_generate_content_with_metadata(self, response: google.api_core.rest_streaming_async.AsyncResponseIterator, metadata: Sequence[Tuple[str, Union[str, bytes]]]) -> Tuple[google.api_core.rest_streaming_async.AsyncResponseIterator, Sequence[Tuple[str, Union[str, bytes]]]]
- Post-rpc interceptor for stream_generate_content
Override in a subclass to read or manipulate the response or metadata after it
is returned by the PredictionService server but before it is returned to user code.
We recommend only using this `post_stream_generate_content_with_metadata`
interceptor in new development instead of the `post_stream_generate_content` interceptor.
When both interceptors are used, this `post_stream_generate_content_with_metadata` interceptor runs after the
`post_stream_generate_content` interceptor. The (possibly modified) response returned by
`post_stream_generate_content` will be passed to
`post_stream_generate_content_with_metadata`.
- async post_stream_raw_predict(self, response: google.api_core.rest_streaming_async.AsyncResponseIterator) -> google.api_core.rest_streaming_async.AsyncResponseIterator
- Post-rpc interceptor for stream_raw_predict
DEPRECATED. Please use the `post_stream_raw_predict_with_metadata`
interceptor instead.
Override in a subclass to read or manipulate the response
after it is returned by the PredictionService server but before
it is returned to user code. This `post_stream_raw_predict` interceptor runs
before the `post_stream_raw_predict_with_metadata` interceptor.
- async post_stream_raw_predict_with_metadata(self, response: google.api_core.rest_streaming_async.AsyncResponseIterator, metadata: Sequence[Tuple[str, Union[str, bytes]]]) -> Tuple[google.api_core.rest_streaming_async.AsyncResponseIterator, Sequence[Tuple[str, Union[str, bytes]]]]
- Post-rpc interceptor for stream_raw_predict
Override in a subclass to read or manipulate the response or metadata after it
is returned by the PredictionService server but before it is returned to user code.
We recommend only using this `post_stream_raw_predict_with_metadata`
interceptor in new development instead of the `post_stream_raw_predict` interceptor.
When both interceptors are used, this `post_stream_raw_predict_with_metadata` interceptor runs after the
`post_stream_raw_predict` interceptor. The (possibly modified) response returned by
`post_stream_raw_predict` will be passed to
`post_stream_raw_predict_with_metadata`.
- async post_test_iam_permissions(self, response: google.iam.v1.iam_policy_pb2.TestIamPermissionsResponse) -> google.iam.v1.iam_policy_pb2.TestIamPermissionsResponse
- Post-rpc interceptor for test_iam_permissions
Override in a subclass to manipulate the response
after it is returned by the PredictionService server but before
it is returned to user code.
- async post_wait_operation(self, response: google.longrunning.operations_pb2.Operation) -> google.longrunning.operations_pb2.Operation
- Post-rpc interceptor for wait_operation
Override in a subclass to manipulate the response
after it is returned by the PredictionService server but before
it is returned to user code.
- async pre_cancel_operation(self, request: google.longrunning.operations_pb2.CancelOperationRequest, metadata: Sequence[Tuple[str, Union[str, bytes]]]) -> Tuple[google.longrunning.operations_pb2.CancelOperationRequest, Sequence[Tuple[str, Union[str, bytes]]]]
- Pre-rpc interceptor for cancel_operation
Override in a subclass to manipulate the request or metadata
before they are sent to the PredictionService server.
- async pre_delete_operation(self, request: google.longrunning.operations_pb2.DeleteOperationRequest, metadata: Sequence[Tuple[str, Union[str, bytes]]]) -> Tuple[google.longrunning.operations_pb2.DeleteOperationRequest, Sequence[Tuple[str, Union[str, bytes]]]]
- Pre-rpc interceptor for delete_operation
Override in a subclass to manipulate the request or metadata
before they are sent to the PredictionService server.
- async pre_direct_predict(self, request: google.cloud.aiplatform_v1.types.prediction_service.DirectPredictRequest, metadata: Sequence[Tuple[str, Union[str, bytes]]]) -> Tuple[google.cloud.aiplatform_v1.types.prediction_service.DirectPredictRequest, Sequence[Tuple[str, Union[str, bytes]]]]
- Pre-rpc interceptor for direct_predict
Override in a subclass to manipulate the request or metadata
before they are sent to the PredictionService server.
- async pre_direct_raw_predict(self, request: google.cloud.aiplatform_v1.types.prediction_service.DirectRawPredictRequest, metadata: Sequence[Tuple[str, Union[str, bytes]]]) -> Tuple[google.cloud.aiplatform_v1.types.prediction_service.DirectRawPredictRequest, Sequence[Tuple[str, Union[str, bytes]]]]
- Pre-rpc interceptor for direct_raw_predict
Override in a subclass to manipulate the request or metadata
before they are sent to the PredictionService server.
- async pre_explain(self, request: google.cloud.aiplatform_v1.types.prediction_service.ExplainRequest, metadata: Sequence[Tuple[str, Union[str, bytes]]]) -> Tuple[google.cloud.aiplatform_v1.types.prediction_service.ExplainRequest, Sequence[Tuple[str, Union[str, bytes]]]]
- Pre-rpc interceptor for explain
Override in a subclass to manipulate the request or metadata
before they are sent to the PredictionService server.
- async pre_get_iam_policy(self, request: google.iam.v1.iam_policy_pb2.GetIamPolicyRequest, metadata: Sequence[Tuple[str, Union[str, bytes]]]) -> Tuple[google.iam.v1.iam_policy_pb2.GetIamPolicyRequest, Sequence[Tuple[str, Union[str, bytes]]]]
- Pre-rpc interceptor for get_iam_policy
Override in a subclass to manipulate the request or metadata
before they are sent to the PredictionService server.
- async pre_get_location(self, request: google.cloud.location.locations_pb2.GetLocationRequest, metadata: Sequence[Tuple[str, Union[str, bytes]]]) -> Tuple[google.cloud.location.locations_pb2.GetLocationRequest, Sequence[Tuple[str, Union[str, bytes]]]]
- Pre-rpc interceptor for get_location
Override in a subclass to manipulate the request or metadata
before they are sent to the PredictionService server.
- async pre_get_operation(self, request: google.longrunning.operations_pb2.GetOperationRequest, metadata: Sequence[Tuple[str, Union[str, bytes]]]) -> Tuple[google.longrunning.operations_pb2.GetOperationRequest, Sequence[Tuple[str, Union[str, bytes]]]]
- Pre-rpc interceptor for get_operation
Override in a subclass to manipulate the request or metadata
before they are sent to the PredictionService server.
- async pre_list_locations(self, request: google.cloud.location.locations_pb2.ListLocationsRequest, metadata: Sequence[Tuple[str, Union[str, bytes]]]) -> Tuple[google.cloud.location.locations_pb2.ListLocationsRequest, Sequence[Tuple[str, Union[str, bytes]]]]
- Pre-rpc interceptor for list_locations
Override in a subclass to manipulate the request or metadata
before they are sent to the PredictionService server.
- async pre_list_operations(self, request: google.longrunning.operations_pb2.ListOperationsRequest, metadata: Sequence[Tuple[str, Union[str, bytes]]]) -> Tuple[google.longrunning.operations_pb2.ListOperationsRequest, Sequence[Tuple[str, Union[str, bytes]]]]
- Pre-rpc interceptor for list_operations
Override in a subclass to manipulate the request or metadata
before they are sent to the PredictionService server.
- async pre_predict(self, request: google.cloud.aiplatform_v1.types.prediction_service.PredictRequest, metadata: Sequence[Tuple[str, Union[str, bytes]]]) -> Tuple[google.cloud.aiplatform_v1.types.prediction_service.PredictRequest, Sequence[Tuple[str, Union[str, bytes]]]]
- Pre-rpc interceptor for predict
Override in a subclass to manipulate the request or metadata
before they are sent to the PredictionService server.
- async pre_raw_predict(self, request: google.cloud.aiplatform_v1.types.prediction_service.RawPredictRequest, metadata: Sequence[Tuple[str, Union[str, bytes]]]) -> Tuple[google.cloud.aiplatform_v1.types.prediction_service.RawPredictRequest, Sequence[Tuple[str, Union[str, bytes]]]]
- Pre-rpc interceptor for raw_predict
Override in a subclass to manipulate the request or metadata
before they are sent to the PredictionService server.
- async pre_server_streaming_predict(self, request: google.cloud.aiplatform_v1.types.prediction_service.StreamingPredictRequest, metadata: Sequence[Tuple[str, Union[str, bytes]]]) -> Tuple[google.cloud.aiplatform_v1.types.prediction_service.StreamingPredictRequest, Sequence[Tuple[str, Union[str, bytes]]]]
- Pre-rpc interceptor for server_streaming_predict
Override in a subclass to manipulate the request or metadata
before they are sent to the PredictionService server.
- async pre_set_iam_policy(self, request: google.iam.v1.iam_policy_pb2.SetIamPolicyRequest, metadata: Sequence[Tuple[str, Union[str, bytes]]]) -> Tuple[google.iam.v1.iam_policy_pb2.SetIamPolicyRequest, Sequence[Tuple[str, Union[str, bytes]]]]
- Pre-rpc interceptor for set_iam_policy
Override in a subclass to manipulate the request or metadata
before they are sent to the PredictionService server.
- async pre_stream_raw_predict(self, request: google.cloud.aiplatform_v1.types.prediction_service.StreamRawPredictRequest, metadata: Sequence[Tuple[str, Union[str, bytes]]]) -> Tuple[google.cloud.aiplatform_v1.types.prediction_service.StreamRawPredictRequest, Sequence[Tuple[str, Union[str, bytes]]]]
- Pre-rpc interceptor for stream_raw_predict
Override in a subclass to manipulate the request or metadata
before they are sent to the PredictionService server.
- async pre_test_iam_permissions(self, request: google.iam.v1.iam_policy_pb2.TestIamPermissionsRequest, metadata: Sequence[Tuple[str, Union[str, bytes]]]) -> Tuple[google.iam.v1.iam_policy_pb2.TestIamPermissionsRequest, Sequence[Tuple[str, Union[str, bytes]]]]
- Pre-rpc interceptor for test_iam_permissions
Override in a subclass to manipulate the request or metadata
before they are sent to the PredictionService server.
- async pre_wait_operation(self, request: google.longrunning.operations_pb2.WaitOperationRequest, metadata: Sequence[Tuple[str, Union[str, bytes]]]) -> Tuple[google.longrunning.operations_pb2.WaitOperationRequest, Sequence[Tuple[str, Union[str, bytes]]]]
- Pre-rpc interceptor for wait_operation
Override in a subclass to manipulate the request or metadata
before they are sent to the PredictionService server.
Data descriptors inherited from google.cloud.aiplatform_v1.services.prediction_service.transports.rest_asyncio.AsyncPredictionServiceRestInterceptor:
- __dict__
- dictionary for instance variables (if defined)
- __weakref__
- list of weak references to the object (if defined)
|
class GenAIHubPredictionServiceRestInterceptor(google.cloud.aiplatform_v1.services.prediction_service.transports.rest.PredictionServiceRestInterceptor) |
|
GenAIHubPredictionServiceRestInterceptor(*args, aicore_proxy_client: gen_ai_hub.proxy.core.base.BaseProxyClient, credentials_reference: google.oauth2.credentials.Credentials, **kwargs) -> None
Interceptor class compatible with
google.cloud.aiplatform_v1.services.prediction_service.transports.PredictionServiceRestInterceptor
and
google.ai.generativelanguage_v1.services.generative_service.transports.rest.GenerativeServiceRestInterceptor. |
|
- Method resolution order:
- GenAIHubPredictionServiceRestInterceptor
- google.cloud.aiplatform_v1.services.prediction_service.transports.rest.PredictionServiceRestInterceptor
- builtins.object
Methods defined here:
- __init__(self, *args, aicore_proxy_client: gen_ai_hub.proxy.core.base.BaseProxyClient, credentials_reference: google.oauth2.credentials.Credentials, **kwargs) -> None
- Initialize self. See help(type(self)) for accurate signature.
- post_stream_generate_content(self, response: google.api_core.rest_streaming.ResponseIterator) -> google.api_core.rest_streaming.ResponseIterator
- Post-rpc interceptor for stream_generate_content
DEPRECATED. Please use the `post_stream_generate_content_with_metadata`
interceptor instead.
Override in a subclass to read or manipulate the response
after it is returned by the PredictionService server but before
it is returned to user code. This `post_stream_generate_content` interceptor runs
before the `post_stream_generate_content_with_metadata` interceptor.
- pre_generate_content(self, request: google.cloud.aiplatform_v1.types.prediction_service.GenerateContentRequest, metadata: Sequence[Tuple[str, str]]) -> Tuple[google.cloud.aiplatform_v1.types.prediction_service.GenerateContentRequest, Sequence[Tuple[str, str]]]
- Pre-rpc interceptor for generate_content
Override in a subclass to manipulate the request or metadata
before they are sent to the PredictionService server.
- pre_stream_generate_content(self, request, metadata)
- Pre-rpc interceptor for stream_generate_content
Override in a subclass to manipulate the request or metadata
before they are sent to the PredictionService server.
Methods inherited from google.cloud.aiplatform_v1.services.prediction_service.transports.rest.PredictionServiceRestInterceptor:
- post_cancel_operation(self, response: None) -> None
- Post-rpc interceptor for cancel_operation
Override in a subclass to manipulate the response
after it is returned by the PredictionService server but before
it is returned to user code.
- post_delete_operation(self, response: None) -> None
- Post-rpc interceptor for delete_operation
Override in a subclass to manipulate the response
after it is returned by the PredictionService server but before
it is returned to user code.
- post_direct_predict(self, response: google.cloud.aiplatform_v1.types.prediction_service.DirectPredictResponse) -> google.cloud.aiplatform_v1.types.prediction_service.DirectPredictResponse
- Post-rpc interceptor for direct_predict
DEPRECATED. Please use the `post_direct_predict_with_metadata`
interceptor instead.
Override in a subclass to read or manipulate the response
after it is returned by the PredictionService server but before
it is returned to user code. This `post_direct_predict` interceptor runs
before the `post_direct_predict_with_metadata` interceptor.
- post_direct_predict_with_metadata(self, response: google.cloud.aiplatform_v1.types.prediction_service.DirectPredictResponse, metadata: Sequence[Tuple[str, Union[str, bytes]]]) -> Tuple[google.cloud.aiplatform_v1.types.prediction_service.DirectPredictResponse, Sequence[Tuple[str, Union[str, bytes]]]]
- Post-rpc interceptor for direct_predict
Override in a subclass to read or manipulate the response or metadata after it
is returned by the PredictionService server but before it is returned to user code.
We recommend only using this `post_direct_predict_with_metadata`
interceptor in new development instead of the `post_direct_predict` interceptor.
When both interceptors are used, this `post_direct_predict_with_metadata` interceptor runs after the
`post_direct_predict` interceptor. The (possibly modified) response returned by
`post_direct_predict` will be passed to
`post_direct_predict_with_metadata`.
- post_direct_raw_predict(self, response: google.cloud.aiplatform_v1.types.prediction_service.DirectRawPredictResponse) -> google.cloud.aiplatform_v1.types.prediction_service.DirectRawPredictResponse
- Post-rpc interceptor for direct_raw_predict
DEPRECATED. Please use the `post_direct_raw_predict_with_metadata`
interceptor instead.
Override in a subclass to read or manipulate the response
after it is returned by the PredictionService server but before
it is returned to user code. This `post_direct_raw_predict` interceptor runs
before the `post_direct_raw_predict_with_metadata` interceptor.
- post_direct_raw_predict_with_metadata(self, response: google.cloud.aiplatform_v1.types.prediction_service.DirectRawPredictResponse, metadata: Sequence[Tuple[str, Union[str, bytes]]]) -> Tuple[google.cloud.aiplatform_v1.types.prediction_service.DirectRawPredictResponse, Sequence[Tuple[str, Union[str, bytes]]]]
- Post-rpc interceptor for direct_raw_predict
Override in a subclass to read or manipulate the response or metadata after it
is returned by the PredictionService server but before it is returned to user code.
We recommend only using this `post_direct_raw_predict_with_metadata`
interceptor in new development instead of the `post_direct_raw_predict` interceptor.
When both interceptors are used, this `post_direct_raw_predict_with_metadata` interceptor runs after the
`post_direct_raw_predict` interceptor. The (possibly modified) response returned by
`post_direct_raw_predict` will be passed to
`post_direct_raw_predict_with_metadata`.
- post_explain(self, response: google.cloud.aiplatform_v1.types.prediction_service.ExplainResponse) -> google.cloud.aiplatform_v1.types.prediction_service.ExplainResponse
- Post-rpc interceptor for explain
DEPRECATED. Please use the `post_explain_with_metadata`
interceptor instead.
Override in a subclass to read or manipulate the response
after it is returned by the PredictionService server but before
it is returned to user code. This `post_explain` interceptor runs
before the `post_explain_with_metadata` interceptor.
- post_explain_with_metadata(self, response: google.cloud.aiplatform_v1.types.prediction_service.ExplainResponse, metadata: Sequence[Tuple[str, Union[str, bytes]]]) -> Tuple[google.cloud.aiplatform_v1.types.prediction_service.ExplainResponse, Sequence[Tuple[str, Union[str, bytes]]]]
- Post-rpc interceptor for explain
Override in a subclass to read or manipulate the response or metadata after it
is returned by the PredictionService server but before it is returned to user code.
We recommend only using this `post_explain_with_metadata`
interceptor in new development instead of the `post_explain` interceptor.
When both interceptors are used, this `post_explain_with_metadata` interceptor runs after the
`post_explain` interceptor. The (possibly modified) response returned by
`post_explain` will be passed to
`post_explain_with_metadata`.
- post_generate_content(self, response: google.cloud.aiplatform_v1.types.prediction_service.GenerateContentResponse) -> google.cloud.aiplatform_v1.types.prediction_service.GenerateContentResponse
- Post-rpc interceptor for generate_content
DEPRECATED. Please use the `post_generate_content_with_metadata`
interceptor instead.
Override in a subclass to read or manipulate the response
after it is returned by the PredictionService server but before
it is returned to user code. This `post_generate_content` interceptor runs
before the `post_generate_content_with_metadata` interceptor.
- post_generate_content_with_metadata(self, response: google.cloud.aiplatform_v1.types.prediction_service.GenerateContentResponse, metadata: Sequence[Tuple[str, Union[str, bytes]]]) -> Tuple[google.cloud.aiplatform_v1.types.prediction_service.GenerateContentResponse, Sequence[Tuple[str, Union[str, bytes]]]]
- Post-rpc interceptor for generate_content
Override in a subclass to read or manipulate the response or metadata after it
is returned by the PredictionService server but before it is returned to user code.
We recommend only using this `post_generate_content_with_metadata`
interceptor in new development instead of the `post_generate_content` interceptor.
When both interceptors are used, this `post_generate_content_with_metadata` interceptor runs after the
`post_generate_content` interceptor. The (possibly modified) response returned by
`post_generate_content` will be passed to
`post_generate_content_with_metadata`.
- post_get_iam_policy(self, response: google.iam.v1.policy_pb2.Policy) -> google.iam.v1.policy_pb2.Policy
- Post-rpc interceptor for get_iam_policy
Override in a subclass to manipulate the response
after it is returned by the PredictionService server but before
it is returned to user code.
- post_get_location(self, response: google.cloud.location.locations_pb2.Location) -> google.cloud.location.locations_pb2.Location
- Post-rpc interceptor for get_location
Override in a subclass to manipulate the response
after it is returned by the PredictionService server but before
it is returned to user code.
- post_get_operation(self, response: google.longrunning.operations_pb2.Operation) -> google.longrunning.operations_pb2.Operation
- Post-rpc interceptor for get_operation
Override in a subclass to manipulate the response
after it is returned by the PredictionService server but before
it is returned to user code.
- post_list_locations(self, response: google.cloud.location.locations_pb2.ListLocationsResponse) -> google.cloud.location.locations_pb2.ListLocationsResponse
- Post-rpc interceptor for list_locations
Override in a subclass to manipulate the response
after it is returned by the PredictionService server but before
it is returned to user code.
- post_list_operations(self, response: google.longrunning.operations_pb2.ListOperationsResponse) -> google.longrunning.operations_pb2.ListOperationsResponse
- Post-rpc interceptor for list_operations
Override in a subclass to manipulate the response
after it is returned by the PredictionService server but before
it is returned to user code.
- post_predict(self, response: google.cloud.aiplatform_v1.types.prediction_service.PredictResponse) -> google.cloud.aiplatform_v1.types.prediction_service.PredictResponse
- Post-rpc interceptor for predict
DEPRECATED. Please use the `post_predict_with_metadata`
interceptor instead.
Override in a subclass to read or manipulate the response
after it is returned by the PredictionService server but before
it is returned to user code. This `post_predict` interceptor runs
before the `post_predict_with_metadata` interceptor.
- post_predict_with_metadata(self, response: google.cloud.aiplatform_v1.types.prediction_service.PredictResponse, metadata: Sequence[Tuple[str, Union[str, bytes]]]) -> Tuple[google.cloud.aiplatform_v1.types.prediction_service.PredictResponse, Sequence[Tuple[str, Union[str, bytes]]]]
- Post-rpc interceptor for predict
Override in a subclass to read or manipulate the response or metadata after it
is returned by the PredictionService server but before it is returned to user code.
We recommend only using this `post_predict_with_metadata`
interceptor in new development instead of the `post_predict` interceptor.
When both interceptors are used, this `post_predict_with_metadata` interceptor runs after the
`post_predict` interceptor. The (possibly modified) response returned by
`post_predict` will be passed to
`post_predict_with_metadata`.
- post_raw_predict(self, response: google.api.httpbody_pb2.HttpBody) -> google.api.httpbody_pb2.HttpBody
- Post-rpc interceptor for raw_predict
DEPRECATED. Please use the `post_raw_predict_with_metadata`
interceptor instead.
Override in a subclass to read or manipulate the response
after it is returned by the PredictionService server but before
it is returned to user code. This `post_raw_predict` interceptor runs
before the `post_raw_predict_with_metadata` interceptor.
- post_raw_predict_with_metadata(self, response: google.api.httpbody_pb2.HttpBody, metadata: Sequence[Tuple[str, Union[str, bytes]]]) -> Tuple[google.api.httpbody_pb2.HttpBody, Sequence[Tuple[str, Union[str, bytes]]]]
- Post-rpc interceptor for raw_predict
Override in a subclass to read or manipulate the response or metadata after it
is returned by the PredictionService server but before it is returned to user code.
We recommend only using this `post_raw_predict_with_metadata`
interceptor in new development instead of the `post_raw_predict` interceptor.
When both interceptors are used, this `post_raw_predict_with_metadata` interceptor runs after the
`post_raw_predict` interceptor. The (possibly modified) response returned by
`post_raw_predict` will be passed to
`post_raw_predict_with_metadata`.
- post_server_streaming_predict(self, response: google.api_core.rest_streaming.ResponseIterator) -> google.api_core.rest_streaming.ResponseIterator
- Post-rpc interceptor for server_streaming_predict
DEPRECATED. Please use the `post_server_streaming_predict_with_metadata`
interceptor instead.
Override in a subclass to read or manipulate the response
after it is returned by the PredictionService server but before
it is returned to user code. This `post_server_streaming_predict` interceptor runs
before the `post_server_streaming_predict_with_metadata` interceptor.
- post_server_streaming_predict_with_metadata(self, response: google.api_core.rest_streaming.ResponseIterator, metadata: Sequence[Tuple[str, Union[str, bytes]]]) -> Tuple[google.api_core.rest_streaming.ResponseIterator, Sequence[Tuple[str, Union[str, bytes]]]]
- Post-rpc interceptor for server_streaming_predict
Override in a subclass to read or manipulate the response or metadata after it
is returned by the PredictionService server but before it is returned to user code.
We recommend only using this `post_server_streaming_predict_with_metadata`
interceptor in new development instead of the `post_server_streaming_predict` interceptor.
When both interceptors are used, this `post_server_streaming_predict_with_metadata` interceptor runs after the
`post_server_streaming_predict` interceptor. The (possibly modified) response returned by
`post_server_streaming_predict` will be passed to
`post_server_streaming_predict_with_metadata`.
- post_set_iam_policy(self, response: google.iam.v1.policy_pb2.Policy) -> google.iam.v1.policy_pb2.Policy
- Post-rpc interceptor for set_iam_policy
Override in a subclass to manipulate the response
after it is returned by the PredictionService server but before
it is returned to user code.
- post_stream_generate_content_with_metadata(self, response: google.api_core.rest_streaming.ResponseIterator, metadata: Sequence[Tuple[str, Union[str, bytes]]]) -> Tuple[google.api_core.rest_streaming.ResponseIterator, Sequence[Tuple[str, Union[str, bytes]]]]
- Post-rpc interceptor for stream_generate_content
Override in a subclass to read or manipulate the response or metadata after it
is returned by the PredictionService server but before it is returned to user code.
We recommend only using this `post_stream_generate_content_with_metadata`
interceptor in new development instead of the `post_stream_generate_content` interceptor.
When both interceptors are used, this `post_stream_generate_content_with_metadata` interceptor runs after the
`post_stream_generate_content` interceptor. The (possibly modified) response returned by
`post_stream_generate_content` will be passed to
`post_stream_generate_content_with_metadata`.
- post_stream_raw_predict(self, response: google.api_core.rest_streaming.ResponseIterator) -> google.api_core.rest_streaming.ResponseIterator
- Post-rpc interceptor for stream_raw_predict
DEPRECATED. Please use the `post_stream_raw_predict_with_metadata`
interceptor instead.
Override in a subclass to read or manipulate the response
after it is returned by the PredictionService server but before
it is returned to user code. This `post_stream_raw_predict` interceptor runs
before the `post_stream_raw_predict_with_metadata` interceptor.
- post_stream_raw_predict_with_metadata(self, response: google.api_core.rest_streaming.ResponseIterator, metadata: Sequence[Tuple[str, Union[str, bytes]]]) -> Tuple[google.api_core.rest_streaming.ResponseIterator, Sequence[Tuple[str, Union[str, bytes]]]]
- Post-rpc interceptor for stream_raw_predict
Override in a subclass to read or manipulate the response or metadata after it
is returned by the PredictionService server but before it is returned to user code.
We recommend only using this `post_stream_raw_predict_with_metadata`
interceptor in new development instead of the `post_stream_raw_predict` interceptor.
When both interceptors are used, this `post_stream_raw_predict_with_metadata` interceptor runs after the
`post_stream_raw_predict` interceptor. The (possibly modified) response returned by
`post_stream_raw_predict` will be passed to
`post_stream_raw_predict_with_metadata`.
- post_test_iam_permissions(self, response: google.iam.v1.iam_policy_pb2.TestIamPermissionsResponse) -> google.iam.v1.iam_policy_pb2.TestIamPermissionsResponse
- Post-rpc interceptor for test_iam_permissions
Override in a subclass to manipulate the response
after it is returned by the PredictionService server but before
it is returned to user code.
- post_wait_operation(self, response: google.longrunning.operations_pb2.Operation) -> google.longrunning.operations_pb2.Operation
- Post-rpc interceptor for wait_operation
Override in a subclass to manipulate the response
after it is returned by the PredictionService server but before
it is returned to user code.
- pre_cancel_operation(self, request: google.longrunning.operations_pb2.CancelOperationRequest, metadata: Sequence[Tuple[str, Union[str, bytes]]]) -> Tuple[google.longrunning.operations_pb2.CancelOperationRequest, Sequence[Tuple[str, Union[str, bytes]]]]
- Pre-rpc interceptor for cancel_operation
Override in a subclass to manipulate the request or metadata
before they are sent to the PredictionService server.
- pre_delete_operation(self, request: google.longrunning.operations_pb2.DeleteOperationRequest, metadata: Sequence[Tuple[str, Union[str, bytes]]]) -> Tuple[google.longrunning.operations_pb2.DeleteOperationRequest, Sequence[Tuple[str, Union[str, bytes]]]]
- Pre-rpc interceptor for delete_operation
Override in a subclass to manipulate the request or metadata
before they are sent to the PredictionService server.
- pre_direct_predict(self, request: google.cloud.aiplatform_v1.types.prediction_service.DirectPredictRequest, metadata: Sequence[Tuple[str, Union[str, bytes]]]) -> Tuple[google.cloud.aiplatform_v1.types.prediction_service.DirectPredictRequest, Sequence[Tuple[str, Union[str, bytes]]]]
- Pre-rpc interceptor for direct_predict
Override in a subclass to manipulate the request or metadata
before they are sent to the PredictionService server.
- pre_direct_raw_predict(self, request: google.cloud.aiplatform_v1.types.prediction_service.DirectRawPredictRequest, metadata: Sequence[Tuple[str, Union[str, bytes]]]) -> Tuple[google.cloud.aiplatform_v1.types.prediction_service.DirectRawPredictRequest, Sequence[Tuple[str, Union[str, bytes]]]]
- Pre-rpc interceptor for direct_raw_predict
Override in a subclass to manipulate the request or metadata
before they are sent to the PredictionService server.
- pre_explain(self, request: google.cloud.aiplatform_v1.types.prediction_service.ExplainRequest, metadata: Sequence[Tuple[str, Union[str, bytes]]]) -> Tuple[google.cloud.aiplatform_v1.types.prediction_service.ExplainRequest, Sequence[Tuple[str, Union[str, bytes]]]]
- Pre-rpc interceptor for explain
Override in a subclass to manipulate the request or metadata
before they are sent to the PredictionService server.
- pre_get_iam_policy(self, request: google.iam.v1.iam_policy_pb2.GetIamPolicyRequest, metadata: Sequence[Tuple[str, Union[str, bytes]]]) -> Tuple[google.iam.v1.iam_policy_pb2.GetIamPolicyRequest, Sequence[Tuple[str, Union[str, bytes]]]]
- Pre-rpc interceptor for get_iam_policy
Override in a subclass to manipulate the request or metadata
before they are sent to the PredictionService server.
- pre_get_location(self, request: google.cloud.location.locations_pb2.GetLocationRequest, metadata: Sequence[Tuple[str, Union[str, bytes]]]) -> Tuple[google.cloud.location.locations_pb2.GetLocationRequest, Sequence[Tuple[str, Union[str, bytes]]]]
- Pre-rpc interceptor for get_location
Override in a subclass to manipulate the request or metadata
before they are sent to the PredictionService server.
- pre_get_operation(self, request: google.longrunning.operations_pb2.GetOperationRequest, metadata: Sequence[Tuple[str, Union[str, bytes]]]) -> Tuple[google.longrunning.operations_pb2.GetOperationRequest, Sequence[Tuple[str, Union[str, bytes]]]]
- Pre-rpc interceptor for get_operation
Override in a subclass to manipulate the request or metadata
before they are sent to the PredictionService server.
- pre_list_locations(self, request: google.cloud.location.locations_pb2.ListLocationsRequest, metadata: Sequence[Tuple[str, Union[str, bytes]]]) -> Tuple[google.cloud.location.locations_pb2.ListLocationsRequest, Sequence[Tuple[str, Union[str, bytes]]]]
- Pre-rpc interceptor for list_locations
Override in a subclass to manipulate the request or metadata
before they are sent to the PredictionService server.
- pre_list_operations(self, request: google.longrunning.operations_pb2.ListOperationsRequest, metadata: Sequence[Tuple[str, Union[str, bytes]]]) -> Tuple[google.longrunning.operations_pb2.ListOperationsRequest, Sequence[Tuple[str, Union[str, bytes]]]]
- Pre-rpc interceptor for list_operations
Override in a subclass to manipulate the request or metadata
before they are sent to the PredictionService server.
- pre_predict(self, request: google.cloud.aiplatform_v1.types.prediction_service.PredictRequest, metadata: Sequence[Tuple[str, Union[str, bytes]]]) -> Tuple[google.cloud.aiplatform_v1.types.prediction_service.PredictRequest, Sequence[Tuple[str, Union[str, bytes]]]]
- Pre-rpc interceptor for predict
Override in a subclass to manipulate the request or metadata
before they are sent to the PredictionService server.
- pre_raw_predict(self, request: google.cloud.aiplatform_v1.types.prediction_service.RawPredictRequest, metadata: Sequence[Tuple[str, Union[str, bytes]]]) -> Tuple[google.cloud.aiplatform_v1.types.prediction_service.RawPredictRequest, Sequence[Tuple[str, Union[str, bytes]]]]
- Pre-rpc interceptor for raw_predict
Override in a subclass to manipulate the request or metadata
before they are sent to the PredictionService server.
- pre_server_streaming_predict(self, request: google.cloud.aiplatform_v1.types.prediction_service.StreamingPredictRequest, metadata: Sequence[Tuple[str, Union[str, bytes]]]) -> Tuple[google.cloud.aiplatform_v1.types.prediction_service.StreamingPredictRequest, Sequence[Tuple[str, Union[str, bytes]]]]
- Pre-rpc interceptor for server_streaming_predict
Override in a subclass to manipulate the request or metadata
before they are sent to the PredictionService server.
- pre_set_iam_policy(self, request: google.iam.v1.iam_policy_pb2.SetIamPolicyRequest, metadata: Sequence[Tuple[str, Union[str, bytes]]]) -> Tuple[google.iam.v1.iam_policy_pb2.SetIamPolicyRequest, Sequence[Tuple[str, Union[str, bytes]]]]
- Pre-rpc interceptor for set_iam_policy
Override in a subclass to manipulate the request or metadata
before they are sent to the PredictionService server.
- pre_stream_raw_predict(self, request: google.cloud.aiplatform_v1.types.prediction_service.StreamRawPredictRequest, metadata: Sequence[Tuple[str, Union[str, bytes]]]) -> Tuple[google.cloud.aiplatform_v1.types.prediction_service.StreamRawPredictRequest, Sequence[Tuple[str, Union[str, bytes]]]]
- Pre-rpc interceptor for stream_raw_predict
Override in a subclass to manipulate the request or metadata
before they are sent to the PredictionService server.
- pre_test_iam_permissions(self, request: google.iam.v1.iam_policy_pb2.TestIamPermissionsRequest, metadata: Sequence[Tuple[str, Union[str, bytes]]]) -> Tuple[google.iam.v1.iam_policy_pb2.TestIamPermissionsRequest, Sequence[Tuple[str, Union[str, bytes]]]]
- Pre-rpc interceptor for test_iam_permissions
Override in a subclass to manipulate the request or metadata
before they are sent to the PredictionService server.
- pre_wait_operation(self, request: google.longrunning.operations_pb2.WaitOperationRequest, metadata: Sequence[Tuple[str, Union[str, bytes]]]) -> Tuple[google.longrunning.operations_pb2.WaitOperationRequest, Sequence[Tuple[str, Union[str, bytes]]]]
- Pre-rpc interceptor for wait_operation
Override in a subclass to manipulate the request or metadata
before they are sent to the PredictionService server.
Data descriptors inherited from google.cloud.aiplatform_v1.services.prediction_service.transports.rest.PredictionServiceRestInterceptor:
- __dict__
- dictionary for instance variables (if defined)
- __weakref__
- list of weak references to the object (if defined)
|
class GenerativeModel(vertexai.generative_models.GenerativeModel) |
|
GenerativeModel(model: str = '', deployment_id: str = '', model_name: str = '', config_id: str = '', config_name: str = '', proxy_client: Optional[gen_ai_hub.proxy.core.base.BaseProxyClient] = None, *args, **kwargs)
Drop-in replacement for vertexai.generative_models.GenerativeModel. |
|
- Method resolution order:
- GenerativeModel
- vertexai.generative_models.GenerativeModel
- vertexai.generative_models._generative_models._GenerativeModel
- builtins.object
Methods defined here:
- __init__(self, model: str = '', deployment_id: str = '', model_name: str = '', config_id: str = '', config_name: str = '', proxy_client: Optional[gen_ai_hub.proxy.core.base.BaseProxyClient] = None, *args, **kwargs)
- Initializes GenerativeModel.
Usage:
```
model = GenerativeModel("gemini-pro")
print(model.generate_content("Hello"))
```
Args:
model_name: Model Garden model resource name.
Alternatively, a tuned model endpoint resource name can be provided.
generation_config: Default generation config to use in generate_content.
safety_settings: Default safety settings to use in generate_content.
tools: Default tools to use in generate_content.
tool_config: Default tool config to use in generate_content.
system_instruction: Default system instruction to use in generate_content.
Note: Only text should be used in parts.
Content of each part will become a separate paragraph.
labels: labels that will be passed to billing for cost tracking.
Methods inherited from vertexai.generative_models._generative_models._GenerativeModel:
- compute_tokens(self, contents: ContentsType) -> google.cloud.aiplatform_v1beta1.types.llm_utility_service.ComputeTokensResponse
- Computes tokens.
Args:
contents: Contents to send to the model.
Supports either a list of Content objects (passing a multi-turn conversation)
or a value that can be converted to a single Content object (passing a single message).
Supports
* str, Image, Part,
* List[Union[str, Image, Part]],
* List[Content]
Returns:
A ComputeTokensResponse object that has the following attributes:
tokens_info: Lists of tokens_info from the input.
The input `contents: ContentsType` could have
multiple string instances and each tokens_info
item represents each string instance. Each token
info consists tokens list, token_ids list and
a role.
- async compute_tokens_async(self, contents: ContentsType) -> google.cloud.aiplatform_v1beta1.types.llm_utility_service.ComputeTokensResponse
- Computes tokens asynchronously.
Args:
contents: Contents to send to the model.
Supports either a list of Content objects (passing a multi-turn conversation)
or a value that can be converted to a single Content object (passing a single message).
Supports
* str, Image, Part,
* List[Union[str, Image, Part]],
* List[Content]
Returns:
And awaitable for a ComputeTokensResponse object that has the following attributes:
tokens_info: Lists of tokens_info from the input.
The input `contents: ContentsType` could have
multiple string instances and each tokens_info
item represents each string instance. Each token
info consists tokens list, token_ids list and
a role.
- count_tokens(self, contents: ContentsType, *, tools: Optional[List[ForwardRef('Tool')]] = None) -> google.cloud.aiplatform_v1beta1.types.prediction_service.CountTokensResponse
- Counts tokens.
Args:
contents: Contents to send to the model.
Supports either a list of Content objects (passing a multi-turn conversation)
or a value that can be converted to a single Content object (passing a single message).
Supports
* str, Image, Part,
* List[Union[str, Image, Part]],
* List[Content]
tools: A list of tools (functions) that the model can try calling.
Returns:
A CountTokensResponse object that has the following attributes:
total_tokens: The total number of tokens counted across all instances from the request.
total_billable_characters: The total number of billable characters counted across all instances from the request.
- async count_tokens_async(self, contents: ContentsType, *, tools: Optional[List[ForwardRef('Tool')]] = None) -> google.cloud.aiplatform_v1beta1.types.prediction_service.CountTokensResponse
- Counts tokens asynchronously.
Args:
contents: Contents to send to the model.
Supports either a list of Content objects (passing a multi-turn conversation)
or a value that can be converted to a single Content object (passing a single message).
Supports
* str, Image, Part,
* List[Union[str, Image, Part]],
* List[Content]
tools: A list of tools (functions) that the model can try calling.
Returns:
And awaitable for a CountTokensResponse object that has the following attributes:
total_tokens: The total number of tokens counted across all instances from the request.
total_billable_characters: The total number of billable characters counted across all instances from the request.
- generate_content(self, contents: ContentsType, *, generation_config: Optional[GenerationConfigType] = None, safety_settings: Optional[SafetySettingsType] = None, tools: Optional[List[ForwardRef('Tool')]] = None, tool_config: Optional[ForwardRef('ToolConfig')] = None, labels: Optional[Dict[str, str]] = None, stream: bool = False) -> Union[ForwardRef('GenerationResponse'), Iterable[ForwardRef('GenerationResponse')]]
- Generates content.
Args:
contents: Contents to send to the model.
Supports either a list of Content objects (passing a multi-turn conversation)
or a value that can be converted to a single Content object (passing a single message).
Supports
* str, Image, Part,
* List[Union[str, Image, Part]],
* List[Content]
generation_config: Parameters for the generation.
safety_settings: Safety settings as a mapping from HarmCategory to HarmBlockThreshold.
tools: A list of tools (functions) that the model can try calling.
tool_config: Config shared for all tools provided in the request.
labels: Labels that will be passed to billing for cost tracking.
stream: Whether to stream the response.
Returns:
A single GenerationResponse object if stream == False
A stream of GenerationResponse objects if stream == True
- async generate_content_async(self, contents: ContentsType, *, generation_config: Optional[GenerationConfigType] = None, safety_settings: Optional[SafetySettingsType] = None, tools: Optional[List[ForwardRef('Tool')]] = None, tool_config: Optional[ForwardRef('ToolConfig')] = None, labels: Optional[Dict[str, str]] = None, stream: bool = False) -> Union[ForwardRef('GenerationResponse'), AsyncIterable[ForwardRef('GenerationResponse')]]
- Generates content asynchronously.
Args:
contents: Contents to send to the model.
Supports either a list of Content objects (passing a multi-turn conversation)
or a value that can be converted to a single Content object (passing a single message).
Supports
* str, Image, Part,
* List[Union[str, Image, Part]],
* List[Content]
generation_config: Parameters for the generation.
safety_settings: Safety settings as a mapping from HarmCategory to HarmBlockThreshold.
tools: A list of tools (functions) that the model can try calling.
tool_config: Config shared for all tools provided in the request.
labels: Labels that will be passed to billing for cost tracking.
stream: Whether to stream the response.
Returns:
An awaitable for a single GenerationResponse object if stream == False
An awaitable for a stream of GenerationResponse objects if stream == True
- start_chat(self, *, history: Optional[List[ForwardRef('Content')]] = None, response_validation: bool = True) -> 'ChatSession'
- Creates a stateful chat session.
Args:
history: Previous history to initialize the chat session.
response_validation: Whether to validate responses before adding
them to chat history. By default, `send_message` will raise
error if the request or response is blocked or if the response
is incomplete due to going over the max token limit.
If set to `False`, the chat session history will always
accumulate the request and response messages even if the
reponse if blocked or incomplete. This can result in an unusable
chat session state.
Returns:
A ChatSession object.
Data descriptors inherited from vertexai.generative_models._generative_models._GenerativeModel:
- __dict__
- dictionary for instance variables (if defined)
- __weakref__
- list of weak references to the object (if defined)
| |