From a3f4c1063ea49d95f986f8180b66686065a6d04f Mon Sep 17 00:00:00 2001 From: Sanjeev Jagtap Date: Sat, 25 Mar 2023 17:48:00 -0700 Subject: [PATCH 1/5] Update 4-context-variables-chat.ipynb --- .../dotnet/4-context-variables-chat.ipynb | 155 ++++-------------- 1 file changed, 28 insertions(+), 127 deletions(-) diff --git a/samples/notebooks/dotnet/4-context-variables-chat.ipynb b/samples/notebooks/dotnet/4-context-variables-chat.ipynb index 2b39edf2580f..a8f2127a5398 100644 --- a/samples/notebooks/dotnet/4-context-variables-chat.ipynb +++ b/samples/notebooks/dotnet/4-context-variables-chat.ipynb @@ -3,14 +3,7 @@ { "attachments": {}, "cell_type": "markdown", - "metadata": { - "dotnet_interactive": { - "language": "csharp" - }, - "polyglot_notebook": { - "kernelName": "csharp" - } - }, + "metadata": {}, "source": [ "# Creating a basic chat experience with context variables\n", "\n", @@ -36,7 +29,7 @@ "kernelName": "csharp" }, "vscode": { - "languageId": "csharp" + "languageId": "polyglot-notebook" } }, "outputs": [], @@ -64,14 +57,7 @@ { "attachments": {}, "cell_type": "markdown", - "metadata": { - "dotnet_interactive": { - "language": "csharp" - }, - "polyglot_notebook": { - "kernelName": "csharp" - } - }, + "metadata": {}, "source": [ "Let's define a prompt outlining a dialogue chat bot." ] @@ -87,7 +73,7 @@ "kernelName": "csharp" }, "vscode": { - "languageId": "csharp" + "languageId": "polyglot-notebook" } }, "outputs": [], @@ -114,14 +100,7 @@ { "attachments": {}, "cell_type": "markdown", - "metadata": { - "dotnet_interactive": { - "language": "csharp" - }, - "polyglot_notebook": { - "kernelName": "csharp" - } - }, + "metadata": {}, "source": [ "Register your semantic function" ] @@ -137,7 +116,7 @@ "kernelName": "csharp" }, "vscode": { - "languageId": "csharp" + "languageId": "polyglot-notebook" } }, "outputs": [], @@ -150,14 +129,7 @@ { "attachments": {}, "cell_type": "markdown", - "metadata": { - "dotnet_interactive": { - "language": "csharp" - }, - "polyglot_notebook": { - "kernelName": "csharp" - } - }, + "metadata": {}, "source": [ "Initialize your context" ] @@ -173,7 +145,7 @@ "kernelName": "csharp" }, "vscode": { - "languageId": "csharp" + "languageId": "polyglot-notebook" } }, "outputs": [], @@ -187,14 +159,7 @@ { "attachments": {}, "cell_type": "markdown", - "metadata": { - "dotnet_interactive": { - "language": "csharp" - }, - "polyglot_notebook": { - "kernelName": "csharp" - } - }, + "metadata": {}, "source": [ "Chat with the Bot" ] @@ -210,12 +175,12 @@ "kernelName": "csharp" }, "vscode": { - "languageId": "csharp" + "languageId": "polyglot-notebook" } }, "outputs": [], "source": [ - "var human_input = \"Hi, I'm looking for book suggestions\";\n", + "var human_input = \"Hi, I'm looking for a specific book suggestion.\";\n", "context.Set(\"human_input\", human_input);\n", "\n", "var bot_answer = await kernel.RunAsync(context, chatFunction);" @@ -224,14 +189,7 @@ { "attachments": {}, "cell_type": "markdown", - "metadata": { - "dotnet_interactive": { - "language": "csharp" - }, - "polyglot_notebook": { - "kernelName": "csharp" - } - }, + "metadata": {}, "source": [ "Update the history with the output" ] @@ -247,21 +205,10 @@ "kernelName": "csharp" }, "vscode": { - "languageId": "csharp" + "languageId": "polyglot-notebook" } }, - "outputs": [ - { - "name": "stdout", - "output_type": "stream", - "text": [ - "\n", - "Human: Hi, I'm looking for book suggestions\n", - "Melody: Hi there! What kind of books are you looking for?\n", - "\n" - ] - } - ], + "outputs": [], "source": [ "history += $\"\\nHuman: {human_input}\\nMelody: {bot_answer}\\n\";\n", "context.Update(history);\n", @@ -272,14 +219,7 @@ { "attachments": {}, "cell_type": "markdown", - "metadata": { - "dotnet_interactive": { - "language": "csharp" - }, - "polyglot_notebook": { - "kernelName": "csharp" - } - }, + "metadata": {}, "source": [ "Keep Chatting!" ] @@ -295,7 +235,7 @@ "kernelName": "csharp" }, "vscode": { - "languageId": "csharp" + "languageId": "polyglot-notebook" } }, "outputs": [], @@ -326,20 +266,12 @@ "kernelName": "csharp" }, "vscode": { - "languageId": "csharp" + "languageId": "polyglot-notebook" } }, - "outputs": [ - { - "name": "stdout", - "output_type": "stream", - "text": [ - " You could learn about the ancient Greek gods and goddesses, or the Greek myths and legends. You could also learn about the history of Ancient Greece, including the rise and fall of the great city-states like Athens and Sparta.\n" - ] - } - ], + "outputs": [], "source": [ - "await Chat(\"I love history and philosophy, I'd like to learn something new about Greece, any suggestion?\");" + "await Chat(\"I would like a non-fiction book suggestion about Greece history. Please only list one book.\");" ] }, { @@ -353,20 +285,12 @@ "kernelName": "csharp" }, "vscode": { - "languageId": "csharp" + "languageId": "polyglot-notebook" } }, - "outputs": [ - { - "name": "stdout", - "output_type": "stream", - "text": [ - " The Ancient Greeks believed in a pantheon of gods and goddesses, who were thought to have control over the natural world and human affairs. They also believed in a variety of myths and legends, which were stories about the gods and goddesses and their adventures. Ancient Greek history covers the period from the Bronze Age to the death of Alexander the Great in 323 BC. It includes the rise and fall of the great city-states like Athens and Sparta, the development of democracy, and the growth of the arts and sciences.\n" - ] - } - ], + "outputs": [], "source": [ - "await Chat(\"that sounds interesting, what is it about?\");" + "await Chat(\"that sounds interesting, what are some of the topics I will learn about?\");" ] }, { @@ -380,20 +304,12 @@ "kernelName": "csharp" }, "vscode": { - "languageId": "csharp" + "languageId": "polyglot-notebook" } }, - "outputs": [ - { - "name": "stdout", - "output_type": "stream", - "text": [ - " If you read a book about Ancient Greek history, you will learn about the political, social, and cultural development of Ancient Greece, including the rise and fall of the great city-states, the development of democracy, and the growth of the arts and sciences. You will also learn about the major figures of Ancient Greece, such as Alexander the Great, Socrates, and Plato.\n" - ] - } - ], + "outputs": [], "source": [ - "await Chat(\"if I read that book, what exactly will I learn about Greece history?\");" + "await Chat(\"Which topic from the ones you listed do you think most people find interesting?\");" ] }, { @@ -407,27 +323,12 @@ "kernelName": "csharp" }, "vscode": { - "languageId": "csharp" + "languageId": "polyglot-notebook" } }, - "outputs": [ - { - "name": "stdout", - "output_type": "stream", - "text": [ - " Sure! Here are some other books about Ancient Greek history that you might be interested in:\n", - "\n", - "- The History of the Ancient World: From the Earliest Accounts to the Fall of Rome by Susan Wise Bauer\n", - "- The Landmark Thucydides: A Comprehensive Guide to the Peloponnesian War by Thucydides\n", - "- The Greek Way by Edith Hamilton\n", - "- The History of the Peloponnesian War by Thucydides\n", - "- The Oxford History of Greece and the Hellenistic World by John Boardman\n", - "- The Rise and Fall of Athens: Nine Greek Lives by Plutarch\n" - ] - } - ], + "outputs": [], "source": [ - "await Chat(\"could you list some more books I could read about this topic?\");" + "await Chat(\"could you list some more books I could read about the topic(s) you mentioned?\");" ] } ], From 070bde5ea7d2811a11911b6a9b16757f57b8843f Mon Sep 17 00:00:00 2001 From: Sanjeev Jagtap Date: Sat, 25 Mar 2023 17:52:43 -0700 Subject: [PATCH 2/5] Update 4-context-variables-chat.ipynb --- .../dotnet/4-context-variables-chat.ipynb | 155 ++++++++++++++---- 1 file changed, 127 insertions(+), 28 deletions(-) diff --git a/samples/notebooks/dotnet/4-context-variables-chat.ipynb b/samples/notebooks/dotnet/4-context-variables-chat.ipynb index a8f2127a5398..2b39edf2580f 100644 --- a/samples/notebooks/dotnet/4-context-variables-chat.ipynb +++ b/samples/notebooks/dotnet/4-context-variables-chat.ipynb @@ -3,7 +3,14 @@ { "attachments": {}, "cell_type": "markdown", - "metadata": {}, + "metadata": { + "dotnet_interactive": { + "language": "csharp" + }, + "polyglot_notebook": { + "kernelName": "csharp" + } + }, "source": [ "# Creating a basic chat experience with context variables\n", "\n", @@ -29,7 +36,7 @@ "kernelName": "csharp" }, "vscode": { - "languageId": "polyglot-notebook" + "languageId": "csharp" } }, "outputs": [], @@ -57,7 +64,14 @@ { "attachments": {}, "cell_type": "markdown", - "metadata": {}, + "metadata": { + "dotnet_interactive": { + "language": "csharp" + }, + "polyglot_notebook": { + "kernelName": "csharp" + } + }, "source": [ "Let's define a prompt outlining a dialogue chat bot." ] @@ -73,7 +87,7 @@ "kernelName": "csharp" }, "vscode": { - "languageId": "polyglot-notebook" + "languageId": "csharp" } }, "outputs": [], @@ -100,7 +114,14 @@ { "attachments": {}, "cell_type": "markdown", - "metadata": {}, + "metadata": { + "dotnet_interactive": { + "language": "csharp" + }, + "polyglot_notebook": { + "kernelName": "csharp" + } + }, "source": [ "Register your semantic function" ] @@ -116,7 +137,7 @@ "kernelName": "csharp" }, "vscode": { - "languageId": "polyglot-notebook" + "languageId": "csharp" } }, "outputs": [], @@ -129,7 +150,14 @@ { "attachments": {}, "cell_type": "markdown", - "metadata": {}, + "metadata": { + "dotnet_interactive": { + "language": "csharp" + }, + "polyglot_notebook": { + "kernelName": "csharp" + } + }, "source": [ "Initialize your context" ] @@ -145,7 +173,7 @@ "kernelName": "csharp" }, "vscode": { - "languageId": "polyglot-notebook" + "languageId": "csharp" } }, "outputs": [], @@ -159,7 +187,14 @@ { "attachments": {}, "cell_type": "markdown", - "metadata": {}, + "metadata": { + "dotnet_interactive": { + "language": "csharp" + }, + "polyglot_notebook": { + "kernelName": "csharp" + } + }, "source": [ "Chat with the Bot" ] @@ -175,12 +210,12 @@ "kernelName": "csharp" }, "vscode": { - "languageId": "polyglot-notebook" + "languageId": "csharp" } }, "outputs": [], "source": [ - "var human_input = \"Hi, I'm looking for a specific book suggestion.\";\n", + "var human_input = \"Hi, I'm looking for book suggestions\";\n", "context.Set(\"human_input\", human_input);\n", "\n", "var bot_answer = await kernel.RunAsync(context, chatFunction);" @@ -189,7 +224,14 @@ { "attachments": {}, "cell_type": "markdown", - "metadata": {}, + "metadata": { + "dotnet_interactive": { + "language": "csharp" + }, + "polyglot_notebook": { + "kernelName": "csharp" + } + }, "source": [ "Update the history with the output" ] @@ -205,10 +247,21 @@ "kernelName": "csharp" }, "vscode": { - "languageId": "polyglot-notebook" + "languageId": "csharp" } }, - "outputs": [], + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "\n", + "Human: Hi, I'm looking for book suggestions\n", + "Melody: Hi there! What kind of books are you looking for?\n", + "\n" + ] + } + ], "source": [ "history += $\"\\nHuman: {human_input}\\nMelody: {bot_answer}\\n\";\n", "context.Update(history);\n", @@ -219,7 +272,14 @@ { "attachments": {}, "cell_type": "markdown", - "metadata": {}, + "metadata": { + "dotnet_interactive": { + "language": "csharp" + }, + "polyglot_notebook": { + "kernelName": "csharp" + } + }, "source": [ "Keep Chatting!" ] @@ -235,7 +295,7 @@ "kernelName": "csharp" }, "vscode": { - "languageId": "polyglot-notebook" + "languageId": "csharp" } }, "outputs": [], @@ -266,12 +326,20 @@ "kernelName": "csharp" }, "vscode": { - "languageId": "polyglot-notebook" + "languageId": "csharp" } }, - "outputs": [], + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + " You could learn about the ancient Greek gods and goddesses, or the Greek myths and legends. You could also learn about the history of Ancient Greece, including the rise and fall of the great city-states like Athens and Sparta.\n" + ] + } + ], "source": [ - "await Chat(\"I would like a non-fiction book suggestion about Greece history. Please only list one book.\");" + "await Chat(\"I love history and philosophy, I'd like to learn something new about Greece, any suggestion?\");" ] }, { @@ -285,12 +353,20 @@ "kernelName": "csharp" }, "vscode": { - "languageId": "polyglot-notebook" + "languageId": "csharp" } }, - "outputs": [], + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + " The Ancient Greeks believed in a pantheon of gods and goddesses, who were thought to have control over the natural world and human affairs. They also believed in a variety of myths and legends, which were stories about the gods and goddesses and their adventures. Ancient Greek history covers the period from the Bronze Age to the death of Alexander the Great in 323 BC. It includes the rise and fall of the great city-states like Athens and Sparta, the development of democracy, and the growth of the arts and sciences.\n" + ] + } + ], "source": [ - "await Chat(\"that sounds interesting, what are some of the topics I will learn about?\");" + "await Chat(\"that sounds interesting, what is it about?\");" ] }, { @@ -304,12 +380,20 @@ "kernelName": "csharp" }, "vscode": { - "languageId": "polyglot-notebook" + "languageId": "csharp" } }, - "outputs": [], + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + " If you read a book about Ancient Greek history, you will learn about the political, social, and cultural development of Ancient Greece, including the rise and fall of the great city-states, the development of democracy, and the growth of the arts and sciences. You will also learn about the major figures of Ancient Greece, such as Alexander the Great, Socrates, and Plato.\n" + ] + } + ], "source": [ - "await Chat(\"Which topic from the ones you listed do you think most people find interesting?\");" + "await Chat(\"if I read that book, what exactly will I learn about Greece history?\");" ] }, { @@ -323,12 +407,27 @@ "kernelName": "csharp" }, "vscode": { - "languageId": "polyglot-notebook" + "languageId": "csharp" } }, - "outputs": [], + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + " Sure! Here are some other books about Ancient Greek history that you might be interested in:\n", + "\n", + "- The History of the Ancient World: From the Earliest Accounts to the Fall of Rome by Susan Wise Bauer\n", + "- The Landmark Thucydides: A Comprehensive Guide to the Peloponnesian War by Thucydides\n", + "- The Greek Way by Edith Hamilton\n", + "- The History of the Peloponnesian War by Thucydides\n", + "- The Oxford History of Greece and the Hellenistic World by John Boardman\n", + "- The Rise and Fall of Athens: Nine Greek Lives by Plutarch\n" + ] + } + ], "source": [ - "await Chat(\"could you list some more books I could read about the topic(s) you mentioned?\");" + "await Chat(\"could you list some more books I could read about this topic?\");" ] } ], From 73377249b14e5145dda82524112b42e7b9c1776d Mon Sep 17 00:00:00 2001 From: Sanjeev Jagtap Date: Sat, 25 Mar 2023 18:03:12 -0700 Subject: [PATCH 3/5] Update 4-context-variables-chat.ipynb --- .../dotnet/4-context-variables-chat.ipynb | 153 ++++-------------- 1 file changed, 27 insertions(+), 126 deletions(-) diff --git a/samples/notebooks/dotnet/4-context-variables-chat.ipynb b/samples/notebooks/dotnet/4-context-variables-chat.ipynb index 2b39edf2580f..2a992d391a4e 100644 --- a/samples/notebooks/dotnet/4-context-variables-chat.ipynb +++ b/samples/notebooks/dotnet/4-context-variables-chat.ipynb @@ -3,14 +3,7 @@ { "attachments": {}, "cell_type": "markdown", - "metadata": { - "dotnet_interactive": { - "language": "csharp" - }, - "polyglot_notebook": { - "kernelName": "csharp" - } - }, + "metadata": {}, "source": [ "# Creating a basic chat experience with context variables\n", "\n", @@ -36,7 +29,7 @@ "kernelName": "csharp" }, "vscode": { - "languageId": "csharp" + "languageId": "polyglot-notebook" } }, "outputs": [], @@ -64,14 +57,7 @@ { "attachments": {}, "cell_type": "markdown", - "metadata": { - "dotnet_interactive": { - "language": "csharp" - }, - "polyglot_notebook": { - "kernelName": "csharp" - } - }, + "metadata": {}, "source": [ "Let's define a prompt outlining a dialogue chat bot." ] @@ -87,7 +73,7 @@ "kernelName": "csharp" }, "vscode": { - "languageId": "csharp" + "languageId": "polyglot-notebook" } }, "outputs": [], @@ -114,14 +100,7 @@ { "attachments": {}, "cell_type": "markdown", - "metadata": { - "dotnet_interactive": { - "language": "csharp" - }, - "polyglot_notebook": { - "kernelName": "csharp" - } - }, + "metadata": {}, "source": [ "Register your semantic function" ] @@ -137,7 +116,7 @@ "kernelName": "csharp" }, "vscode": { - "languageId": "csharp" + "languageId": "polyglot-notebook" } }, "outputs": [], @@ -150,14 +129,7 @@ { "attachments": {}, "cell_type": "markdown", - "metadata": { - "dotnet_interactive": { - "language": "csharp" - }, - "polyglot_notebook": { - "kernelName": "csharp" - } - }, + "metadata": {}, "source": [ "Initialize your context" ] @@ -173,7 +145,7 @@ "kernelName": "csharp" }, "vscode": { - "languageId": "csharp" + "languageId": "polyglot-notebook" } }, "outputs": [], @@ -187,14 +159,7 @@ { "attachments": {}, "cell_type": "markdown", - "metadata": { - "dotnet_interactive": { - "language": "csharp" - }, - "polyglot_notebook": { - "kernelName": "csharp" - } - }, + "metadata": {}, "source": [ "Chat with the Bot" ] @@ -210,7 +175,7 @@ "kernelName": "csharp" }, "vscode": { - "languageId": "csharp" + "languageId": "polyglot-notebook" } }, "outputs": [], @@ -224,14 +189,7 @@ { "attachments": {}, "cell_type": "markdown", - "metadata": { - "dotnet_interactive": { - "language": "csharp" - }, - "polyglot_notebook": { - "kernelName": "csharp" - } - }, + "metadata": {}, "source": [ "Update the history with the output" ] @@ -247,21 +205,10 @@ "kernelName": "csharp" }, "vscode": { - "languageId": "csharp" + "languageId": "polyglot-notebook" } }, - "outputs": [ - { - "name": "stdout", - "output_type": "stream", - "text": [ - "\n", - "Human: Hi, I'm looking for book suggestions\n", - "Melody: Hi there! What kind of books are you looking for?\n", - "\n" - ] - } - ], + "outputs": [], "source": [ "history += $\"\\nHuman: {human_input}\\nMelody: {bot_answer}\\n\";\n", "context.Update(history);\n", @@ -272,14 +219,7 @@ { "attachments": {}, "cell_type": "markdown", - "metadata": { - "dotnet_interactive": { - "language": "csharp" - }, - "polyglot_notebook": { - "kernelName": "csharp" - } - }, + "metadata": {}, "source": [ "Keep Chatting!" ] @@ -295,7 +235,7 @@ "kernelName": "csharp" }, "vscode": { - "languageId": "csharp" + "languageId": "polyglot-notebook" } }, "outputs": [], @@ -326,20 +266,12 @@ "kernelName": "csharp" }, "vscode": { - "languageId": "csharp" + "languageId": "polyglot-notebook" } }, - "outputs": [ - { - "name": "stdout", - "output_type": "stream", - "text": [ - " You could learn about the ancient Greek gods and goddesses, or the Greek myths and legends. You could also learn about the history of Ancient Greece, including the rise and fall of the great city-states like Athens and Sparta.\n" - ] - } - ], + "outputs": [], "source": [ - "await Chat(\"I love history and philosophy, I'd like to learn something new about Greece, any suggestion?\");" + "await Chat(\"I would like a non-fiction book suggestion about Greece history. Please only list one book.\");" ] }, { @@ -353,20 +285,12 @@ "kernelName": "csharp" }, "vscode": { - "languageId": "csharp" + "languageId": "polyglot-notebook" } }, - "outputs": [ - { - "name": "stdout", - "output_type": "stream", - "text": [ - " The Ancient Greeks believed in a pantheon of gods and goddesses, who were thought to have control over the natural world and human affairs. They also believed in a variety of myths and legends, which were stories about the gods and goddesses and their adventures. Ancient Greek history covers the period from the Bronze Age to the death of Alexander the Great in 323 BC. It includes the rise and fall of the great city-states like Athens and Sparta, the development of democracy, and the growth of the arts and sciences.\n" - ] - } - ], + "outputs": [], "source": [ - "await Chat(\"that sounds interesting, what is it about?\");" + "await Chat(\"that sounds interesting, what are some of the topics I will learn about?\");" ] }, { @@ -380,20 +304,12 @@ "kernelName": "csharp" }, "vscode": { - "languageId": "csharp" + "languageId": "polyglot-notebook" } }, - "outputs": [ - { - "name": "stdout", - "output_type": "stream", - "text": [ - " If you read a book about Ancient Greek history, you will learn about the political, social, and cultural development of Ancient Greece, including the rise and fall of the great city-states, the development of democracy, and the growth of the arts and sciences. You will also learn about the major figures of Ancient Greece, such as Alexander the Great, Socrates, and Plato.\n" - ] - } - ], + "outputs": [], "source": [ - "await Chat(\"if I read that book, what exactly will I learn about Greece history?\");" + "await Chat(\"Which topic from the ones you listed do you think most people find interesting?\");" ] }, { @@ -407,27 +323,12 @@ "kernelName": "csharp" }, "vscode": { - "languageId": "csharp" + "languageId": "polyglot-notebook" } }, - "outputs": [ - { - "name": "stdout", - "output_type": "stream", - "text": [ - " Sure! Here are some other books about Ancient Greek history that you might be interested in:\n", - "\n", - "- The History of the Ancient World: From the Earliest Accounts to the Fall of Rome by Susan Wise Bauer\n", - "- The Landmark Thucydides: A Comprehensive Guide to the Peloponnesian War by Thucydides\n", - "- The Greek Way by Edith Hamilton\n", - "- The History of the Peloponnesian War by Thucydides\n", - "- The Oxford History of Greece and the Hellenistic World by John Boardman\n", - "- The Rise and Fall of Athens: Nine Greek Lives by Plutarch\n" - ] - } - ], + "outputs": [], "source": [ - "await Chat(\"could you list some more books I could read about this topic?\");" + "await Chat(\"could you list some more books I could read about the topic(s) you mentioned?\");" ] } ], From e4239c3cd104753f3c525e9b9c0e29f63df5d989 Mon Sep 17 00:00:00 2001 From: Sanjeev Jagtap Date: Sat, 25 Mar 2023 18:45:36 -0700 Subject: [PATCH 4/5] Update 4-context-variables-chat.ipynb --- .../dotnet/4-context-variables-chat.ipynb | 153 ++++++++++++++---- 1 file changed, 126 insertions(+), 27 deletions(-) diff --git a/samples/notebooks/dotnet/4-context-variables-chat.ipynb b/samples/notebooks/dotnet/4-context-variables-chat.ipynb index 2a992d391a4e..2b39edf2580f 100644 --- a/samples/notebooks/dotnet/4-context-variables-chat.ipynb +++ b/samples/notebooks/dotnet/4-context-variables-chat.ipynb @@ -3,7 +3,14 @@ { "attachments": {}, "cell_type": "markdown", - "metadata": {}, + "metadata": { + "dotnet_interactive": { + "language": "csharp" + }, + "polyglot_notebook": { + "kernelName": "csharp" + } + }, "source": [ "# Creating a basic chat experience with context variables\n", "\n", @@ -29,7 +36,7 @@ "kernelName": "csharp" }, "vscode": { - "languageId": "polyglot-notebook" + "languageId": "csharp" } }, "outputs": [], @@ -57,7 +64,14 @@ { "attachments": {}, "cell_type": "markdown", - "metadata": {}, + "metadata": { + "dotnet_interactive": { + "language": "csharp" + }, + "polyglot_notebook": { + "kernelName": "csharp" + } + }, "source": [ "Let's define a prompt outlining a dialogue chat bot." ] @@ -73,7 +87,7 @@ "kernelName": "csharp" }, "vscode": { - "languageId": "polyglot-notebook" + "languageId": "csharp" } }, "outputs": [], @@ -100,7 +114,14 @@ { "attachments": {}, "cell_type": "markdown", - "metadata": {}, + "metadata": { + "dotnet_interactive": { + "language": "csharp" + }, + "polyglot_notebook": { + "kernelName": "csharp" + } + }, "source": [ "Register your semantic function" ] @@ -116,7 +137,7 @@ "kernelName": "csharp" }, "vscode": { - "languageId": "polyglot-notebook" + "languageId": "csharp" } }, "outputs": [], @@ -129,7 +150,14 @@ { "attachments": {}, "cell_type": "markdown", - "metadata": {}, + "metadata": { + "dotnet_interactive": { + "language": "csharp" + }, + "polyglot_notebook": { + "kernelName": "csharp" + } + }, "source": [ "Initialize your context" ] @@ -145,7 +173,7 @@ "kernelName": "csharp" }, "vscode": { - "languageId": "polyglot-notebook" + "languageId": "csharp" } }, "outputs": [], @@ -159,7 +187,14 @@ { "attachments": {}, "cell_type": "markdown", - "metadata": {}, + "metadata": { + "dotnet_interactive": { + "language": "csharp" + }, + "polyglot_notebook": { + "kernelName": "csharp" + } + }, "source": [ "Chat with the Bot" ] @@ -175,7 +210,7 @@ "kernelName": "csharp" }, "vscode": { - "languageId": "polyglot-notebook" + "languageId": "csharp" } }, "outputs": [], @@ -189,7 +224,14 @@ { "attachments": {}, "cell_type": "markdown", - "metadata": {}, + "metadata": { + "dotnet_interactive": { + "language": "csharp" + }, + "polyglot_notebook": { + "kernelName": "csharp" + } + }, "source": [ "Update the history with the output" ] @@ -205,10 +247,21 @@ "kernelName": "csharp" }, "vscode": { - "languageId": "polyglot-notebook" + "languageId": "csharp" } }, - "outputs": [], + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "\n", + "Human: Hi, I'm looking for book suggestions\n", + "Melody: Hi there! What kind of books are you looking for?\n", + "\n" + ] + } + ], "source": [ "history += $\"\\nHuman: {human_input}\\nMelody: {bot_answer}\\n\";\n", "context.Update(history);\n", @@ -219,7 +272,14 @@ { "attachments": {}, "cell_type": "markdown", - "metadata": {}, + "metadata": { + "dotnet_interactive": { + "language": "csharp" + }, + "polyglot_notebook": { + "kernelName": "csharp" + } + }, "source": [ "Keep Chatting!" ] @@ -235,7 +295,7 @@ "kernelName": "csharp" }, "vscode": { - "languageId": "polyglot-notebook" + "languageId": "csharp" } }, "outputs": [], @@ -266,12 +326,20 @@ "kernelName": "csharp" }, "vscode": { - "languageId": "polyglot-notebook" + "languageId": "csharp" } }, - "outputs": [], + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + " You could learn about the ancient Greek gods and goddesses, or the Greek myths and legends. You could also learn about the history of Ancient Greece, including the rise and fall of the great city-states like Athens and Sparta.\n" + ] + } + ], "source": [ - "await Chat(\"I would like a non-fiction book suggestion about Greece history. Please only list one book.\");" + "await Chat(\"I love history and philosophy, I'd like to learn something new about Greece, any suggestion?\");" ] }, { @@ -285,12 +353,20 @@ "kernelName": "csharp" }, "vscode": { - "languageId": "polyglot-notebook" + "languageId": "csharp" } }, - "outputs": [], + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + " The Ancient Greeks believed in a pantheon of gods and goddesses, who were thought to have control over the natural world and human affairs. They also believed in a variety of myths and legends, which were stories about the gods and goddesses and their adventures. Ancient Greek history covers the period from the Bronze Age to the death of Alexander the Great in 323 BC. It includes the rise and fall of the great city-states like Athens and Sparta, the development of democracy, and the growth of the arts and sciences.\n" + ] + } + ], "source": [ - "await Chat(\"that sounds interesting, what are some of the topics I will learn about?\");" + "await Chat(\"that sounds interesting, what is it about?\");" ] }, { @@ -304,12 +380,20 @@ "kernelName": "csharp" }, "vscode": { - "languageId": "polyglot-notebook" + "languageId": "csharp" } }, - "outputs": [], + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + " If you read a book about Ancient Greek history, you will learn about the political, social, and cultural development of Ancient Greece, including the rise and fall of the great city-states, the development of democracy, and the growth of the arts and sciences. You will also learn about the major figures of Ancient Greece, such as Alexander the Great, Socrates, and Plato.\n" + ] + } + ], "source": [ - "await Chat(\"Which topic from the ones you listed do you think most people find interesting?\");" + "await Chat(\"if I read that book, what exactly will I learn about Greece history?\");" ] }, { @@ -323,12 +407,27 @@ "kernelName": "csharp" }, "vscode": { - "languageId": "polyglot-notebook" + "languageId": "csharp" } }, - "outputs": [], + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + " Sure! Here are some other books about Ancient Greek history that you might be interested in:\n", + "\n", + "- The History of the Ancient World: From the Earliest Accounts to the Fall of Rome by Susan Wise Bauer\n", + "- The Landmark Thucydides: A Comprehensive Guide to the Peloponnesian War by Thucydides\n", + "- The Greek Way by Edith Hamilton\n", + "- The History of the Peloponnesian War by Thucydides\n", + "- The Oxford History of Greece and the Hellenistic World by John Boardman\n", + "- The Rise and Fall of Athens: Nine Greek Lives by Plutarch\n" + ] + } + ], "source": [ - "await Chat(\"could you list some more books I could read about the topic(s) you mentioned?\");" + "await Chat(\"could you list some more books I could read about this topic?\");" ] } ], From d05599d7e9ea51b0faedc69f84c3a3939940d392 Mon Sep 17 00:00:00 2001 From: Sanjeev Jagtap Date: Sat, 25 Mar 2023 18:51:04 -0700 Subject: [PATCH 5/5] Update 4-context-variables-chat.ipynb --- samples/notebooks/dotnet/4-context-variables-chat.ipynb | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/samples/notebooks/dotnet/4-context-variables-chat.ipynb b/samples/notebooks/dotnet/4-context-variables-chat.ipynb index 2b39edf2580f..9f398abe4623 100644 --- a/samples/notebooks/dotnet/4-context-variables-chat.ipynb +++ b/samples/notebooks/dotnet/4-context-variables-chat.ipynb @@ -339,7 +339,7 @@ } ], "source": [ - "await Chat(\"I love history and philosophy, I'd like to learn something new about Greece, any suggestion?\");" + "await Chat(\"I would like a non-fiction book suggestion about Greece history. Please only list one book.\");" ] }, { @@ -366,7 +366,7 @@ } ], "source": [ - "await Chat(\"that sounds interesting, what is it about?\");" + "await Chat(\"that sounds interesting, what are some of the topics I will learn about?\");" ] }, { @@ -393,7 +393,7 @@ } ], "source": [ - "await Chat(\"if I read that book, what exactly will I learn about Greece history?\");" + "await Chat(\"Which topic from the ones you listed do you think most people find interesting?\");" ] }, { @@ -427,7 +427,7 @@ } ], "source": [ - "await Chat(\"could you list some more books I could read about this topic?\");" + "await Chat(\"could you list some more books I could read about the topic(s) you mentioned?\");" ] } ],