pub struct ImageHandler {
pub config: Config,
pub gcs: GcsClient,
pub http: Client,
pub auth: AuthProvider,
}Expand description
Image generation handler.
Handles image generation requests using the Vertex AI Imagen API.
Fields§
§config: ConfigApplication configuration.
gcs: GcsClientGCS client for storage operations.
http: ClientHTTP client for API requests.
auth: AuthProviderAuthentication provider.
Implementations§
Source§impl ImageHandler
impl ImageHandler
Sourcepub async fn new(config: Config) -> Result<Self, Error>
pub async fn new(config: Config) -> Result<Self, Error>
Create a new ImageHandler with the given configuration.
§Errors
Returns an error if GCS client or auth provider initialization fails.
Sourcepub fn get_endpoint(&self, model: &str) -> String
pub fn get_endpoint(&self, model: &str) -> String
Get the Vertex AI Imagen API endpoint for the given model.
Sourcepub async fn generate_image(
&self,
params: ImageGenerateParams,
) -> Result<ImageGenerateResult, Error>
pub async fn generate_image( &self, params: ImageGenerateParams, ) -> Result<ImageGenerateResult, Error>
Sourcepub async fn upscale_image(
&self,
params: ImageUpscaleParams,
) -> Result<ImageUpscaleResult, Error>
pub async fn upscale_image( &self, params: ImageUpscaleParams, ) -> Result<ImageUpscaleResult, Error>
Sourcepub fn get_upscale_endpoint(&self) -> String
pub fn get_upscale_endpoint(&self) -> String
Get the Vertex AI Imagen Upscale API endpoint.
Auto Trait Implementations§
impl Freeze for ImageHandler
impl !RefUnwindSafe for ImageHandler
impl Send for ImageHandler
impl Sync for ImageHandler
impl Unpin for ImageHandler
impl UnsafeUnpin for ImageHandler
impl !UnwindSafe for ImageHandler
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more
Source§impl<T> FutureExt for T
impl<T> FutureExt for T
Source§fn with_context(self, otel_cx: Context) -> WithContext<Self>
fn with_context(self, otel_cx: Context) -> WithContext<Self>
Source§fn with_current_context(self) -> WithContext<Self>
fn with_current_context(self) -> WithContext<Self>
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
Source§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
Source§impl<T> IntoRequest<T> for T
impl<T> IntoRequest<T> for T
Source§fn into_request(self) -> Request<T>
fn into_request(self) -> Request<T>
Wrap the input message
T in a tonic::Request