Can I run a custom function that contains a trained ML model or access an API endpoint from within a SQL query in the SQL workspace?

Erik_S
New Contributor II

I have a dashboard and I'd like the ability to take the data from a query and then predict a result from a trained ML model within the dashboard. I was thinking I could possibly embed the trained model within a library that I then import to the SQL workspace and create a function to access it, or put it behind an API that a query could then access. However, I can't find documentation on either of these use cases so I'm not sure if it's possible.

If it were a linear model I could save it as a table, but I want to have access to other models.

Other ideas are welcome!