Skip to content

Commit

Permalink
updated examples
Browse files Browse the repository at this point in the history
  • Loading branch information
haesleinhuepf committed Dec 8, 2023
1 parent e4be16d commit fd1aa64
Show file tree
Hide file tree
Showing 2 changed files with 70 additions and 1 deletion.
File renamed without changes.
71 changes: 70 additions & 1 deletion 01_prompts/03_prompt_engineering.ipynb
Original file line number Diff line number Diff line change
@@ -1,5 +1,17 @@
{
"cells": [
{
"cell_type": "markdown",
"id": "5fb1cd17-f320-4f59-a0e7-28fd1acd59c8",
"metadata": {},
"source": [
"# Primpt Engineering\n",
"\n",
"In this notebook we learn how prompts can be designed to carefully modify the output format. \n",
"The more precisely we formulate the desired output, the closer this output will be to our expectation.\n",
"The act of making the prompt more precise can be coined \"prompt engineering\"."
]
},
{
"cell_type": "code",
"execution_count": 1,
Expand All @@ -13,6 +25,14 @@
"from IPython.display import display, Markdown"
]
},
{
"cell_type": "markdown",
"id": "c5a5737e-44af-4317-a18a-f40710f921b0",
"metadata": {},
"source": [
"We define a helper function and jupyter magic so that we can easily prompt further down in the notebook."
]
},
{
"cell_type": "code",
"execution_count": 2,
Expand All @@ -35,6 +55,14 @@
" display(Markdown(text))"
]
},
{
"cell_type": "markdown",
"id": "cf47989d-d12f-4530-8e88-38c06113cbef",
"metadata": {},
"source": [
"First let's ask for a simple task."
]
},
{
"cell_type": "code",
"execution_count": 3,
Expand Down Expand Up @@ -84,6 +112,14 @@
"* Plan to finish writing a month before the deadline to give time to read it and provide feedback."
]
},
{
"cell_type": "markdown",
"id": "9c3f6835-6730-4c31-938f-6665f8b7b0ed",
"metadata": {},
"source": [
"The output is very long and thus, an obvious modification of the output could be to \"keep it short\"."
]
},
{
"cell_type": "code",
"execution_count": 4,
Expand Down Expand Up @@ -123,6 +159,14 @@
"* Plan to finish writing a month before the deadline to give time to read it and provide feedback."
]
},
{
"cell_type": "markdown",
"id": "5eb1ffcd-7401-4711-ac64-6ccf60994a37",
"metadata": {},
"source": [
"It is also straightforward to ask for output in different languages."
]
},
{
"cell_type": "code",
"execution_count": 5,
Expand Down Expand Up @@ -157,6 +201,14 @@
"* Plan to finish writing a month before the deadline to give time to read it and provide feedback."
]
},
{
"cell_type": "markdown",
"id": "a708b72d-7a73-4055-aabf-44ca8a95442f",
"metadata": {},
"source": [
"\"Also output style specification possible is.\", Yoda said."
]
},
{
"cell_type": "code",
"execution_count": 6,
Expand Down Expand Up @@ -194,6 +246,14 @@
"* Plan to finish writing a month before the deadline to give time to read it and provide feedback."
]
},
{
"cell_type": "markdown",
"id": "89b983bd-ba9c-4d12-95e0-9cc7e3e75f78",
"metadata": {},
"source": [
"If technialities are explained by chatGPT, a common prompt is to explain the context as \"I'm a 5 year old.\""
]
},
{
"cell_type": "code",
"execution_count": 8,
Expand Down Expand Up @@ -233,10 +293,19 @@
"* Plan to finish writing a month before the deadline to give time to read it and provide feedback."
]
},
{
"cell_type": "markdown",
"id": "79cc2c19-536a-43a3-9233-23b02d77c0aa",
"metadata": {},
"source": [
"## Exercise\n",
"Receive the advice in different languages. Also consider languages such as Klingon."
]
},
{
"cell_type": "code",
"execution_count": null,
"id": "77657a00-6cf6-4b25-aedb-8ed33cc595a8",
"id": "d79a98bf-56e0-43de-b3e8-d5ab1ca4b883",
"metadata": {},
"outputs": [],
"source": []
Expand Down

0 comments on commit fd1aa64

Please sign in to comment.