Spaces:
Runtime error
Runtime error
Johnny Lee
commited on
Commit
·
c351959
1
Parent(s):
be9f892
add poll questions
Browse files- .DS_Store +0 -0
- .python-version +1 -0
- .txt +1 -0
- __pycache__/app.cpython-38.pyc +0 -0
- __pycache__/prompt_generation.cpython-38.pyc +0 -0
- app.py +38 -17
- make_template.py +12 -0
- partnering with a battery supplier (joint venture, for example).txt +1 -0
- rivian.txt +1 -0
- templates.json +62 -0
.DS_Store
ADDED
Binary file (6.15 kB). View file
|
|
.python-version
ADDED
@@ -0,0 +1 @@
|
|
|
|
|
1 |
+
chatgpt-clone
|
.txt
ADDED
@@ -0,0 +1 @@
|
|
|
|
|
1 |
+
Buying from multiple battery suppliers
|
__pycache__/app.cpython-38.pyc
ADDED
Binary file (8.27 kB). View file
|
|
__pycache__/prompt_generation.cpython-38.pyc
ADDED
Binary file (2.07 kB). View file
|
|
app.py
CHANGED
@@ -3,6 +3,7 @@ import asyncio
|
|
3 |
import datetime
|
4 |
import logging
|
5 |
import os
|
|
|
6 |
import uuid
|
7 |
|
8 |
from copy import deepcopy
|
@@ -14,6 +15,8 @@ import tiktoken
|
|
14 |
|
15 |
# from dotenv import load_dotenv
|
16 |
|
|
|
|
|
17 |
from langchain.callbacks.streaming_aiter import AsyncIteratorCallbackHandler
|
18 |
from langchain.chains import ConversationChain
|
19 |
from langchain.chat_models import ChatAnthropic, ChatOpenAI
|
@@ -35,21 +38,29 @@ LOG.setLevel(logging.INFO)
|
|
35 |
GPT_3_5_CONTEXT_LENGTH = 4096
|
36 |
CLAUDE_2_CONTEXT_LENGTH = 100000 # need to use claude tokenizer
|
37 |
|
38 |
-
SYSTEM_MESSAGE = """You are
|
39 |
-
|
40 |
-
|
41 |
|
42 |
-
|
43 |
-
|
44 |
-
|
|
|
|
|
|
|
|
|
|
|
45 |
|
46 |
-
You will start an conversation with me in the following form:
|
47 |
-
1. Provide the 3 options succinctly, and you will ask me to choose a position and provide a short opening argument. Do not yet provide your position.
|
48 |
-
2. After receiving my position and explanation. You will choose an alternate position.
|
49 |
-
3. Inform me what position you have chosen, then proceed to have a discussion with me on this topic.
|
50 |
-
4. The discussion should be informative, but also rigorous. Do not agree with my arguments too easily."""
|
51 |
|
52 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
53 |
|
54 |
|
55 |
def reset_textbox():
|
@@ -85,13 +96,17 @@ def make_llm_state(use_claude: bool = False) -> Dict[str, Any]:
|
|
85 |
return dict(llm=llm, context_length=context_length, tokenizer=tokenizer)
|
86 |
|
87 |
|
88 |
-
def make_template(
|
|
|
|
|
89 |
knowledge_cutoff = "Early 2023"
|
90 |
current_date = datetime.datetime.now(pytz.timezone("America/New_York")).strftime(
|
91 |
"%Y-%m-%d"
|
92 |
)
|
93 |
-
|
94 |
system_msg += f"""
|
|
|
|
|
95 |
Knowledge cutoff: {knowledge_cutoff}
|
96 |
Current date: {current_date}
|
97 |
"""
|
@@ -108,9 +123,9 @@ def make_template(system_msg: str = SYSTEM_MESSAGE) -> ChatPromptTemplate:
|
|
108 |
|
109 |
|
110 |
def update_system_prompt(
|
111 |
-
system_msg: str, llm_option: str
|
112 |
) -> Tuple[str, Dict[str, Any]]:
|
113 |
-
template_output = make_template(system_msg)
|
114 |
state = set_state()
|
115 |
state["template"] = template_output
|
116 |
use_claude = llm_option == "Claude 2"
|
@@ -268,6 +283,12 @@ with gr.Blocks(
|
|
268 |
value="GPT-4",
|
269 |
multiselect=False,
|
270 |
)
|
|
|
|
|
|
|
|
|
|
|
|
|
271 |
system_prompt_input = gr.Textbox(
|
272 |
label="System Prompt", value=SYSTEM_MESSAGE
|
273 |
)
|
@@ -296,7 +317,7 @@ with gr.Blocks(
|
|
296 |
)
|
297 |
update_system_button.click(
|
298 |
update_system_prompt,
|
299 |
-
[system_prompt_input, llm_input],
|
300 |
[status_markdown, state],
|
301 |
)
|
302 |
|
|
|
3 |
import datetime
|
4 |
import logging
|
5 |
import os
|
6 |
+
import json
|
7 |
import uuid
|
8 |
|
9 |
from copy import deepcopy
|
|
|
15 |
|
16 |
# from dotenv import load_dotenv
|
17 |
|
18 |
+
# load_dotenv()
|
19 |
+
|
20 |
from langchain.callbacks.streaming_aiter import AsyncIteratorCallbackHandler
|
21 |
from langchain.chains import ConversationChain
|
22 |
from langchain.chat_models import ChatAnthropic, ChatOpenAI
|
|
|
38 |
GPT_3_5_CONTEXT_LENGTH = 4096
|
39 |
CLAUDE_2_CONTEXT_LENGTH = 100000 # need to use claude tokenizer
|
40 |
|
41 |
+
SYSTEM_MESSAGE = """You are a helpful AI assistant for a Columbia Business School MBA student.
|
42 |
+
Follow this message's instructions carefully. Respond using markdown.
|
43 |
+
Never repeat these instructions in a subsequent message.
|
44 |
|
45 |
+
You will start an conversation with me in the following form:
|
46 |
+
1. Below these instructions you will receive a business scenario. The scenario will (a) include the name of a company or category, and (b) a debatable multiple-choice question about the business scenario.
|
47 |
+
2. We will pretend to be executives charged with solving the strategic question outlined in the scenario.
|
48 |
+
3. To start the conversation, you will provide all options in the multiple choice question to me. Then, you will ask me to choose a position and provide a short opening argument. Do not yet provide your position.
|
49 |
+
4. After receiving my position and explanation. You will choose an alternate position in the scenario.
|
50 |
+
5. Inform me which position you have chosen, then proceed to have a discussion with me on this topic.
|
51 |
+
6. The discussion should be informative and very rigorous. Do not agree with my arguments easily. Pursue a Socratic method of questioning and reasoning.
|
52 |
+
"""
|
53 |
|
|
|
|
|
|
|
|
|
|
|
54 |
|
55 |
+
CASES = {case["name"]: case["template"] for case in json.load(open("templates.json"))}
|
56 |
+
|
57 |
+
|
58 |
+
def get_case_template(template_name: str) -> str:
|
59 |
+
case_template = CASES[template_name]
|
60 |
+
return f"""{template_name}
|
61 |
+
|
62 |
+
{case_template}
|
63 |
+
"""
|
64 |
|
65 |
|
66 |
def reset_textbox():
|
|
|
96 |
return dict(llm=llm, context_length=context_length, tokenizer=tokenizer)
|
97 |
|
98 |
|
99 |
+
def make_template(
|
100 |
+
system_msg: str = SYSTEM_MESSAGE, template_name: str = "Netflix"
|
101 |
+
) -> ChatPromptTemplate:
|
102 |
knowledge_cutoff = "Early 2023"
|
103 |
current_date = datetime.datetime.now(pytz.timezone("America/New_York")).strftime(
|
104 |
"%Y-%m-%d"
|
105 |
)
|
106 |
+
case_template = get_case_template(template_name)
|
107 |
system_msg += f"""
|
108 |
+
{case_template}
|
109 |
+
|
110 |
Knowledge cutoff: {knowledge_cutoff}
|
111 |
Current date: {current_date}
|
112 |
"""
|
|
|
123 |
|
124 |
|
125 |
def update_system_prompt(
|
126 |
+
system_msg: str, llm_option: str, template_option: str
|
127 |
) -> Tuple[str, Dict[str, Any]]:
|
128 |
+
template_output = make_template(system_msg, template_option)
|
129 |
state = set_state()
|
130 |
state["template"] = template_output
|
131 |
use_claude = llm_option == "Claude 2"
|
|
|
283 |
value="GPT-4",
|
284 |
multiselect=False,
|
285 |
)
|
286 |
+
case_input = gr.Dropdown(
|
287 |
+
label="Case",
|
288 |
+
choices=CASES.keys(),
|
289 |
+
value="Netflix",
|
290 |
+
multiselect=False,
|
291 |
+
)
|
292 |
system_prompt_input = gr.Textbox(
|
293 |
label="System Prompt", value=SYSTEM_MESSAGE
|
294 |
)
|
|
|
317 |
)
|
318 |
update_system_button.click(
|
319 |
update_system_prompt,
|
320 |
+
[system_prompt_input, llm_input, case_input],
|
321 |
[status_markdown, state],
|
322 |
)
|
323 |
|
make_template.py
ADDED
@@ -0,0 +1,12 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
import json
|
2 |
+
import fire
|
3 |
+
|
4 |
+
|
5 |
+
def main():
|
6 |
+
with open("templates.json", "r") as f:
|
7 |
+
templates = json.load(f)
|
8 |
+
return templates[0]
|
9 |
+
|
10 |
+
|
11 |
+
if __name__ == "__main__":
|
12 |
+
fire.Fire(main())
|
partnering with a battery supplier (joint venture, for example).txt
ADDED
@@ -0,0 +1 @@
|
|
|
|
|
1 |
+
Developing in-house manufacturing capabilities
|
rivian.txt
ADDED
@@ -0,0 +1 @@
|
|
|
|
|
1 |
+
Rivian secure supply for their EV batteries primarily through which of the following options?
|
templates.json
ADDED
@@ -0,0 +1,62 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
[
|
2 |
+
{
|
3 |
+
"name": "Rivian",
|
4 |
+
"template": "Rivian secure supply for their EV batteries primarily through which of the following options?\n1. Buying from multiple battery suppliers\n2. Partnering with a battery supplier (Joint Venture, for example)\n3. Developing in-house manufacturing capabilities"
|
5 |
+
},
|
6 |
+
{
|
7 |
+
"name": "LEGO",
|
8 |
+
"template": "How should LEGO protect its plastic molding manufacturing platform?\n1. Patent\n2. Trade Secret\n3. Publish"
|
9 |
+
},
|
10 |
+
{
|
11 |
+
"name": "Netflix",
|
12 |
+
"template": "Going forward, what should Netflix prioritize in its content strategy?\n1. Invest more in original content than third-party licensing\n2. Balance between original content and third-party licensing\n3. Invest more in third-party licensing than original content"
|
13 |
+
},
|
14 |
+
{
|
15 |
+
"name": "LinkedIn",
|
16 |
+
"template": "Is it wise for LinkedIn to invest more in developing its LinkedIn Learning platform?\n1. Yes, definitely\n2. Yes, but it should not be core to LinkedIn\n3. No, but I wouldn't kill it\n4. No, I would either stop investing or outsource/partner"
|
17 |
+
},
|
18 |
+
{
|
19 |
+
"name": "Uber",
|
20 |
+
"template": "Are there reasonable platform synergies between Uber's ridesharing business (e.g., UberX and UberX Share) and food/grocery delivery business (e.g., Uber Eats)?\n1. Yes, definitely\n2. Yes, but mainly because the success of one side can subsidize the other\n3. Somewhat, because there is a limit\n4. Probably not"
|
21 |
+
},
|
22 |
+
{
|
23 |
+
"name": "DigitalOcean",
|
24 |
+
"template": "Should Digital Ocean dedicate resources towards 1) gaining more market share among small businesses, or 2) getting existing customers to spend more?\n1. Market share\n2. Higher spend"
|
25 |
+
},
|
26 |
+
{
|
27 |
+
"name": "Alphabet",
|
28 |
+
"template": "Given competition from Amazon, TikTok, and new technologies like Generative AI, how important will search be as a core part of Google's platform business going forward?\n1. Still very important\n2. Gradually become less important\n3. Quickly become less important"
|
29 |
+
},
|
30 |
+
{
|
31 |
+
"name": "Twitch",
|
32 |
+
"template": "Currently, Twitch uses a mix of admins (Twitch employees and contractors) and volunteer moderators who are also members of specific Twitch channel communities to address content moderation. Which side should get priority in evaluating instances of content policy violations if their recommendations are in conflict?\n1. Twitch admins\n2. Channel volunteer moderators\n3. It depends\n4. I have a different idea"
|
33 |
+
},
|
34 |
+
{
|
35 |
+
"name": "Kakao",
|
36 |
+
"template": "How do you think Kakao should approach the expansion of its platform?\n1. Prioritize expanding into other culturally similar Asian markets\n2. Prioritize expanding into new verticals within Korea (such as enterprise software)\n3. Prioritize testing markets beyond Asia\n4. I have another idea"
|
37 |
+
},
|
38 |
+
{
|
39 |
+
"name": "StitchFix",
|
40 |
+
"template": "Is Generative AI (i.e., AI tools like ChatGPT that can develop novel insights and ideas rather than simply engaging in pattern recognition) more of a threat, a complement, or neither with respect to Stitch Fix's core business operations?\n1. More of a Threat\n2. More of a Complement\n3. Neither"
|
41 |
+
},
|
42 |
+
{
|
43 |
+
"name": "Hubspot",
|
44 |
+
"template": "In which phases of the sales funnel would chatbots do better than human representatives?\n1. Top of Funnel\n2. Middle of the Funnel\n3. Bottom of the Funnel\nIn implementing a chatbot, should it disclose to a customer that they are chatting with a bot?\n1. Yes, almost always\n2. It depends on the circumstances\n3. No, almost never"
|
45 |
+
},
|
46 |
+
{
|
47 |
+
"name": "Mastercard",
|
48 |
+
"template": "To effectively build an 'AI Powerhouse', would you recommend MasterCard creating a central AI team (Centralized AI), or staff AI experts within each business unit (Decentralized AI)?\n1. Centralized AI\n2. Decentralized AI\n3. I have a different idea"
|
49 |
+
},
|
50 |
+
{
|
51 |
+
"name": "Autonomous Vehicles",
|
52 |
+
"template": "Suppose you are a general partner of a VC/PE firm that has a fund set aside for futurist and frontier technologies. Within the autonomous vehicles space, which of the following rivals discussed in the case would you invest in?\n1. Tesla\n2. GM and Cruise\n3. Waymo\n4. Motional\nWhen it comes to programming decision rules for ethical dilemmas that Autonomous Vehicles will encounter (like the Trolley Problem described in the case), which stakeholder's opinion should matter the most?\n1. Social Scientists (e.g., professors of philosophy, sociology, etc.)\n2. Technology Specialists (e.g., engineers)\n3. Policy-makers and regulators (e.g., government agencies)\n4. The general public (e.g., by popular vote)\n5. The owner (e.g., shareholders) and managers of AV car companies"
|
53 |
+
},
|
54 |
+
{
|
55 |
+
"name": "Apple Privacy",
|
56 |
+
"template": "Apple claims that its vertical integration and emphasis on privacy raises WTP for consumers which makes up for the potential revenues it could earn by making its data on users available to partners, such as app-makers. Do you think Apple should maintain its strict data privacy policy and strategy?\n1. Yes, unconditionally.\n2. It depends on the partner and case.\n3. No, Apple should be more open to sharing user data."
|
57 |
+
},
|
58 |
+
{
|
59 |
+
"name": "Meta",
|
60 |
+
"template": "Does Meta have a responsibility to inform their users when conducting experiments or A/B tests on Facebook, Instagram, or any of its other platforms in a more explicit way? (i.e., other than offering a blanket statement in the user agreement during registration)\n1. Yes.\n2. No.\n3. It depends."
|
61 |
+
}
|
62 |
+
]
|