Use 1D array from Keras Input as index for a list

I have the following list of Encoders:

fam_specific_enc = [
    Encoder(num_layers=1, 
            num_heads=num_heads_enc, 
            hidden_dim=dense_dim_enc/2,
            dropout_rate=drop_enc,
            name=f"enc_{fam}")
    for fam in range(vocab_size_fam_lang)
]

I have the following input layer in my model:

lang_fam_input = keras.Input(
    shape=(1), dtype="int64", name="fam_lang"
)

I want to call a specific encoder from the list above by using a value in lang_fam_input, as it’s basically a list of integers, so it should ideally look something like this: fam_specific_enc[lang_fam_input](x). But this obviously does not work and I can’t transform KerasTensor to integer value either.