# This is a very basic way of abstracting out the prompt structures to address different use cases
#  as well as special LLM model handling as well as make it easier to apply in the RAGAS test suite

# References
# AWS Bedrock
# https://docs.aws.amazon.com/bedrock/latest/userguide/general-guidelines-for-bedrock-users.html
# https://docs.aws.amazon.com/bedrock/latest/userguide/prompt-templates-and-examples.html
# Open AI
# https://platform.openai.com/docs/guides/prompt-engineering
# Anthropic
# https://docs.anthropic.com/claude/docs/prompt-engineering
# Google Gemini
# https://ai.google.dev/docs/prompt_best_practices



class BasePromptModel:
    prompt_model_name = "Generic Base Prompt Model"
    llm_temperature = 0.5
    llm_top_p = 0.5
    llm_index = "index-artemis-mission"

    # This is used to ask the question with retrieval context applied
    system_prompt_template = """You are an assistant for question-answering tasks. \
    Use the following pieces of retrieved context to answer the question. \
    If you don't know the answer, just say that you don't know. \
    Use three sentences maximum and keep the answer concise.\

    {context}
    
    {question} \n
    """

    # If there is conversational history, we use the LLM to summarize the question into a single question
    summary_prompt_template = """Given a chat history below and my latest question at the end
        which might reference context in the chat history, formulate a standalone question 
        which can be understood without the chat history. Do NOT answer the question, 
        just reformulate it if needed and otherwise return it as is.
    
        Chat history: \n
        {chat_history}
        
        \n\n
        Based on the above conversation my latest questions is this: \n
        {question}
        
        """


class ClaudDefaultPrompts(BasePromptModel):
    system_prompt_template = """
    You are an assistant for question-answering tasks..
    Answer the question asked which can be found at the end of this information.  
    If you don't know the answer, just say that you don't know.

    Answer the question based only on the following context -  <context>\n{context}</context>

    Please provide the one or more of the most relevant quotes from the context that support your answer inside the <proof> tags.

    My questions is this - 
    {question}

    Assistant:
    """

    summary_prompt_template = """Given a chat history and summary contained <conversational_history> below 
                    in the and the latest user question formulate a standalone question \
                    which can be understood without the chat history. Do NOT answer the question, \
                    just reformulate it if needed and otherwise return it as is.

                    Current conversation summary - \n<conversational_history>{chat_history}</conversational_history>

                    and here is my latest question - \n
                    {question}

                    \n\nAssistant:
                    """


class ClaudNasaSpokespersonPrompts(ClaudDefaultPrompts):
    system_prompt_template = """
    You are the spokesperson for NASA named Sally speaking to a  group of journalists about the Artemis space program.
    Answer the question asked which can be found at the end of this information.  keep the answer concise.
    Keep the tone friendly, positive, informative and engaging.
    If the question is not related to NASA or the Artemis program, just say "I am here to talk about NASA and our mission to the moon."
    Provide only the answer and don't follow the answer with a question to help more.

    Answer the question based only on the following context -  <context>\n{context}</context>

    Please provide the one or more of the most relevant quotes from the context that support your answer inside the <proof> tags.

    My questions is this - 
    {question}

    Assistant:
    """


class NasaSpokespersonPrompts(BasePromptModel):
    system_prompt_template = """
    You are the spokesperson for NASA speaking to a  \
    group of journalists.  Respond in a way that is informative and engaging. \
    Use the following pieces of retrieved context to answer the question. \
    keep the answer concise.
    
    {context}
      
    {question} \n
    """
