# import streamlit as st
#
# # @st.cache_resource
# # def init_PE():
# # data = {"Persona Pattern":{"Intuition":"","Format":2,"Examples":3 },
# # "Question Refinement":{"Intuition":,"Format":,"Examples": },
# # "Cognitive Verifier":{"Intuition":,"Format":,"Examples": },
# # "Audience Persona":{"Intuition":,"Format":,"Examples": },
# # "Flipped Interaction":{"Intuition":,"Format":,"Examples": },
# # "Few-Shot Prompting":{"Intuition":,"Format":,"Examples": },
# # "Chain-Of-Thought":{"Intuition":,"Format":,"Examples": },
# # "Reason+Act Prompting":{"Intuition":,"Format":,"Examples": },
# # "Gameplay Pattern":{"Intuition":,"Format":,"Examples": },
# # "Template Pattern":{"Intuition":,"Format":,"Examples": },
# # "Meta Language":{"Intuition":,"Format":,"Examples": },
# # "Alternative Approach":{"Intuition":,"Format":,"Examples": },
# # "Outline Expansion":{"Intuition":,"Format":,"Examples": }}
# st.title("Prompt Engineering Techniques")
# st.markdown(
# """
# Welcome to the prompt engineering section! Here
# we aim to introduce some common techniques used to generate
# consistent outputs from large language models like GPT and LlaMA.
# """
# )
# PE_options = st.multiselect("Select which Prompt Engineering options you are interested in",["Persona Pattern","Question Refinement","Cognitive Verifier",
# "Audience Persona","Flipped Interaction", "Few-Shot Prompting","Chain-Of-Thought",
# "Reason+Act Prompting","Gameplay Pattern","Template Prompting",
# "Meta Language Creation","Recipe Prompting","Alternative Approach",
# "Outline Expansion"])
# c11,c21 = st.columns([1,1])
# with c11:
# st.markdown(
# """
# ### Persona Pattern
# """
# )
# with st.expander("View Explanation and Examples"):
# st.markdown(
# """
# **1. Intuition **
# Tell the LLM to act as a specific person,object or entity and then
# provide them with a relevant task.
# **2. Format **
# "Act as entity X, perform task Y."
# **3. Example**
# "Act as a expert AI Engineer, explain to me how back-propagation works."
# """,
# unsafe_allow_html=True
# )
#
# with c21:
# st.markdown(
# """
# ### Question Refinement
# """
# )
# with st.expander("View Explanation and Examples"):
# st.markdown(
# """
# **1. Intuition **
# To ensure that the LLM can suggest
# potentially better or more refined questions for the user to ask.
# **2. Format **
# "Whenever I ask a question, suggest a
# better question and ask me if I would like to use it instead.
# **3. Example**
# Just enter this prompt into the chat before asking your question
# """,
# unsafe_allow_html=True
#
# )
# c21,c22 = st.columns([1,1])
# with c21:
# st.markdown(
# """
# ### Cognitive Verifier
# """
# )
# with st.expander("View Explanations and Examples"):
# st.markdown(
# """
# **1. Intuition **
# To force the LLM to subdivide the original question
# into multiple questions and use the answers to all those questions to fit into the final answer
# **2. Format **
# "When you are asked a question,follow these rules:
Generate a number of additional questions that would help more accurately answer the question.
# Combine the answers to the individual questions to produce the final answer to the overall question."
# **3. Example**
# Just enter this prompt into the chat before asking your question.
# """,
# unsafe_allow_html=True
# )
#
# with c22:
# st.markdown(
# """
# ### Audience Persona
# """
# )
# with st.expander("View Explanations and Examples"):
# st.markdown(
# """
# **1. Intuition **
# Intuition is for the LLM to know your level of
# expertise so that it can better tailor it's answers to your needs
# **2. Format **
# "Explain X to me. Assume I am persona Y."
# **3. Example**
# "Explain the self-attention mechanism to me.
# Assume I am a beginner with 0 knowledge."
# """,
# unsafe_allow_html=True
# )
#
# c31,c32 = st.columns([1,1])
# with c31:
# st.markdown(
# """
# ### Flipped Interaction
# """
# )
# with st.expander("View Explanations and Examples"):
# st.markdown(
# """
# **1. Intuition **
# For the LLM to be like a diagnoser and ask the
# user questions until a result is met.
# **2. Format **
# "I would like you to ask me questions to help me
# achieve X."
# **3. Example**
# "I would like you to ask me questions to help me create variations of my marketing materials. You should ask questions until you have sufficient information about my
# current draft messages, audience, and goals. Ask me the first question."
# """,
# unsafe_allow_html=True
# )
#
# with c32:
# st.markdown(
# """
# ### Few-Shot Prompting
# """
# )
# with st.expander("View Explanations and Examples"):
# st.markdown(
# """
# **1. Intuition **
# To give the LLM some input and output
# pairs and hopefully it can learn and generate the expected output
# from given input. Very similar to conventional training paradigm minus
# weight updates.
# **2. Format **
# "Input:X, Output: Y"(Simple)
# "Situation:X, Think_1:Y,Action_1:Z,Think_2: A, Action_2: B"(Step by step)
# **3. Example**
# "1. Review: "The film was absolutely fantastic, with a gripping storyline and excellent acting."
# Classification: Positive
2. Review: "I found the movie to be a complete waste of time, with poor plot development and bad acting."
# Classification: Negative"
# """,
# unsafe_allow_html=True
# )
#
# c41,c42 = st.columns([1,1])
#
# with c41:
# st.markdown(
# """
# ### Chain-Of-Thought
# """
# )
# with st.expander("View Explanations and Examples"):
# st.markdown(
# """
# **1. Intuition **
# Similar to few-shot prompting except
# now we provide reasoning for the output as well.
# **2. Format **
# "Question, step by step solution and then solution"
# **3. Example**
# "Solve the following problem step-by-step:
#
# Problem: What is the result of 8 multiplied by 7 plus 6?
#
# Step-by-step solution:
# 1. First, calculate the multiplication: 8 * 7 = 56
# 2. Then, add 6 to the result: 56 + 6 = 62
#
# Answer: 62"
# """,
# unsafe_allow_html=True
# )
#
# with c42:
# st.markdown(
# """
# ### Reason+Act Prompting
# """
# )
# with st.expander("View Explanations and Examples"):
# st.markdown(
# """
# **1. Intuition **
# Very similar to Chain-Of-Thought except now
# we also teach the LLM to use external tools to get information.
# **2. Format **
# "Question,Think,Action,Result"
# **3. Example**
# "**Question:** Aside from the apple remote, what other
# device can control the program apple remote?
# **Task:** I need to find out search Apple Remote and find out the devices it was originally programmed to interact with
# **Action:** Search [Apple Remote](https://en.wikipedia.org/wiki/Apple_Remote_Desktop)
# **Result:** Apple Remote Desktop (ARD) is a Macintosh application produced by Apple Inc., first released on March 14, 2002, that replaced a similar product called Apple Network Assistant"
# """,
# unsafe_allow_html=True
# )
#
# c51,c52 = st.columns([1,1])
# with c51:
# st.markdown(
# """
# ### Gameplay Pattern
# """
# )
# with st.expander("View Explanations and Examples"):
# st.markdown(
# """
# **1. Intuition **
# Imagine you want to learn about a new topic
# , you can format it as a game and play with the LLM.
# **2. Format **
# Create a game about X topic. Describe the rules.
# **3. Example**
# "Create a game about prompt engineering. Ask me a series of questions
# about prompt engineering and see how many I get right. If I get it wrong correct me."
# """,
# unsafe_allow_html=True
# )
#
# with c52:
# st.markdown(
# """
# ### Template Prompting
# """
# )
# with st.expander("View Explanations and Examples"):
# st.markdown(
# """
# **1. Intuition **
# Basically give a template of the output that you want the
# LLM to follow.
# **2. Format **
# Task, template
# **3. Example**
# "Create a random strength workout for me today with complementary exercises. I am going to provide a template for your output . CAPITALIZED WORDS are my placeholders for content. Try to fit the output into one or more of the placeholders that I list.
# Please preserve the formatting and overall template that I provide.
# This is the template: NAME, REPS @ SETS, MUSCLE GROUPS WORKED, DIFFICULTY SCALE 1-5, FORM NOTES"
# """,
# unsafe_allow_html=True
# )
#
# c61,c62 = st.columns([1,1])
#
# with c61:
# st.markdown(
# """
# ### Meta Language Creation
# """
# )
# with st.expander("View Explanations and Examples"):
# st.markdown(
# """
# **1. Intuition **
# Basically teaching the LLM your own
# secret language like when you say X you mean Y.
# **2. Format **
# "When I say X, I mean Y (or would like you to do Y)"
# **3. Example**
# "When I say "variations of companies", I mean give me ten different variations of tech companies"
# """
# )
#
# with c62:
# st.markdown(
# """
# ### Recipe Prompting
# """
# )
# with st.expander("View Explanations and Examples"):
# st.markdown(
# """
# **1. Intuition **
# Asking a question to the LLM and also
# letting it know that there exists intermediate steps required.
# **2. Format **
# I would like to achieve X.
# I know that I need to perform steps A,B,C. Please provide me with the
# necessary steps as well as any missing steps.
# **3. Example**
# "I would like to drive to MBS from Jurong. I know that I want to go through AYR and I don't want to drive more than 300 miles per day.
# Provide a complete sequence of steps for me. Fill in any missing steps."
# """,
# unsafe_allow_html=True
# )
#
# c71,c72 = st.columns([1,1])
#
# with c71:
# st.markdown(
# """
# ### Alternative Approach
# """
# )
# with st.expander("View Explanations and Examples"):
# st.markdown(
# """
# **1. Intuition **
# To allow the LLM to return users
# alternative approaches to solve a problem.
# **2. Format **
# "If there are alternative ways to accomplish a task X that I give you, list the best alternate approaches "
# **3. Example**
# Just input the above prompt before asking your question or task.
# """,
# unsafe_allow_html=True
# )
#
# with c72:
# st.markdown(
# """
# ### Outline Expansion
# """
# )
# with st.expander("View Explanations and Examples"):
# st.markdown(
# """
# **1. Intuition **
# Give the LLM a topic to provide
# an outline on and then proceed to ask it to expand on a certain part.
# **2. Format **
# "Act as an outline expander.
# Generate a bullet point outline based on the input that I give you and then ask me for which bullet point you should expand on.
# Create a new outline for the bullet point that I select.
# At the end, ask me for what bullet point to expand next."
# **3. Example**
# "Act as an outline expander. Generate a bullet point outline based on the input that I give you and then ask me for which bullet point you should expand on. Each bullet can have at most 3-5 sub bullets. The bullets should be numbered using the pattern [A-Z].[i-v].[* through ****]. Create a new outline for the bullet point that I select. At the end, ask me for what bullet point to expand next. Ask me for what to outline."
# """,
# unsafe_allow_html=True
# )
#