Custom Knowledge base chat (AI) + API (something like ChatPdf or Chatbase) - eviltoast

Are there any options to host a local ai and communicate with an api?

I want to chat with my custom knowledge base.