Embeddings
def insert_dp(dp_id: str, emb: list[float], cat=[])
def upsert_dp(prod_id: str, desc: str, image: str, cat=[])
def remove_dp(dp_id: str)
def delete_dp(prod_id: str)
Invoke Vertex Embedding API.
class EmbeddingResponse(NamedTuple)
class EmbeddingPredictionClient()
Wrapper around Prediction Service Client.
def __init__()
def get_embedding(text: Optional[str] = None,
image: Optional[str] = None,
base64: bool = False)
Invoke Vertex multimodal embedding API.
You can pass text and/or image. If neither is passed will raise exception
Args: text: text to embed image: can be local file path, GCS URI or base64 encoded image base64: True indicates image is base64. False (default) will be interpreted as image path (either local or GCS) Returns: named tuple with the following attributes: text_embedding: 1408 dimension vector of type Sequence[float] image_embedding: 1408 dimension vector of type Sequence[float] OR None if no image provide
@cache
def get_client(project)
def embed(
text: str,
image: Optional[str] = None,
base64: bool = False,
project: str = Config.value("project", "id")
) -> EmbeddingResponse
Invoke vertex multimodal embedding API.
Args: text: text to embed image: can be local file path, GCS URI or base64 encoded image base64: True indicates image is base64. False (default) will be interpreted as image path (either local or GCS) project: GCP Project ID
Returns: named tuple with the following attributes: text_embedding: 1408 dimension vector of type Sequence[float] image_embedding: 1408 dimension vector of type Sequence[float] OR None if no image provide