Check OpeanAI's tutorials [1] and cookbook [2]. Or try LangChain [3], which abstracts a lot of the work.
[1] - https://platform.openai.com/docs/tutorials [2] - https://github.com/openai/openai-cookbook [3] - https://github.com/hwchase17/langchain
[1] - https://platform.openai.com/docs/tutorials [2] - https://github.com/openai/openai-cookbook [3] - https://github.com/hwchase17/langchain