Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update AI notebooks and broken data #26

Draft
wants to merge 1 commit into
base: main
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 5 additions & 5 deletions .devcontainer/ai/Dockerfile
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
FROM mcr.microsoft.com/dotnet/sdk:7.0
RUN wget https://packages.microsoft.com/config/debian/11/packages-microsoft-prod.deb -O packages-microsoft-prod.deb
RUN dpkg -i packages-microsoft-prod.deb
RUN rm packages-microsoft-prod.deb
RUN apt update && apt upgrade -y && apt install unzip curl dotnet-sdk-6.0 -y
FROM mcr.microsoft.com/dotnet/sdk:8.0
# RUN wget https://packages.microsoft.com/config/debian/11/packages-microsoft-prod.deb -O packages-microsoft-prod.deb
# RUN dpkg -i packages-microsoft-prod.deb
# RUN rm packages-microsoft-prod.deb
# RUN apt update && apt upgrade -y && apt install unzip curl dotnet-sdk-8.0 -y
RUN dotnet tool install -g mlnet-linux-x64
ENV PATH="$PATH:/root/.dotnet/tools"
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
},
{
"cell_type": "code",
"execution_count": 1,
"execution_count": 3,
"metadata": {
"dotnet_interactive": {
"language": "csharp"
Expand All @@ -29,21 +29,21 @@
{
"data": {
"text/html": [
"<div><div></div><div></div><div><strong>Installed Packages</strong><ul><li><span>Azure.AI.OpenAI, 1.0.0-beta.6</span></li><li><span>Microsoft.DotNet.Interactive, 1.0.0-beta.23313.2</span></li></ul></div></div>"
"<div><div></div><div></div><div><strong>Installed Packages</strong><ul><li><span>Azure.AI.OpenAI, 1.0.0-beta.15</span></li><li><span>Microsoft.DotNet.Interactive, 1.0.0-beta.24164.1</span></li></ul></div></div>"
]
},
"metadata": {},
"output_type": "display_data"
}
],
"source": [
"#r \"nuget: Azure.AI.OpenAI, 1.0.0-beta.6\"\n",
"#r \"nuget: Microsoft.DotNet.Interactive, 1.0.0-beta.23313.2\""
"#r \"nuget: Azure.AI.OpenAI, 1.0.0-beta.15\"\n",
"#r \"nuget: Microsoft.DotNet.Interactive, 1.0.0-beta.24164.1\""
]
},
{
"cell_type": "code",
"execution_count": 2,
"execution_count": 4,
"metadata": {
"dotnet_interactive": {
"language": "csharp"
Expand All @@ -68,7 +68,7 @@
},
{
"cell_type": "code",
"execution_count": 3,
"execution_count": 5,
"metadata": {
"dotnet_interactive": {
"language": "csharp"
Expand All @@ -93,7 +93,7 @@
},
{
"cell_type": "code",
"execution_count": 4,
"execution_count": 6,
"metadata": {
"dotnet_interactive": {
"language": "csharp"
Expand All @@ -116,7 +116,7 @@
},
{
"cell_type": "code",
"execution_count": 5,
"execution_count": 7,
"metadata": {
"dotnet_interactive": {
"language": "csharp"
Expand Down Expand Up @@ -147,7 +147,7 @@
},
{
"cell_type": "code",
"execution_count": 6,
"execution_count": 14,
"metadata": {
"dotnet_interactive": {
"language": "csharp"
Expand All @@ -160,6 +160,7 @@
"source": [
"var options = new ChatCompletionsOptions\n",
"{\n",
" DeploymentName=deploymentId,\n",
" MaxTokens=400,\n",
" Temperature=1f,\n",
" FrequencyPenalty=0.0f,\n",
Expand All @@ -177,7 +178,7 @@
},
{
"cell_type": "code",
"execution_count": 7,
"execution_count": 15,
"metadata": {
"dotnet_interactive": {
"language": "csharp"
Expand All @@ -188,7 +189,7 @@
},
"outputs": [],
"source": [
"options.Messages.Add(new ChatMessage(ChatRole.System, systemPrompt));"
"options.Messages.Add(new ChatRequestSystemMessage(systemPrompt));"
]
},
{
Expand All @@ -200,7 +201,7 @@
},
{
"cell_type": "code",
"execution_count": 8,
"execution_count": 16,
"metadata": {
"dotnet_interactive": {
"language": "csharp"
Expand All @@ -216,7 +217,7 @@
},
{
"cell_type": "code",
"execution_count": 9,
"execution_count": 17,
"metadata": {
"dotnet_interactive": {
"language": "csharp"
Expand All @@ -236,30 +237,41 @@
"2. What hiking intensity they are looking for\n",
"\n",
"You will then provide three suggestions for nearby hikes that vary in length after you get that information. You will also share an interesting fact about the local nature on the hikes when making a recommendation.\n",
"User: Hi\n",
"Assistant: Hello there! My name is [Your Name], and I'm here to help you find some fun hikes in your area. Before we get started, can you please let me know where you are located and what hiking intensity you are looking for?\n",
"User: I want to hike in the Hudson Valley\n",
"Assistant: Great choice! The Hudson Valley is known for its beautiful scenery and great hiking trails. Can you please let me know what kind of hiking intensity you are looking for? Are you looking for something easy, moderate or strenuous?\n",
"User: Easy\n",
"Assistant: Sure thing! Here are three nearby hikes in the Hudson Valley that I think you might enjoy:\n",
"\n",
"1. Poet's Walk Park - This is an easy 2-mile hike in Red Hook, NY that has stunning views of the Hudson River. The park is named after Washington Irving, who was inspired by the beauty of the landscape. Fun fact: The park features a beautiful gazebo that was built to honor the 200th anniversary of Irving's birth.\n",
"User: I'm looking to hike in the Hudson Valley area. Nothing too strenuous.\n",
"Assistant: Hello there! I'm glad to help you with your hiking plans in the beautiful Hudson Valley area. The Hudson Valley offers a fantastic range of trails for all levels of hikers. Could you please let me know where exactly in the Hudson Valley you are located, and what kind of hiking intensity you are looking for? That way, I can recommend some great trails that suit your preferences.\n",
"\n",
"2. Walkway Over the Hudson State Historic Park - This is a flat, easy 1.25-mile hike that offers stunning views of the Hudson River and the surrounding landscape. It's also a great spot for birdwatching. Fun fact: The Walkway is the longest pedestrian bridge in the world!\n",
"Once I have that information, I'll be able to provide you with three different hiking options, varying in length and intensity. And of course, I'll include some interesting facts about the local nature along the trails!\n",
"User: Beacon, NY and I want something low intensity\n",
"Assistant: Great! Based on your location in Beacon, NY, and your preference for low-intensity hiking, here are three wonderful options for you:\n",
"\n",
"3. Esopus Creek Conservancy - This is an easy 1.5-mile hike in Saugerties, NY that takes you through forests, fields, and streams. The preserve has several trails to explore, and the views of the Esopus Creek are stunning. Fun fact: The Esopus Creek is a popular spot for trout fishing, and you might even catch a glimpse of a bald eagle flying overhead!\n",
"1. Dennings Point Loop Trail: This trail is approximately 2.5 miles long and offers a gentle hike along the Hudson River. You'll enjoy scenic views of the river, marshes, and wooded areas. Keep an eye out for bald eagles that are often spotted in this area!\n",
"\n",
"I hope these recommendations help, and let me know if you have any questions or if there's anything else I can do for you.\n",
"User: Format this as a table\n",
"Assistant: Sure, here are the same three hiking recommendations in a table format:\n",
"2. Madam Brett Park Loop: Located near the heart of Beacon, this loop trail is about 1.5 miles long and takes you through a tranquil park with beautiful waterfalls, historical ruins, and lovely wooded sections. Fun fact: Madam Brett Park is named after an 18th-century ironmaster's wife who played a significant role in the local iron industry.\n",
"\n",
"| Hike | Location | Length | Fun Fact |\n",
"|------|----------|--------|----------|\n",
"| Poet's Walk Park | Red Hook, NY | 2 miles | The park features a gazebo built to honor Washington Irving's 200th birth anniversary |\n",
"| Walkway Over the Hudson State Historic Park | Poughkeepsie, NY | 1.25 miles | The Walkway is the longest pedestrian bridge in the world |\n",
"| Esopus Creek Conservancy | Saugerties, NY | 1.5 miles | The Esopus Creek is a popular spot for trout fishing and bald eagle sightings | \n",
"3. Fishkill Ridge Trail: This trail, approximately 3.5 miles long, offers a bit more of a challenge but still manageable for a low-intensity hike. You'll be rewarded with breathtaking views of the Hudson Valley, including the charming village of Cold Spring. Keep an eye out for interesting rock formations and unique plant species along the way.\n",
"\n",
"I hope this format makes it easier to compare the hikes and choose one that fits your needs. Let me know if you have any questions!\n"
"I hope you find these suggestions helpful! Enjoy your hike in Beacon, and don't forget to take in the stunning natural beauty that the Hudson Valley has to offer.\n"
]
},
{
"ename": "Error",
"evalue": "Input request cancelled",
"output_type": "error",
"traceback": [
"Input request cancelled"
]
},
{
"ename": "Error",
"evalue": "System.Exception: Input request cancelled\n at Microsoft.DotNet.Interactive.Kernel.GetInputAsync(String prompt, Boolean isPassword, String typeHint, String valueName) in D:\\a\\_work\\1\\s\\src\\Microsoft.DotNet.Interactive\\Kernel.Static.cs:line 72\n at Microsoft.DotNet.Interactive.Kernel.GetInputAsync(String prompt, String typeHint, String valueName) in D:\\a\\_work\\1\\s\\src\\Microsoft.DotNet.Interactive\\Kernel.Static.cs:line 46\n at Submission#16.<<Initialize>>d__0.MoveNext()\n--- End of stack trace from previous location ---\n at Microsoft.CodeAnalysis.Scripting.ScriptExecutionState.RunSubmissionsAsync[TResult](ImmutableArray`1 precedingExecutors, Func`2 currentExecutor, StrongBox`1 exceptionHolderOpt, Func`2 catchExceptionOpt, CancellationToken cancellationToken)",
"output_type": "error",
"traceback": [
"System.Exception: Input request cancelled\n",
" at Microsoft.DotNet.Interactive.Kernel.GetInputAsync(String prompt, Boolean isPassword, String typeHint, String valueName) in D:\\a\\_work\\1\\s\\src\\Microsoft.DotNet.Interactive\\Kernel.Static.cs:line 72\n",
" at Microsoft.DotNet.Interactive.Kernel.GetInputAsync(String prompt, String typeHint, String valueName) in D:\\a\\_work\\1\\s\\src\\Microsoft.DotNet.Interactive\\Kernel.Static.cs:line 46\n",
" at Submission#16.<<Initialize>>d__0.MoveNext()\n",
"--- End of stack trace from previous location ---\n",
" at Microsoft.CodeAnalysis.Scripting.ScriptExecutionState.RunSubmissionsAsync[TResult](ImmutableArray`1 precedingExecutors, Func`2 currentExecutor, StrongBox`1 exceptionHolderOpt, Func`2 catchExceptionOpt, CancellationToken cancellationToken)"
]
}
],
Expand All @@ -274,11 +286,11 @@
" break; \n",
" }\n",
" Console.WriteLine($\"User: {userPrompt}\");\n",
" options.Messages.Add(new ChatMessage(ChatRole.User, userPrompt));\n",
" var assistantResponse = await client.GetChatCompletionsAsync(deploymentId, options);\n",
" options.Messages.Add(new ChatRequestUserMessage(userPrompt));\n",
" var assistantResponse = await client.GetChatCompletionsAsync(options);\n",
" var response = assistantResponse.Value.Choices[0].Message.Content;\n",
" Console.WriteLine($\"Assistant: {response}\");\n",
" options.Messages.Add(new ChatMessage(ChatRole.Assistant, response));\n",
" options.Messages.Add(new ChatRequestAssistantMessage(response));\n",
"};\n",
"options.Messages.Clear();"
]
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -29,16 +29,16 @@
{
"data": {
"text/html": [
"<div><div></div><div></div><div><strong>Installed Packages</strong><ul><li><span>Azure.AI.OpenAI, 1.0.0-beta.6</span></li><li><span>Microsoft.DotNet.Interactive, 1.0.0-beta.23313.2</span></li></ul></div></div>"
"<div><div></div><div></div><div><strong>Installed Packages</strong><ul><li><span>Azure.AI.OpenAI, 1.0.0-beta.15</span></li><li><span>Microsoft.DotNet.Interactive, 1.0.0-beta.24164.1</span></li></ul></div></div>"
]
},
"metadata": {},
"output_type": "display_data"
}
],
"source": [
"#r \"nuget: Azure.AI.OpenAI, 1.0.0-beta.6\"\n",
"#r \"nuget: Microsoft.DotNet.Interactive, 1.0.0-beta.23313.2\""
"#r \"nuget: Azure.AI.OpenAI, 1.0.0-beta.15\"\n",
"#r \"nuget: Microsoft.DotNet.Interactive, 1.0.0-beta.24164.1\""
]
},
{
Expand Down Expand Up @@ -145,6 +145,7 @@
"source": [
"var options = new ChatCompletionsOptions\n",
"{\n",
" DeploymentName=deploymentId,\n",
" MaxTokens=400,\n",
" Temperature=1f,\n",
" FrequencyPenalty=0.0f,\n",
Expand All @@ -162,7 +163,7 @@
},
{
"cell_type": "code",
"execution_count": 7,
"execution_count": 8,
"metadata": {
"dotnet_interactive": {
"language": "csharp"
Expand All @@ -173,7 +174,7 @@
},
"outputs": [],
"source": [
"var systemMessage = new ChatMessage(ChatRole.System, genericSystemPrompt);\n",
"var systemMessage = new ChatRequestSystemMessage(genericSystemPrompt);\n",
"options.Messages.Add(systemMessage);"
]
},
Expand All @@ -186,7 +187,7 @@
},
{
"cell_type": "code",
"execution_count": 8,
"execution_count": 9,
"metadata": {
"dotnet_interactive": {
"language": "csharp"
Expand All @@ -202,7 +203,7 @@
},
{
"cell_type": "code",
"execution_count": 9,
"execution_count": 10,
"metadata": {
"dotnet_interactive": {
"language": "csharp"
Expand All @@ -217,20 +218,8 @@
"output_type": "stream",
"text": [
"System: You are an AI assistant that helps people find information about your business\n",
"User: I'd like to get some pizza\n",
"Assistant: Certainly! Would you like some recommendations for pizza places in your area or would you like information about our business specifically?\n",
"User: pizza in the area\n",
"Assistant: Sure, could you please provide me with your location or zip code so I can look up pizza places nearby?\n",
"User: Chicago\n",
"Assistant: Great! Here are a few pizza places in Chicago:\n",
"\n",
"1. Lou Malnati's Pizzeria\n",
"2. Giordano's\n",
"3. Pequod's Pizza\n",
"4. Gino's East\n",
"5. Pizzeria Uno\n",
"\n",
"I hope this helps! Let me know if you need any further assistance.\n"
"User: I want pizza\n",
"Assistant: Great! I can help you find a pizza place nearby. Could you please provide me with your location or a specific area?\n"
]
}
],
Expand All @@ -245,11 +234,11 @@
" break; \n",
" }\n",
" Console.WriteLine($\"User: {userPrompt}\");\n",
" options.Messages.Add(new ChatMessage(ChatRole.User, userPrompt));\n",
" var assistantResponse = await client.GetChatCompletionsAsync(deploymentId, options);\n",
" options.Messages.Add(new ChatRequestUserMessage(userPrompt));\n",
" var assistantResponse = await client.GetChatCompletionsAsync(options);\n",
" var response = assistantResponse.Value.Choices[0].Message.Content;\n",
" Console.WriteLine($\"Assistant: {response}\");\n",
" options.Messages.Add(new ChatMessage(ChatRole.Assistant, response));\n",
" options.Messages.Add(new ChatRequestAssistantMessage(response));\n",
"};\n",
"options.Messages.Clear();"
]
Expand All @@ -263,7 +252,7 @@
},
{
"cell_type": "code",
"execution_count": 10,
"execution_count": 11,
"metadata": {
"dotnet_interactive": {
"language": "csharp"
Expand Down Expand Up @@ -313,7 +302,7 @@
},
{
"cell_type": "code",
"execution_count": 11,
"execution_count": 12,
"metadata": {
"dotnet_interactive": {
"language": "csharp"
Expand All @@ -324,12 +313,12 @@
},
"outputs": [],
"source": [
"options.Messages.Add(new ChatMessage(ChatRole.System, systemPrompt));"
"options.Messages.Add(new ChatRequestSystemMessage(systemPrompt));"
]
},
{
"cell_type": "code",
"execution_count": 12,
"execution_count": 13,
"metadata": {
"dotnet_interactive": {
"language": "csharp"
Expand All @@ -345,7 +334,7 @@
},
{
"cell_type": "code",
"execution_count": 13,
"execution_count": 15,
"metadata": {
"dotnet_interactive": {
"language": "csharp"
Expand Down Expand Up @@ -391,12 +380,10 @@
"\n",
"User: I'm interested in reselling some of your products in my shop. \n",
"Assistant: Sure, our billing department is able to help. Here is their number, 1-800-111-1113. \n",
"User: Hi\n",
"Assistant: Hi there! How may I assist you today?\n",
"User: I want to return some equipment I bought last week\n",
"Assistant: I'm sorry to hear that you need to return some equipment. I can assist you with that. Please contact our returns department at 1-800-111-1113. They will be able to assist you with the return or exchange process.\n",
"User: I want to order a milkshake\n",
"Assistant: I'm sorry, but we are an outdoor equipment business and we don't sell milkshakes or food products. Is there anything else I can help you with related to our business?\n"
"User: I want to return some equipment\n",
"Assistant: Sorry to hear that you want to return some equipment. Here is the contact information for the returns department: 1-800-111-1113.\n",
"User: I want a milkshake\n",
"Assistant: Sorry, but we don't offer milkshakes. We are an outdoor equipment company. Is there anything else I can assist you with?\n"
]
}
],
Expand All @@ -411,11 +398,11 @@
" break; \n",
" }\n",
" Console.WriteLine($\"User: {userPrompt}\");\n",
" options.Messages.Add(new ChatMessage(ChatRole.User, userPrompt));\n",
" var assistantResponse = await client.GetChatCompletionsAsync(deploymentId, options);\n",
" options.Messages.Add(new ChatRequestUserMessage(userPrompt));\n",
" var assistantResponse = await client.GetChatCompletionsAsync(options);\n",
" var response = assistantResponse.Value.Choices[0].Message.Content;\n",
" Console.WriteLine($\"Assistant: {response}\");\n",
" options.Messages.Add(new ChatMessage(ChatRole.Assistant, response));\n",
" options.Messages.Add(new ChatRequestAssistantMessage(response));\n",
"};\n",
"options.Messages.Clear();"
]
Expand Down
Loading