Added ai function definition