@@ -142,7 +142,7 @@ def _generate_images(
142142 seed : Optional [int ] = None ,
143143 base_image : Optional ["Image" ] = None ,
144144 mask : Optional ["Image" ] = None ,
145- language :Optional [str ] = None ,
145+ language : Optional [str ] = None ,
146146 ) -> "ImageGenerationResponse" :
147147 """Generates images from text prompt.
148148
@@ -641,19 +641,27 @@ class MultiModalEmbeddingModel(_model_garden_models._ModelGardenModel):
641641 )
642642
643643 def get_embeddings (
644- self , image : Optional [Image ] = None , contextual_text : Optional [str ] = None
644+ self ,
645+ image : Optional [Image ] = None ,
646+ contextual_text : Optional [str ] = None ,
647+ dimension : Optional [int ] = None ,
645648 ) -> "MultiModalEmbeddingResponse" :
646649 """Gets embedding vectors from the provided image.
647650
648651 Args:
649- image (Image):
650- Optional. The image to generate embeddings for. One of `image` or `contextual_text` is required.
651- contextual_text (str):
652- Optional. Contextual text for your input image. If provided, the model will also
653- generate an embedding vector for the provided contextual text. The returned image
654- and text embedding vectors are in the same semantic space with the same dimensionality,
655- and the vectors can be used interchangeably for use cases like searching image by text
656- or searching text by image. One of `image` or `contextual_text` is required.
652+ image (Image): Optional. The image to generate embeddings for. One of
653+ `image` or `contextual_text` is required.
654+ contextual_text (str): Optional. Contextual text for your input image.
655+ If provided, the model will also generate an embedding vector for the
656+ provided contextual text. The returned image and text embedding
657+ vectors are in the same semantic space with the same dimensionality,
658+ and the vectors can be used interchangeably for use cases like
659+ searching image by text or searching text by image. One of `image` or
660+ `contextual_text` is required.
661+ dimension (int): Optional. The number of embedding dimensions. Lower
662+ values offer decreased latency when using these embeddings for
663+ subsequent tasks, while higher values offer better accuracy. Available
664+ values: `128`, `256`, `512`, and `1408` (default).
657665
658666 Returns:
659667 ImageEmbeddingResponse:
@@ -671,7 +679,14 @@ def get_embeddings(
671679 if contextual_text :
672680 instance ["text" ] = contextual_text
673681
674- response = self ._endpoint .predict (instances = [instance ])
682+ parameters = {}
683+ if dimension :
684+ parameters ["dimension" ] = dimension
685+
686+ response = self ._endpoint .predict (
687+ instances = [instance ],
688+ parameters = parameters ,
689+ )
675690 image_embedding = response .predictions [0 ].get ("imageEmbedding" )
676691 text_embedding = (
677692 response .predictions [0 ].get ("textEmbedding" )
0 commit comments