pub struct PredictionServiceClient<T> { /* private fields */ }
Expand description

A service for online predictions and explanations.

Implementations§

source§

impl<T> PredictionServiceClient<T>
where T: GrpcService<BoxBody>, T::Error: Into<StdError>, T::ResponseBody: Body<Data = Bytes> + Send + 'static, <T::ResponseBody as Body>::Error: Into<StdError> + Send,

source

pub fn new(inner: T) -> Self

source

pub fn with_origin(inner: T, origin: Uri) -> Self

source

pub fn with_interceptor<F>( inner: T, interceptor: F ) -> PredictionServiceClient<InterceptedService<T, F>>
where F: Interceptor, T::ResponseBody: Default, T: Service<Request<BoxBody>, Response = Response<<T as GrpcService<BoxBody>>::ResponseBody>>, <T as Service<Request<BoxBody>>>::Error: Into<StdError> + Send + Sync,

source

pub fn send_compressed(self, encoding: CompressionEncoding) -> Self

Compress requests with the given encoding.

This requires the server to support it otherwise it might respond with an error.

source

pub fn accept_compressed(self, encoding: CompressionEncoding) -> Self

Enable decompressing responses.

source

pub fn max_decoding_message_size(self, limit: usize) -> Self

Limits the maximum size of a decoded message.

Default: 4MB

source

pub fn max_encoding_message_size(self, limit: usize) -> Self

Limits the maximum size of an encoded message.

Default: usize::MAX

source

pub async fn predict( &mut self, request: impl IntoRequest<PredictRequest> ) -> Result<Response<PredictResponse>, Status>

Perform an online prediction.

source

pub async fn raw_predict( &mut self, request: impl IntoRequest<RawPredictRequest> ) -> Result<Response<HttpBody>, Status>

Perform an online prediction with an arbitrary HTTP payload.

The response includes the following HTTP headers:

  • X-Vertex-AI-Endpoint-Id: ID of the [Endpoint][google.cloud.aiplatform.v1.Endpoint] that served this prediction.

  • X-Vertex-AI-Deployed-Model-Id: ID of the Endpoint’s [DeployedModel][google.cloud.aiplatform.v1.DeployedModel] that served this prediction.

source

pub async fn stream_raw_predict( &mut self, request: impl IntoRequest<StreamRawPredictRequest> ) -> Result<Response<Streaming<HttpBody>>, Status>

Perform a streaming online prediction with an arbitrary HTTP payload.

source

pub async fn direct_predict( &mut self, request: impl IntoRequest<DirectPredictRequest> ) -> Result<Response<DirectPredictResponse>, Status>

Perform an unary online prediction request to a gRPC model server for Vertex first-party products and frameworks.

source

pub async fn direct_raw_predict( &mut self, request: impl IntoRequest<DirectRawPredictRequest> ) -> Result<Response<DirectRawPredictResponse>, Status>

Perform an unary online prediction request to a gRPC model server for custom containers.

source

pub async fn stream_direct_predict( &mut self, request: impl IntoStreamingRequest<Message = StreamDirectPredictRequest> ) -> Result<Response<Streaming<StreamDirectPredictResponse>>, Status>

Perform a streaming online prediction request to a gRPC model server for Vertex first-party products and frameworks.

source

pub async fn stream_direct_raw_predict( &mut self, request: impl IntoStreamingRequest<Message = StreamDirectRawPredictRequest> ) -> Result<Response<Streaming<StreamDirectRawPredictResponse>>, Status>

Perform a streaming online prediction request to a gRPC model server for custom containers.

source

pub async fn streaming_predict( &mut self, request: impl IntoStreamingRequest<Message = StreamingPredictRequest> ) -> Result<Response<Streaming<StreamingPredictResponse>>, Status>

Perform a streaming online prediction request for Vertex first-party products and frameworks.

source

pub async fn server_streaming_predict( &mut self, request: impl IntoRequest<StreamingPredictRequest> ) -> Result<Response<Streaming<StreamingPredictResponse>>, Status>

Perform a server-side streaming online prediction request for Vertex LLM streaming.

source

pub async fn streaming_raw_predict( &mut self, request: impl IntoStreamingRequest<Message = StreamingRawPredictRequest> ) -> Result<Response<Streaming<StreamingRawPredictResponse>>, Status>

Perform a streaming online prediction request through gRPC.

source

pub async fn explain( &mut self, request: impl IntoRequest<ExplainRequest> ) -> Result<Response<ExplainResponse>, Status>

Perform an online explanation.

If [deployed_model_id][google.cloud.aiplatform.v1.ExplainRequest.deployed_model_id] is specified, the corresponding DeployModel must have [explanation_spec][google.cloud.aiplatform.v1.DeployedModel.explanation_spec] populated. If [deployed_model_id][google.cloud.aiplatform.v1.ExplainRequest.deployed_model_id] is not specified, all DeployedModels must have [explanation_spec][google.cloud.aiplatform.v1.DeployedModel.explanation_spec] populated.

source

pub async fn generate_content( &mut self, request: impl IntoRequest<GenerateContentRequest> ) -> Result<Response<GenerateContentResponse>, Status>

Generate content with multimodal inputs.

source

pub async fn stream_generate_content( &mut self, request: impl IntoRequest<GenerateContentRequest> ) -> Result<Response<Streaming<GenerateContentResponse>>, Status>

Generate content with multimodal inputs with streaming support.

Trait Implementations§

source§

impl<T: Clone> Clone for PredictionServiceClient<T>

source§

fn clone(&self) -> PredictionServiceClient<T>

Returns a copy of the value. Read more
1.0.0 · source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
source§

impl<T: Debug> Debug for PredictionServiceClient<T>

source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more

Auto Trait Implementations§

Blanket Implementations§

source§

impl<T> Any for T
where T: 'static + ?Sized,

source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
source§

impl<T> Borrow<T> for T
where T: ?Sized,

source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
source§

impl<T> From<T> for T

source§

fn from(t: T) -> T

Returns the argument unchanged.

§

impl<T> FromRef<T> for T
where T: Clone,

§

fn from_ref(input: &T) -> T

Converts to this type from a reference to the input type.
§

impl<T> Instrument for T

§

fn instrument(self, span: Span) -> Instrumented<Self>

Instruments this type with the provided [Span], returning an Instrumented wrapper. Read more
§

fn in_current_span(self) -> Instrumented<Self>

Instruments this type with the current Span, returning an Instrumented wrapper. Read more
source§

impl<T, U> Into<U> for T
where U: From<T>,

source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

source§

impl<T> IntoRequest<T> for T

source§

fn into_request(self) -> Request<T>

Wrap the input message T in a tonic::Request
source§

impl<T> ToOwned for T
where T: Clone,

§

type Owned = T

The resulting type after obtaining ownership.
source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

§

type Error = Infallible

The type returned in the event of a conversion error.
source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
§

impl<V, T> VZip<V> for T
where V: MultiLane<T>,

§

fn vzip(self) -> V

§

impl<T> WithSubscriber for T

§

fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self>
where S: Into<Dispatch>,

Attaches the provided Subscriber to this type, returning a [WithDispatch] wrapper. Read more
§

fn with_current_subscriber(self) -> WithDispatch<Self>

Attaches the current default Subscriber to this type, returning a [WithDispatch] wrapper. Read more