def vectorise(request: Request, raw_body: bytes = Body(...), config: Config = Depends(get_config)):
    """
    Vectorise a list of contents (str) in a given modality, using the model specified in the request.
    This endpoint expect the reqeust to be encoded in `application/msgpack` media type, and returns the
    result (including errors) in the same media type.
    """
    _check_content_type_msgpack(request)

    # Convert request to InferenceRequest
    try:
        request_data = msgpack.unpackb(raw_body, raw=False)
        inference_request = InferenceRequest.parse_obj(request_data)
    except (msgpack.ExtraData, msgpack.UnpackException) as e:
        raise HTTPException(
            status_code=status.HTTP_400_BAD_REQUEST,
            detail=f"Invalid MessagePack format: {str(e)}"
        ) from e
    except ValidationError as e:
        raise HTTPException(
            status_code=status.HTTP_422_UNPROCESSABLE_ENTITY,
            detail=e.errors()
        ) from e

    # Generate embeddings
    try:
        result = config.local_inference.vectorise(inference_request)
    except InferenceError as e:
        # TODO distinguish recoverable error from unrecoverable error, return different error code
        raise HTTPException(
            status_code=status.HTTP_400_BAD_REQUEST,
            detail=f"An error occurred during vectorisation. {e.message}"
        ) from e
    except Exception as e:
        raise HTTPException(
            status_code=status.HTTP_500_INTERNAL_SERVER_ERROR,
            detail=f"An error occurred during vectorisation. {str(e)}"
        ) from e

    # Converts result to response
    # Serialize the result to a dict and then encode it using MessagePack (with numpy support)
    # TODO if telemetry is set to true, we will need to attach the telemetry data
    result_msgpack = msgpack.packb(result.dict(), use_bin_type=True)
    return Response(content=result_msgpack, media_type="application/msgpack")

    Vectorise a list of contents (str) in a given modality, using the model specified in the request.
    This endpoint expect the reqeust to be encoded in `application/msgpack` media type, and returns the
    result (including errors) in the same media type.
    
src/marqo/inference/native_inference/remote/server/inference_api.py