Create a chat API connection

I can’t manage to connect my project to my chatbot with api. I don’t want my chatbot to retrieve answers from OpenAI apis but from my own documents that I put into the chatbot.