Look into Retrieval Augmented Generation (RAG) or Grounded Generation. Two terms that should get you where you’re aiming, if by AI you’re talking about LLMs like GPT-4, Claude2, or Llama2.
There are some good libraries out there for this. I personally like llmware (https://github.com/llmware-ai/llmware ) but you could use something like Vectara (closed source) if you just want something that works pretty well and that you can call with an API right off the shelf.