I am not very knowledgeable when it comes to AI, but I'm pretty sure right now it's impossible to have one on-chain for two reasons. First, it would be too computationally heavy, so the current CPU and transactions size limits would be reached. Second, there are no modules that allow this on-chain.
Plutus has a very limited number of types and functions allowed inside the on-chain validator, which certainly doesn't include tensor-flow or any AI related libraries.
Personally, I don't know how Singularity Net is doing, but I suppose they are doing this work off-chain and using oracles to communicate the results on-chain.
If you want to learn about oracles and how to deploy plutus smart-contracts, the best resource right now is the Plutus Pioneers Program. The third cohort already started, but you can watch the lectures on youtube and do the homework cloning the github repository.