def vectorise_jobs(inference: Inference, jobs: List[VectorisedJobs]) -> Dict[JHash, Dict[str, List[float]]]:
    """ Run inference.vectorise() against each vector jobs."""
    result: Dict[JHash, Dict[str, List[float]]] = dict()
    for v in jobs:
        if not v.content:
            continue
        try:
            inference_request = InferenceRequest(
                modality=v.modality,
                contents=v.content,
                model_config=ModelConfig(
                    model_name=v.model_name,
                    model_properties=v.model_properties,
                    model_auth=v.model_auth,
                    normalize_embeddings=v.normalize_embeddings,
                ),
                device=v.device,
                use_inference_cache=True,
                return_individual_error=False,
                preprocessing_config=_get_preprocessing_config(v.modality, v.media_download_headers),
            )

            inference_result = inference.vectorise(inference_request)

            # Sanity check the response from Inference
            if len(inference_result.result) != len(v.content):
                raise InternalError(f'Inference result contains embeddings for {len(inference_result.result)} '
                                    f'query items, but {len(v.content)} is expected')
            individual_errors = [f'{v.content[index]}: {r.error_message}'
                                 for index, r in enumerate(inference_result.result)
                                 if isinstance(r, InferenceErrorModel)]
            if individual_errors:
                raise InternalError(f'Individual errors returned when vectorising query string: {individual_errors}')
            chunked_contents = [(v.content[index], len(chunks)) for index, chunks in enumerate(inference_result.result)
                                if len(chunks) > 1]
            if chunked_contents:
                raise InternalError(f'Tensor query string should not be chunked but some '
                                    f'query items have multiple chunks: {chunked_contents}')

            # The per_content_result format is [('chunk', np.array())]
            vectors = [per_content_result[0][1].tolist() for per_content_result in inference_result.result]
            result[v.groupby_key()] = dict(zip(v.content, vectors))

        except ModelError as e:
            raise api_exceptions.BadRequestError(
                message=f'Problem vectorising query. Reason: {str(e)}',
                link=marqo_docs.list_of_models()
            ) from e

        except InferenceError as e:
            # TODO: differentiate image processing errors from other types of vectorise errors
            raise api_exceptions.InvalidArgError(message=f'Error vectorising content: {v.content}. '
                                                         f'Message: {e.message}') from e
    return result
 Run inference.vectorise() against each vector jobs.
src/marqo/tensor_search/tensor_search.py