Skip to content

Commit

Permalink
minor edits
Browse files Browse the repository at this point in the history
  • Loading branch information
amaiya committed Apr 3, 2023
1 parent 2336cab commit f687440
Showing 1 changed file with 63 additions and 43 deletions.
106 changes: 63 additions & 43 deletions examples/text/generative_ai_example.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
"cells": [
{
"cell_type": "code",
"execution_count": null,
"execution_count": 1,
"metadata": {},
"outputs": [],
"source": [
Expand All @@ -27,7 +27,7 @@
},
{
"cell_type": "code",
"execution_count": null,
"execution_count": 2,
"metadata": {},
"outputs": [],
"source": [
Expand All @@ -43,7 +43,7 @@
"\n",
"**Tip**: Due to the way the model was trained, you should only use newlines to separate cohesive units of information fed to the model. This is illustrated through various examples below. If the model encounters a misplaced newline character it doesn't like, it may output nothing.\n",
"\n",
"We also caution that the model has no guard rails against producing content that is potentially biased or offensive."
"We also caution that the model has no guard rails against producing content that is potentially biased, offensive, or factually-incorrect."
]
},
{
Expand All @@ -62,7 +62,7 @@
},
{
"cell_type": "code",
"execution_count": null,
"execution_count": 3,
"metadata": {},
"outputs": [
{
Expand Down Expand Up @@ -90,7 +90,7 @@
},
{
"cell_type": "code",
"execution_count": null,
"execution_count": 4,
"metadata": {},
"outputs": [
{
Expand Down Expand Up @@ -141,14 +141,14 @@
},
{
"cell_type": "code",
"execution_count": null,
"execution_count": 5,
"metadata": {},
"outputs": [
{
"name": "stdout",
"output_type": "stream",
"text": [
"Positive\n",
"positive\n",
"\n"
]
}
Expand All @@ -168,7 +168,7 @@
},
{
"cell_type": "code",
"execution_count": null,
"execution_count": 6,
"metadata": {},
"outputs": [
{
Expand Down Expand Up @@ -206,7 +206,7 @@
},
{
"cell_type": "code",
"execution_count": null,
"execution_count": 7,
"metadata": {},
"outputs": [
{
Expand Down Expand Up @@ -239,14 +239,14 @@
},
{
"cell_type": "code",
"execution_count": null,
"execution_count": 8,
"metadata": {},
"outputs": [
{
"name": "stdout",
"output_type": "stream",
"text": [
"After a 20-year war, Trump and Biden's decisions to withdraw American troops from Afghanistan resulted in Kabul falling to the Taliban without resistance.\n",
"After a 20-year war, Trump and Biden's decision to withdraw American troops from Afghanistan resulted in the fall of Kabul to the Taliban, without resistance.\n",
"\n"
]
}
Expand All @@ -266,7 +266,7 @@
},
{
"cell_type": "code",
"execution_count": null,
"execution_count": 10,
"metadata": {},
"outputs": [
{
Expand Down Expand Up @@ -317,14 +317,14 @@
},
{
"cell_type": "code",
"execution_count": null,
"execution_count": 16,
"metadata": {},
"outputs": [
{
"name": "stdout",
"output_type": "stream",
"text": [
"A t-shirt for men, with a message of strength and power at $39.\n",
"A t-shirt for men, with a great design and color options, at $39.\n",
"\n"
]
}
Expand Down Expand Up @@ -356,69 +356,77 @@
"cell_type": "markdown",
"metadata": {},
"source": [
"#### Text Generation"
"#### Tweet Generation"
]
},
{
"cell_type": "code",
"execution_count": null,
"execution_count": 17,
"metadata": {},
"outputs": [
{
"name": "stdout",
"output_type": "stream",
"text": [
"Once upon a time, there was a young scientist named Harold who was working on a grand experiment to control time. He had spent years collecting data and researching the past, in hopes of one day rewriting history. But one day, he stumbled upon a mysterious paper that suggested his experiment was not just possible, but also likely to happen. Harold was determined to find out the truth, and so he decided to embark on a daring adventure full of excitement and possibility. What will happen when Harold attempts to alter the future? Will the changes be for the better or the worse? Time will tell what destiny awaits beneath the stars!\n",
"Climate Change is real and not a distant threat--it's happening now and will only get worse unless we take action.\n",
"\n"
]
}
],
"source": [
"prompt = \"Write a short story about time travel.\"\n",
"print(model.execute(prompt)) "
"prompt = \"\"\"Generate a tweet based on the supplied Keyword. Here are some examples.\n",
"[Keyword]:\n",
"markets\n",
"[Tweet]:\n",
"Take feedback from nature and markets, not from people\n",
"###\n",
"[Keyword]:\n",
"children\n",
"[Tweet]:\n",
"Maybe we die so we can come back as children.\n",
"###\n",
"[Keyword]:\n",
"startups\n",
"[Tweet]: \n",
"Startups should not worry about how to put out fires, they should worry about how to start them.\n",
"###\n",
"[Keyword]:\n",
"climate change\n",
"[Tweet]:\"\"\"\n",
"print(model.execute(prompt))"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"#### Tweet Generation"
"#### Email Generation"
]
},
{
"cell_type": "code",
"execution_count": null,
"execution_count": 27,
"metadata": {},
"outputs": [
{
"name": "stdout",
"output_type": "stream",
"text": [
"Climate change is real and not a distant threat--it's happening now and will affect everyone.\n",
"Dear Tesla Shareholders,\n",
"Dear Tesla investors,\n",
"\n",
"We are delighted to announce that Tesla is releasing its first publicly-traded share, Tesla Inc. We are committed to providing investors with a sustained source of investment income and growing equity value through our shared electric cars, batteries and solar panels. \n",
"\n",
"We are excited to be a part of the global EV (Electric Vehicle) revolution, and look forward to bringing our innovative products to life.\n",
"\n",
"Sincerely, \n",
"Tesla Team\n",
"\n"
]
}
],
"source": [
"prompt = \"\"\"Generate a tweet based on the supplied Keyword. Here are some examples.\n",
"[Keyword]:\n",
"markets\n",
"[Tweet]:\n",
"Take feedback from nature and markets, not from people\n",
"###\n",
"[Keyword]:\n",
"children\n",
"[Tweet]:\n",
"Maybe we die so we can come back as children.\n",
"###\n",
"[Keyword]:\n",
"startups\n",
"[Tweet]: \n",
"Startups should not worry about how to put out fires, they should worry about how to start them.\n",
"###\n",
"[Keyword]:\n",
"climate change\n",
"[Tweet]:\"\"\"\n",
"prompt = \"\"\"Generate an email introducing Tesla to shareholders.\"\"\"\n",
"print(model.execute(prompt))"
]
},
Expand All @@ -440,11 +448,23 @@
],
"metadata": {
"kernelspec": {
"display_name": "python3",
"display_name": "Python 3 (ipykernel)",
"language": "python",
"name": "python3"
},
"language_info": {
"codemirror_mode": {
"name": "ipython",
"version": 3
},
"file_extension": ".py",
"mimetype": "text/x-python",
"name": "python",
"nbconvert_exporter": "python",
"pygments_lexer": "ipython3",
"version": "3.9.16"
}
},
"nbformat": 4,
"nbformat_minor": 2
"nbformat_minor": 4
}

0 comments on commit f687440

Please sign in to comment.