Ai for textual suggestions

Has anyone messed with ai for suggestions in a specific context?

For me it’s in the elements ide for code completion. But I imagine this could easily work in a lot of contexts.

I’m already making suggestions based on past input per type, but wondering if anyone can suggest algorithms to make this smarter.