It's not. There's nothing "intelligent" about AI. It's an aggregator (ergo the search engine), nothing more.
If it stores results from previous searches (topics, questions) it can respond faster - like caching previous searches on a computer.
At least that's my understanding of the animal.
A lion is dumb—but it is smart enough to eat you in the wild.
That is why you should be terrified of AI.
Don't forget the thousands of Indian "programmers" who are modifying it in real time as needed.
AI Chatbot Turns Out to Be 700 Engineers in India:
https://tech.co/news/ai-startup-chatbot-revealed-as-human-engineers
You are close to the target. I took my first programming course in 1960. Developed millions of lines of code to create expert heavy machinery design and computer controlled manufacturing of complex shapes. Computers have zero intelligence. They are amazing at following programmed instructions and have wonderful memory.