@Override
    public Tensor embed(String text, Context context, TensorType type) {
        var start = System.nanoTime();
        if (type.dimensions().size() != 1) {
            throw new IllegalArgumentException("Error in embedding to type '" + type + "': should only have one dimension.");
        }
        if (!type.dimensions().get(0).isIndexed()) {
            throw new IllegalArgumentException("Error in embedding to type '" + type + "': dimension should be indexed.");
        }
        List<Integer> tokens = embedWithSeparatorTokens(text, context, maxTokens);
        runtime.sampleSequenceLength(tokens.size(), context);
        var embedding = embedTokens(tokens, type);
        runtime.sampleEmbeddingLatency((System.nanoTime() - start)/1_000_000d, context);
        return embedding;
    }
A BERT Base compatible embedder. This embedder uses a WordPiece embedder to
produce a token sequence that is then input to a transformer model. A BERT base
compatible transformer model must have three inputs:

 - A token sequence (input_ids)
 - An attention mask (attention_mask)
 - Token types for cross encoding (token_type_ids)

See bert-base-embedder.def for configurable parameters.

@author lesters
model-integration/src/main/java/ai/vespa/embedding/BertBaseEmbedder.java