def embed(embedding_request_dict: dict, index_name: str, device: str = Depends(api_validation.validate_device),
          marqo_config: config.Config = Depends(get_config)):
    """
    Vectorise a piece of content (string or weighted dictionary) or list of content and return the corresponding
    embeddings. Please refer to [Embed API document](https://docs.marqo.ai/latest/reference/api/embed/embed/) for
    details.
    """
    with RequestMetricsStore.for_request().time(f"POST /indexes/{index_name}/embed"):
        # TODO this a temporary fix due to the mixed use of pydantic v1 and v2.
        #  EmbedRequest can be injected after migrated to v2
        embedding_request = parse_request_object(EmbedRequest, embedding_request_dict)

        return marqo_config.embed.embed_content(
            content=embedding_request.content,
            index_name=index_name, device=device,
            media_download_headers=embedding_request.mediaDownloadHeaders,
            model_auth=embedding_request.modelAuth,
            content_type=embedding_request.content_type
        )

    Vectorise a piece of content (string or weighted dictionary) or list of content and return the corresponding
    embeddings. Please refer to [Embed API document](https://docs.marqo.ai/latest/reference/api/embed/embed/) for
    details.
    
src/marqo/tensor_search/api.py