Prompt for a QnA more interactive?

I’m trying to create a QnA which does not just provide an answer (or not) for a question and start over, but rather it can maintain a conversation.
Also, since I’m using embeddings, I’d like to have the opportunity to have the question reformulated so that I can go back to the DB and search for more paragraphs.
This is the prompot I tried:

def create_prompt(question, sources, conversation_history):
    return (
        f"Given the following conversation history, question, and source text, "
        f"provide a specific answer using ONLY the source text. If you cannot "
        f"find the answer in the source text, indicate 'yes' in 'more_info_needed' "
        f"and provide a clearer description of the information needed in the "
        f"'info_required' field. Indicate if the user is asking a new question or "
        f"following up on a previous one in 'question_type'. Provide the answer "
        f"in the following JSON format: '{{ 'answer': 'your answer', "
        f"'more_info_needed': 'yes/no', 'info_required': 'specific information "
        f"needed', 'question_type': 'new/follow-up' }}'."
        f"\n\nConversation History: {conversation_history}"
        f"\n\nQuestion: {question}"
        f"\n\nSource Text: {sources}\n\n"
    )

My goal would be, when chatGPT detects it is a new question, I just delete the history as it is needed no longer, however, it should give me the flag to know if the user is trying to follow-up a previous question, and more important, if it is capable of answering. If it is not, then my goal is for it to give me a well formulated query to get to my db again and retrieve more information, using the field “info_required” where I would expect it to give me the question in a better format.

I’m failing to make this work - Is there a better way to construct a logic like this? Am I going overboard with my prompt? :smiley:

Thank you all!