How to import external APIs in Shopify liquid?

I am currently building a Shopify store.

A key aspect is providing Personalized Recommendations on the Shopify store.
For this, we are not looking at using the inbuilt Shopify recommendations - rather through the recommendation APIs from our in-house ML-based Recommendation System.

While I have gone through how Shopify creates the Recommendation carousel, how can I plug in our own APIs to generate the recommendations instead?

Liquid cannot read an API as it’s just a preprocessor to build your document structure. If you wish to use an API like this you should build your HTML structure in liquid and use JS to do the API call and populate it.