From 6fe4d3be30071d1c6a0c0125994629e07afaf9ec Mon Sep 17 00:00:00 2001
From: Jordan Matthiesen <1333029+jmatthiesen@users.noreply.github.com>
Date: Mon, 4 Nov 2024 19:53:00 +0000
Subject: [PATCH] * Removing old/unused source. * Fixes Broken link #73 -
updating READMEs to point at the right paths.
---
.../01-HikeBenefitsSummary.csproj | 16 --
.../01-HikeBenefitsSummary/Program.cs | 53 ------
.../01-HikeBenefitsSummary/README.md | 29 ----
.../01-HikeBenefitsSummary/benefits.md | 21 ---
.../02-HikerAI/02-HikerAI.csproj | 16 --
src/azure-openai-sdk/02-HikerAI/Program.cs | 81 ----------
src/azure-openai-sdk/02-HikerAI/README.md | 25 ---
.../03-ChattingAboutMyHikes.csproj | 23 ---
.../03-ChattingAboutMyHikes/Program.cs | 76 ---------
.../03-ChattingAboutMyHikes/README.md | 29 ----
.../03-ChattingAboutMyHikes/hikes.md | 10 --
.../04-HikerAIPro/04-HikerAIPro.csproj | 17 --
src/azure-openai-sdk/04-HikerAIPro/Program.cs | 151 ------------------
src/azure-openai-sdk/04-HikerAIPro/README.md | 24 ---
.../05-HikeImages/05-HikeImages.csproj | 16 --
src/azure-openai-sdk/05-HikeImages/Program.cs | 48 ------
src/azure-openai-sdk/05-HikeImages/README.md | 29 ----
.../getting-started-azure-openai-sdk.sln | 49 ------
.../01-HikeBenefitsSummary/README.md | 4 +-
.../azure-openai/02-HikerAI/README.md | 4 +-
.../03-ChattingAboutMyHikes/README.md | 4 +-
.../azure-openai/04-HikerAIPro/README.md | 4 +-
.../azure-openai/05-HikeImages/README.md | 4 +-
23 files changed, 10 insertions(+), 723 deletions(-)
delete mode 100644 src/azure-openai-sdk/01-HikeBenefitsSummary/01-HikeBenefitsSummary.csproj
delete mode 100644 src/azure-openai-sdk/01-HikeBenefitsSummary/Program.cs
delete mode 100644 src/azure-openai-sdk/01-HikeBenefitsSummary/README.md
delete mode 100644 src/azure-openai-sdk/01-HikeBenefitsSummary/benefits.md
delete mode 100644 src/azure-openai-sdk/02-HikerAI/02-HikerAI.csproj
delete mode 100644 src/azure-openai-sdk/02-HikerAI/Program.cs
delete mode 100644 src/azure-openai-sdk/02-HikerAI/README.md
delete mode 100644 src/azure-openai-sdk/03-ChattingAboutMyHikes/03-ChattingAboutMyHikes.csproj
delete mode 100644 src/azure-openai-sdk/03-ChattingAboutMyHikes/Program.cs
delete mode 100644 src/azure-openai-sdk/03-ChattingAboutMyHikes/README.md
delete mode 100644 src/azure-openai-sdk/03-ChattingAboutMyHikes/hikes.md
delete mode 100644 src/azure-openai-sdk/04-HikerAIPro/04-HikerAIPro.csproj
delete mode 100644 src/azure-openai-sdk/04-HikerAIPro/Program.cs
delete mode 100644 src/azure-openai-sdk/04-HikerAIPro/README.md
delete mode 100644 src/azure-openai-sdk/05-HikeImages/05-HikeImages.csproj
delete mode 100644 src/azure-openai-sdk/05-HikeImages/Program.cs
delete mode 100644 src/azure-openai-sdk/05-HikeImages/README.md
delete mode 100644 src/azure-openai-sdk/getting-started-azure-openai-sdk.sln
diff --git a/src/azure-openai-sdk/01-HikeBenefitsSummary/01-HikeBenefitsSummary.csproj b/src/azure-openai-sdk/01-HikeBenefitsSummary/01-HikeBenefitsSummary.csproj
deleted file mode 100644
index a739a566..00000000
--- a/src/azure-openai-sdk/01-HikeBenefitsSummary/01-HikeBenefitsSummary.csproj
+++ /dev/null
@@ -1,16 +0,0 @@
-
-
-
- Exe
- net8.0
- enable
- ed6763a1-4d17-4e03-aa62-819cfc78ef3b
-
-
-
-
-
-
-
-
-
diff --git a/src/azure-openai-sdk/01-HikeBenefitsSummary/Program.cs b/src/azure-openai-sdk/01-HikeBenefitsSummary/Program.cs
deleted file mode 100644
index 8e5aa22f..00000000
--- a/src/azure-openai-sdk/01-HikeBenefitsSummary/Program.cs
+++ /dev/null
@@ -1,53 +0,0 @@
-// Licensed to the .NET Foundation under one or more agreements.
-// The .NET Foundation licenses this file to you under the MIT license.
-// See the LICENSE file in the project root for more information.
-
-using Azure;
-using Azure.AI.OpenAI;
-using Microsoft.Extensions.Configuration;
-
-// == Retrieve the local secrets saved during the Azure deployment ==========
-var config = new ConfigurationBuilder().AddUserSecrets().Build();
-string openAIEndpoint = config["AZURE_OPENAI_ENDPOINT"];
-string openAIDeploymentName = config["AZURE_OPENAI_GPT_NAME"];
-string openAiKey = config["AZURE_OPENAI_KEY"];
-// == If you skipped the deployment because you already have an Azure OpenAI available,
-// == edit the previous lines to use hardcoded values.
-// == ex: string openAIEndpoint = "https://cog-demo123.openai.azure.com/";
-
-
-// == Creating the AIClient ==========
-var endpoint = new Uri(openAIEndpoint);
-var credentials = new AzureKeyCredential(openAiKey);
-var openAIClient = new OpenAIClient(endpoint, credentials);
-
-var completionOptions = new ChatCompletionsOptions
-{
- MaxTokens = 400,
- Temperature = 1f,
- FrequencyPenalty = 0.0f,
- PresencePenalty = 0.0f,
- NucleusSamplingFactor = 0.95f, // Top P
- DeploymentName = openAIDeploymentName
-};
-
-
-//== Read markdown file ==========
-string markdown = System.IO.File.ReadAllText("benefits.md");
-
-
-// == Starting the conversation ==========
-string userRequest = """
-Please summarize the the following text in 20 words or less:
-""" + markdown;
-
-completionOptions.Messages.Add(new ChatRequestUserMessage(userRequest));
-Console.WriteLine($"\n\nUser >>> {userRequest}");
-
-// == Get the response and display it ==========
-
-ChatCompletions response = await openAIClient.GetChatCompletionsAsync(completionOptions);
-ChatResponseMessage assistantResponse = response.Choices[0].Message;
-Console.WriteLine($"\n\nAssistant >>> {assistantResponse.Content}");
-
-
diff --git a/src/azure-openai-sdk/01-HikeBenefitsSummary/README.md b/src/azure-openai-sdk/01-HikeBenefitsSummary/README.md
deleted file mode 100644
index 65126bdb..00000000
--- a/src/azure-openai-sdk/01-HikeBenefitsSummary/README.md
+++ /dev/null
@@ -1,29 +0,0 @@
-# Hiking Benefits Summary
-
-This sample demonstrates how to use the Azure OpenAI with a `gpt-35-turbo` model, from a .NET 8.0 console application. Use the AI model to summarize a page of text to a few words. It consists of a console application, running locally, that will read the file `benefits.md` and send request to an Azure OpenAI Service deployed in your Azure subscription to summarize it.
-
-Everything will be deployed automatically using the Azure Developer CLI.
-
-
-## Deploying the Azure resources
-
-If it's not already done, follow the [Getting-started: Deploying the Azure resources](../../README.md#deploying-the-azure-resources) to deploy the Azure OpenAI Service with the models.
-
-
-## Trying Hiking Benefits
-
-1. From a terminal or command prompt, navigate to the `01-HikeBenefitsSummary` directory.
-
-2. It's now time to try the console application. Depending on your Azure subscription it's possible that a few more minutes are required before the model deployed in Azure OpenAI is available. If you get an error message about this, wait a few (~5) minutes and try again.
- ```bash
- dotnet run
- ```
-
-3. (Optional) Try to change the content of the file or the length of the summary to see the differences in the responses.
-
-4. (Optional) Try another sample from the [Getting-started: Trying the samples](../../README.md#trying-the-samples) to experiment different scenarios.
-
-
-## Clean up resources
-
-Once you are done experimenting with the samples, follow the instructions from the [Getting-started: Clean up resources](../../README.md#clean-up-resources) to delete the Azure resources created using the Azure Developer CLI.
\ No newline at end of file
diff --git a/src/azure-openai-sdk/01-HikeBenefitsSummary/benefits.md b/src/azure-openai-sdk/01-HikeBenefitsSummary/benefits.md
deleted file mode 100644
index 8bbc2075..00000000
--- a/src/azure-openai-sdk/01-HikeBenefitsSummary/benefits.md
+++ /dev/null
@@ -1,21 +0,0 @@
-# Hiking Benefits
-
-**Hiking** is a wonderful activity that offers a plethora of benefits for both your body and mind. Here are some compelling reasons why you should consider starting hiking:
-1. **Physical Fitness**:
- - **Cardiovascular Health**: Hiking gets your heart pumping, improving cardiovascular fitness. The varied terrain challenges your body and burns calories.
- - Strength and Endurance: Uphill climbs and uneven trails engage different muscle groups, enhancing strength and endurance.
- - Weight Management: Regular hiking can help you maintain a healthy weight.
-2. Mental Well-Being:
- - Stress Reduction: Nature has a calming effect. Hiking outdoors reduces stress, anxiety, and promotes relaxation.
- - Improved Mood: Fresh air, sunlight, and natural surroundings boost your mood and overall happiness.
- - Mindfulness: Disconnect from screens and immerse yourself in the present moment. Hiking encourages mindfulness.
-3. Connection with Nature:
- - Scenic Views: Explore breathtaking landscapes, from lush forests to mountain peaks. Nature's beauty rejuvenates the soul.
- - Wildlife Encounters: Spot birds, animals, and plant life. Connecting with nature fosters appreciation and wonder.
-4. Social Interaction:
- - Group Hikes: Join hiking clubs or go with friends. It's a great way to bond and share experiences.
- - Solitude: Solo hikes provide introspection and solitude, allowing you to recharge.
-5. Adventure and Exploration:
- - Discover Hidden Gems: Hiking takes you off the beaten path. Discover hidden waterfalls, caves, and scenic trails.
- - Sense of Accomplishment: Reaching a summit or completing a challenging trail gives a sense of achievement.
-Remember, hiking can be tailored to your fitness level—start with shorter, easier trails and gradually progress. Lace up those hiking boots and embark on an adventure! 🌲🥾
diff --git a/src/azure-openai-sdk/02-HikerAI/02-HikerAI.csproj b/src/azure-openai-sdk/02-HikerAI/02-HikerAI.csproj
deleted file mode 100644
index 24e7c428..00000000
--- a/src/azure-openai-sdk/02-HikerAI/02-HikerAI.csproj
+++ /dev/null
@@ -1,16 +0,0 @@
-
-
-
- Exe
- net8.0
- enable
- ed6763a1-4d17-4e03-aa62-819cfc78ef3b
-
-
-
-
-
-
-
-
-
diff --git a/src/azure-openai-sdk/02-HikerAI/Program.cs b/src/azure-openai-sdk/02-HikerAI/Program.cs
deleted file mode 100644
index f2064b72..00000000
--- a/src/azure-openai-sdk/02-HikerAI/Program.cs
+++ /dev/null
@@ -1,81 +0,0 @@
-// Licensed to the .NET Foundation under one or more agreements.
-// The .NET Foundation licenses this file to you under the MIT license.
-// See the LICENSE file in the project root for more information.
-
-using Azure;
-using Azure.AI.OpenAI;
-using Microsoft.Extensions.Configuration;
-
-// == Retrieve the local secrets saved during the Azure deployment ==========
-var config = new ConfigurationBuilder().AddUserSecrets().Build();
-string openAIEndpoint = config["AZURE_OPENAI_ENDPOINT"];
-string openAIDeploymentName = config["AZURE_OPENAI_GPT_NAME"];
-string openAiKey = config["AZURE_OPENAI_KEY"];
-// == If you skipped the deployment because you already have an Azure OpenAI available,
-// == edit the previous lines to use hardcoded values.
-// == ex: string openAIEndpoint = "https://cog-demo123.openai.azure.com/";
-
-
-// == Creating the AIClient ==========
-var endpoint = new Uri(openAIEndpoint);
-var credentials = new AzureKeyCredential(openAiKey);
-var openAIClient = new OpenAIClient(endpoint, credentials);
-
-var completionOptions = new ChatCompletionsOptions
-{
- MaxTokens = 400,
- Temperature = 1f,
- FrequencyPenalty = 0.0f,
- PresencePenalty = 0.0f,
- NucleusSamplingFactor = 0.95f, // Top P
- DeploymentName = openAIDeploymentName
-};
-
-// == Providing context for the AI model ==========
-var systemPrompt =
-"""
-You are a hiking enthusiast who helps people discover fun hikes in their area. You are upbeat and friendly.
-You introduce yourself when first saying hello. When helping people out, you always ask them
-for this information to inform the hiking recommendation you provide:
-
-1. Where they are located
-2. What hiking intensity they are looking for
-
-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.
-""";
-
-completionOptions.Messages.Add(new ChatRequestSystemMessage(systemPrompt));
-
-// == Starting the conversation ==========
-string userGreeting = """
-Hi!
-Apparently you can help me find a hike that I will like?
-""";
-
-completionOptions.Messages.Add(new ChatRequestUserMessage(userGreeting));
-Console.WriteLine($"\n\nUser >>> {userGreeting}");
-
-ChatCompletions response = await openAIClient.GetChatCompletionsAsync(completionOptions);
-ChatResponseMessage assistantResponse = response.Choices[0].Message;
-Console.WriteLine($"\n\nAssistant >>> {assistantResponse.Content}");
-completionOptions.Messages.Add(new ChatRequestAssistantMessage(assistantResponse.Content));
-
-
-// == Providing the user's request ==========
-var hikeRequest =
-"""
-I live in the greater Montreal area and would like an easy hike. I don't mind driving a bit to get there.
-I don't want the hike to be over 10 miles round trip. I'd consider a point-to-point hike.
-I want the hike to be as isolated as possible. I don't want to see many people.
-I would like it to be as bug free as possible.
-""";
-
-Console.WriteLine($"\n\nUser >>> {hikeRequest}");
-completionOptions.Messages.Add(new ChatRequestUserMessage(hikeRequest));
-
-// == Retrieve the answer from HikeAI ==========
-response = await openAIClient.GetChatCompletionsAsync(completionOptions);
-assistantResponse = response.Choices[0].Message;
-
-Console.WriteLine($"\n\nAssistant >>> {assistantResponse.Content}");
diff --git a/src/azure-openai-sdk/02-HikerAI/README.md b/src/azure-openai-sdk/02-HikerAI/README.md
deleted file mode 100644
index c8e6961d..00000000
--- a/src/azure-openai-sdk/02-HikerAI/README.md
+++ /dev/null
@@ -1,25 +0,0 @@
-# HikerAI
-
-This sample demonstrates how to use the Azure OpenAI with a `gpt-35-turbo` model, from a .NET 8.0 console application. Get a hiking recommendation from the AI model. It consists of a console application, running locally, that will send request to an Azure OpenAI Service deployed in your Azure subscription.
-
-## Deploying the Azure resources
-
-If it's not already done, follow the [Getting-started: Deploying the Azure resources](../../README.md#deploying-the-azure-resources) to deploy the Azure OpenAI Service with the models.
-
-## Trying HikerAI
-
-1. From a terminal or command prompt, navigate to the `02-HikerAI` directory.
-
-2. It's now time to try the console application. Depending on your Azure subscription it's possible that a few more minutes are required before the model deployed in Azure OpenAI is available. If you get an error message about this, wait a few (~5) minutes and try again.
- ```bash
- dotnet run
- ```
-
-3. (Optional) Try modifying the `hikeRequest` changing the location so something you know, or the type of hike you like to see the differences in the responses.
-
-4. (Optional) Try another sample from the [Getting-started: Trying the samples](../../README.md#trying-the-samples) to experiment different scenarios.
-
-## Clean up resources
-
-Once you are done experimenting with the samples, follow the instructions from the [Getting-started: Clean up resources](../../README.md#clean-up-resources) to delete the Azure resources created using the Azure Developer CLI.
-
diff --git a/src/azure-openai-sdk/03-ChattingAboutMyHikes/03-ChattingAboutMyHikes.csproj b/src/azure-openai-sdk/03-ChattingAboutMyHikes/03-ChattingAboutMyHikes.csproj
deleted file mode 100644
index 458a49fb..00000000
--- a/src/azure-openai-sdk/03-ChattingAboutMyHikes/03-ChattingAboutMyHikes.csproj
+++ /dev/null
@@ -1,23 +0,0 @@
-
-
-
- Exe
- net8.0
- enable
- ed6763a1-4d17-4e03-aa62-819cfc78ef3b
-
-
-
-
-
-
-
-
-
-
- Always
-
-
-
-
-
diff --git a/src/azure-openai-sdk/03-ChattingAboutMyHikes/Program.cs b/src/azure-openai-sdk/03-ChattingAboutMyHikes/Program.cs
deleted file mode 100644
index 52e28889..00000000
--- a/src/azure-openai-sdk/03-ChattingAboutMyHikes/Program.cs
+++ /dev/null
@@ -1,76 +0,0 @@
-// Licensed to the .NET Foundation under one or more agreements.
-// The .NET Foundation licenses this file to you under the MIT license.
-// See the LICENSE file in the project root for more information.
-
-using Azure;
-using Azure.AI.OpenAI;
-using Microsoft.Extensions.Configuration;
-
-// == Retrieve the local secrets saved during the Azure deployment ==========
-var config = new ConfigurationBuilder().AddUserSecrets().Build();
-string openAIEndpoint = config["AZURE_OPENAI_ENDPOINT"];
-string openAIDeploymentName = config["AZURE_OPENAI_GPT_NAME"];
-string openAiKey = config["AZURE_OPENAI_KEY"];
-// == If you skipped the deployment because you already have an Azure OpenAI available,
-// == edit the previous lines to use hardcoded values.
-// == ex: string openAIEndpoint = "https://cog-demo123.openai.azure.com/";
-
-
-// == Creating the AIClient ==========
-var endpoint = new Uri(openAIEndpoint);
-var credentials = new AzureKeyCredential(openAiKey);
-var openAIClient = new OpenAIClient(endpoint, credentials);
-
-var completionOptions = new ChatCompletionsOptions
-{
- MaxTokens = 1000,
- Temperature = 1f,
- FrequencyPenalty = 0.0f,
- PresencePenalty = 0.0f,
- NucleusSamplingFactor = 0.95f, // Top P
- DeploymentName = openAIDeploymentName
-};
-
-//== Read markdown file ==========
-string markdown = System.IO.File.ReadAllText("hikes.md");
-
-// == Providing context for the AI model ==========
-var systemPrompt =
-"""
-You are upbeat and friendly. You introduce yourself when first saying hello.
-Provide a short answer only based on the user hiking records below:
-
-""" + markdown;
-completionOptions.Messages.Add(new ChatRequestSystemMessage(systemPrompt));
-
-Console.WriteLine($"\n\n\t\t-=-=- Hiking History -=-=--\n{markdown}");
-
-// == Starting the conversation ==========
-string userGreeting = """
-Hi!
-""";
-
-completionOptions.Messages.Add(new ChatRequestUserMessage(userGreeting));
-Console.WriteLine($"\n\nUser >>> {userGreeting}");
-
-ChatCompletions response = await openAIClient.GetChatCompletionsAsync(completionOptions);
-ChatResponseMessage assistantResponse = response.Choices[0].Message;
-Console.WriteLine($"\n\nAssistant >>> {assistantResponse.Content}");
-completionOptions.Messages.Add(new ChatRequestAssistantMessage(assistantResponse.Content));
-
-
-// == Providing the user's request ==========
-var hikeRequest =
-"""
-I would like to know the ration of hike I did in Canada compare to hikes done in other countries.
-""";
-
-
-Console.WriteLine($"\n\nUser >>> {hikeRequest}");
-completionOptions.Messages.Add(new ChatRequestUserMessage(hikeRequest));
-
-// == Retrieve the answer from HikeAI ==========
-response = await openAIClient.GetChatCompletionsAsync(completionOptions);
-assistantResponse = response.Choices[0].Message;
-
-Console.WriteLine($"\n\nAssistant >>> {assistantResponse.Content}");
diff --git a/src/azure-openai-sdk/03-ChattingAboutMyHikes/README.md b/src/azure-openai-sdk/03-ChattingAboutMyHikes/README.md
deleted file mode 100644
index af35ef54..00000000
--- a/src/azure-openai-sdk/03-ChattingAboutMyHikes/README.md
+++ /dev/null
@@ -1,29 +0,0 @@
-# Chatting About My Previous Hikes
-
-This sample demonstrates how to use the Azure OpenAI with a `gpt-35-turbo` model, from a .NET 8.0 console application. Use the AI model to get analytics and information about your previous hikes. It consists of a console application, running locally, that will read the file `hikes.md` and send request to an Azure OpenAI Service deployed in your Azure subscription and provide the result in the console.
-
-Everything will be deployed automatically using the Azure Developer CLI.
-
-
-## Deploying the Azure resources
-
-If it's not already done, follow the [Getting-started: Deploying the Azure resources](../../README.md#deploying-the-azure-resources) to deploy the Azure OpenAI service with the models.
-
-
-## Trying Chatting About My Previous Hikes
-
-1. From a terminal or command prompt, navigate to the `03-ChattingAboutMyHikes` directory.
-
-2. It's now time to try the console application. Depending on your Azure subscription it's possible that a few more minutes are required before the model deployed in Azure OpenAI get available. If you get an error message about this, wait a few (~5) minutes and try again.
- ```bash
- dotnet run
- ```
-
-3. (Optional) Try changing the `hikeRequest` variable in the `Program.cs`, asking for different questions (ex: How many times did you hiked when it was raining? How many times did you hiked in 2021? etc.)
-
-4. (Optional) Try another sample from the [Getting-started: Trying the samples](../../README.md#trying-the-samples) to experiment different scenarios.
-
-
-## Clean up resources
-
-Once you are done experimenting with the samples, follow the instructions from the [Getting-started: Clean up resources](../../README.md#clean-up-resources) to delete the Azure resources created using the Azure Developer CLI.
\ No newline at end of file
diff --git a/src/azure-openai-sdk/03-ChattingAboutMyHikes/hikes.md b/src/azure-openai-sdk/03-ChattingAboutMyHikes/hikes.md
deleted file mode 100644
index 91e2394a..00000000
--- a/src/azure-openai-sdk/03-ChattingAboutMyHikes/hikes.md
+++ /dev/null
@@ -1,10 +0,0 @@
-| Trail Name | Hike Date | Country | Weather
-| --------------- | ---------- | -------- | --------
-| Cascade Falls | 2021-07-15 | Canada | Sunny
-| Johnston Canyon | 2022-05-10 | Canada | Cloudy
-| Lake Louise | 2020-09-05 | Canada | Rainy
-| Angel's Landing | 2023-06-20 | USA | Sunny
-| Gros Morne | 2021-08-25 | Canada | Foggy
-| Hocking Hills | 2022-04-01 | USA | Sunny
-| The Chief | 2020-07-05 | Canada | Sunny
-| Skaftafell | 2022-09-10 | Iceland | Cloudy
\ No newline at end of file
diff --git a/src/azure-openai-sdk/04-HikerAIPro/04-HikerAIPro.csproj b/src/azure-openai-sdk/04-HikerAIPro/04-HikerAIPro.csproj
deleted file mode 100644
index c9214288..00000000
--- a/src/azure-openai-sdk/04-HikerAIPro/04-HikerAIPro.csproj
+++ /dev/null
@@ -1,17 +0,0 @@
-
-
-
- Exe
- net8.0
- enable
- 3fa4fd42-c2d0-493f-984d-f23accaecdfe
-
-
-
-
-
-
-
-
-
-
diff --git a/src/azure-openai-sdk/04-HikerAIPro/Program.cs b/src/azure-openai-sdk/04-HikerAIPro/Program.cs
deleted file mode 100644
index 13a95b68..00000000
--- a/src/azure-openai-sdk/04-HikerAIPro/Program.cs
+++ /dev/null
@@ -1,151 +0,0 @@
-// Licensed to the .NET Foundation under one or more agreements.
-// The .NET Foundation licenses this file to you under the MIT license.
-// See the LICENSE file in the project root for more information.
-
-using System.Text.Json;
-using Azure;
-using Azure.AI.OpenAI;
-using Microsoft.Extensions.Configuration;
-
-// == Retrieve the local secrets saved during the Azure deployment ==========
-var config = new ConfigurationBuilder().AddUserSecrets().Build();
-string openAIEndpoint = config["AZURE_OPENAI_ENDPOINT"];
-string openAIDeploymentName = config["AZURE_OPENAI_GPT_NAME"];
-string openAiKey = config["AZURE_OPENAI_KEY"];
-
-// == Creating the AIClient ==========
-var endpoint = new Uri(openAIEndpoint);
-var credentials = new AzureKeyCredential(openAiKey);
-var openAIClient = new OpenAIClient(endpoint, credentials);
-
-
-// == Defining a Tool to extend the AI model ==========
-var getWeather = new ChatCompletionsFunctionToolDefinition()
-{
- Name = "get_current_weather",
- Description = "Get the current weather in a given location",
- Parameters = BinaryData.FromObjectAsJson(
- new
- {
- Type = "object",
- Properties = new
- {
- Location = new
- {
- Type = "string",
- Description = "The city, e.g. Montreal, Sidney",
- },
- Unit = new
- {
- Type = "string",
- Enum = new[] { "celsius", "fahrenheit" },
- }
- },
- Required = new[] { "location" },
- },
- new JsonSerializerOptions() { PropertyNamingPolicy = JsonNamingPolicy.CamelCase }),
-};
-
-// == Purely for convenience and clarity, this standalone local method handles tool call responses. ==========
-ChatRequestToolMessage GetToolCallResponseMessage(ChatCompletionsToolCall toolCall)
-{
- var functionToolCall = toolCall as ChatCompletionsFunctionToolCall;
- if (functionToolCall?.Name == getWeather.Name)
- {
- string unvalidatedArguments = functionToolCall.Arguments;
- var functionResultData = (object)null;
-
- // == Here you would call a weather API to get the weather for the location ==========
- functionResultData = "Periods of rain or drizzle, 15 C";
-
- return new ChatRequestToolMessage(functionResultData.ToString(), toolCall.Id);
- }
- else
- {
- throw new NotImplementedException();
- }
-}
-
-
-var completionOptions = new ChatCompletionsOptions
-{
- MaxTokens = 400,
- Temperature = 1f,
- FrequencyPenalty = 0.0f,
- PresencePenalty = 0.0f,
- NucleusSamplingFactor = 0.95f, // Top P
- DeploymentName = openAIDeploymentName,
- Tools = { getWeather }
-};
-completionOptions.ToolChoice = ChatCompletionsToolChoice.Auto;
-
-
-// == Providing context for the AI model ==========
-var systemPrompt =
-"""
-You are a hiking enthusiast who helps people discover fun hikes in their area. You are upbeat and friendly.
-A good weather is important for a good hike. Only make recommendations if the weather is good or if people insist.
-You introduce yourself when first saying hello. When helping people out, you always ask them
-for this information to inform the hiking recommendation you provide:
-
-1. Where they are located
-2. What hiking intensity they are looking for
-
-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.
-""";
-
-completionOptions.Messages.Add(new ChatRequestSystemMessage(systemPrompt));
-
-
-// == Starting the conversation ==========
-string userGreeting = """
-Hi!
-""";
-
-completionOptions.Messages.Add(new ChatRequestUserMessage(userGreeting));
-Console.WriteLine($"\n\nUser >>> {userGreeting}");
-
-
-ChatCompletions response = await openAIClient.GetChatCompletionsAsync(completionOptions);
-ChatResponseMessage assistantResponse = response.Choices[0].Message;
-Console.WriteLine($"\n\nAssistant >>> {assistantResponse.Content}");
-completionOptions.Messages.Add(new ChatRequestSystemMessage(assistantResponse.Content));
-
-
-// == Providing the user's request ==========
-var hikeRequest =
-"""
-Is the weather is good today for a hike?
-If yes, I live in the greater Montreal area and would like an easy hike. I don't mind driving a bit to get there.
-I don't want the hike to be over 10 miles round trip. I'd consider a point-to-point hike.
-I want the hike to be as isolated as possible. I don't want to see many people.
-I would like it to be as bug free as possible.
-""";
-
-Console.WriteLine($"\n\nUser >>> {hikeRequest}");
-completionOptions.Messages.Add(new ChatRequestUserMessage(hikeRequest));
-
-// == Retrieve the answer from HikeAI ==========
-response = await openAIClient.GetChatCompletionsAsync(completionOptions);
-
-// == If the response includes a tool call, handle it and continue the conversation ==========
-ChatChoice responseChoice = response.Choices[0];
-if (responseChoice.FinishReason == CompletionsFinishReason.ToolCalls)
-{
- // == Include the FunctionCall message in the conversation history ==========
- completionOptions.Messages.Add(new ChatRequestAssistantMessage(responseChoice.Message));
-
- // == Add a new tool message for each tool call that is resolved ==========
- foreach (ChatCompletionsToolCall toolCall in responseChoice.Message.ToolCalls)
- {
- var ToolCallMsg = GetToolCallResponseMessage(toolCall);
- completionOptions.Messages.Add(ToolCallMsg);
- }
-
- // == Retrieve the answer from HikeAI Pro ==========
- response = await openAIClient.GetChatCompletionsAsync(completionOptions);
-}
-
-assistantResponse = response.Choices[0].Message;
-Console.WriteLine($"\n\nAssistant >>> {assistantResponse.Content}");
diff --git a/src/azure-openai-sdk/04-HikerAIPro/README.md b/src/azure-openai-sdk/04-HikerAIPro/README.md
deleted file mode 100644
index 9dc95591..00000000
--- a/src/azure-openai-sdk/04-HikerAIPro/README.md
+++ /dev/null
@@ -1,24 +0,0 @@
-# HikerAI Pro
-
-This sample demonstrates how to extend the Azure OpenAI with a `gpt-35-turbo` model to use local functionalities, from a .NET 8.0 console application. Get a hiking recommendation, based on the weather condition from the AI model. It consists of a console application, running locally, that will send request to an Azure OpenAI Service deployed in your Azure subscription.
-
-## Deploying the Azure resources
-
-If it's not already done, follow the [Getting-started: Deploying the Azure resources](../../README.md#deploying-the-azure-resources) to deploy the Azure OpenAI Service with the models.
-
-## Trying HikerAI Pro
-
-1. From a terminal or command prompt, navigate to the `04-HikerAIPro` directory.
-
-2. It's now time to try the console application. Depending on your Azure subscription it's possible that a few more minutes are required before the model deployed in Azure OpenAI is available. If you get an error message about this, wait a few (~5) minutes and try again.
- ```bash
- dotnet run
- ```
-
-3. (Optional) Try changing the weather condition from `functionResultData`, or the type of weather you prefer for hiking to see the differences in the responses.
-
-4. (Optional) Try another sample from the [Getting-started: Trying the samples](../../README.md#trying-the-samples) to experiment different scenarios.
-
-## Clean up resources
-
-Once you are done experimenting with the samples, follow the instructions from the [Getting-started: Clean up resources](../../README.md#clean-up-resources) to delete the Azure resources created using the Azure Developer CLI.
diff --git a/src/azure-openai-sdk/05-HikeImages/05-HikeImages.csproj b/src/azure-openai-sdk/05-HikeImages/05-HikeImages.csproj
deleted file mode 100644
index a739a566..00000000
--- a/src/azure-openai-sdk/05-HikeImages/05-HikeImages.csproj
+++ /dev/null
@@ -1,16 +0,0 @@
-
-
-
- Exe
- net8.0
- enable
- ed6763a1-4d17-4e03-aa62-819cfc78ef3b
-
-
-
-
-
-
-
-
-
diff --git a/src/azure-openai-sdk/05-HikeImages/Program.cs b/src/azure-openai-sdk/05-HikeImages/Program.cs
deleted file mode 100644
index 782b8bd3..00000000
--- a/src/azure-openai-sdk/05-HikeImages/Program.cs
+++ /dev/null
@@ -1,48 +0,0 @@
-// Licensed to the .NET Foundation under one or more agreements.
-// The .NET Foundation licenses this file to you under the MIT license.
-// See the LICENSE file in the project root for more information.
-
-using Azure;
-using Azure.AI.OpenAI;
-using Microsoft.Extensions.Configuration;
-
-// == Retrieve the local secrets saved during the Azure deployment ==========
-var config = new ConfigurationBuilder().AddUserSecrets().Build();
-string openAIEndpoint = config["AZURE_OPENAI_ENDPOINT"];
-string openAIDeploymentName = config["AZURE_OPENAI_GPT_NAME"];
-string openAiKey = config["AZURE_OPENAI_KEY"];
-string openAIDalleName = config["AZURE_OPENAI_DALLE_NAME"];
-// == If you skipped the deployment because you already have an Azure OpenAI available,
-// == edit the previous lines to use hardcoded values.
-// == ex: string openAIEndpoint = "https://cog-demo123.openai.azure.com/";
-
-
-// == Creating the AIClient ==========
-var endpoint = new Uri(openAIEndpoint);
-var credentials = new AzureKeyCredential(openAiKey);
-var openAIClient = new OpenAIClient(endpoint, credentials);
-
-
-// == Define the image ==========
-string imagePrompt = """
-A postal card with an happy hiker waving, there a beautiful mountain in the background.
-There is a trail visible in the foreground.
-The postal card has text in red saying: 'You are invited for a hike!'
-""";
-
-
-Response response = await openAIClient.GetImageGenerationsAsync(
- new ImageGenerationOptions()
- {
- DeploymentName = openAIDalleName,
- Prompt = imagePrompt,
- Size = ImageSize.Size1024x1024,
- Quality = ImageGenerationQuality.Standard
- });
-
-ImageGenerationData generatedImage = response.Value.Data[0];
-if (!string.IsNullOrEmpty(generatedImage.RevisedPrompt))
-{
- Console.WriteLine($"\n\nInput prompt automatically revised to:\n {generatedImage.RevisedPrompt}");
-}
-Console.WriteLine($"\n\nThe generated image is ready at:\n {generatedImage.Url.AbsoluteUri}");
diff --git a/src/azure-openai-sdk/05-HikeImages/README.md b/src/azure-openai-sdk/05-HikeImages/README.md
deleted file mode 100644
index 4c582c3a..00000000
--- a/src/azure-openai-sdk/05-HikeImages/README.md
+++ /dev/null
@@ -1,29 +0,0 @@
-# Generate Hiking Images
-
-This sample demonstrates how to use the Azure OpenAI with a `dall-e-3` model, from a simple .NET 8.0 console application. Use the AI model to generate postal card and invite your friends for a hike! It consists of a simple console application, running locally, that send request to an Azure OpenAI service deployed in your Azure subscription to generate image based on a prompt.
-
-Everything will be deployed automatically using the Azure Developer CLI.
-
-
-## Deploying the Azure resources
-
-If it's not already done, follow the [Getting-started: Deploying the Azure resources](../../README.md#deploying-the-azure-resources) to deploy the Azure OpenAI service with the models.
-
-
-## Trying Chatting About My Previous Hikes
-
-1. From a terminal or command prompt, navigate to the `05-HikeImages` directory.
-
-2. It's now time to try the console application. Depending on your Azure subscription it's possible that a few more minutes are required before the model deployed in Azure OpenAI get available. If you get an error message about this, wait a few (~5) minutes and try again.
- ```bash
- dotnet run
- ```
-
-3. (Optional) Try edit the `imagePrompt` variable in the `Program.cs`, try different prompts to personalize the images generated.
-
-4. (Optional) Try another sample from the [Getting-started: Trying the samples](../../README.md#trying-the-samples) to experiment different scenarios.
-
-
-## Clean up resources
-
-Once you are done experimenting with the samples, follow the instructions from the [Getting-started: Clean up resources](../../README.md#clean-up-resources) to delete the Azure resources created using the Azure Developer CLI.
\ No newline at end of file
diff --git a/src/azure-openai-sdk/getting-started-azure-openai-sdk.sln b/src/azure-openai-sdk/getting-started-azure-openai-sdk.sln
deleted file mode 100644
index 067bbefd..00000000
--- a/src/azure-openai-sdk/getting-started-azure-openai-sdk.sln
+++ /dev/null
@@ -1,49 +0,0 @@
-
-Microsoft Visual Studio Solution File, Format Version 12.00
-# Visual Studio Version 17
-VisualStudioVersion = 17.0.31903.59
-MinimumVisualStudioVersion = 10.0.40219.1
-Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "01-HikeBenefitsSummary", "01-HikeBenefitsSummary\01-HikeBenefitsSummary.csproj", "{33EF16E1-A012-4F0A-9545-3EA65EE2FD9A}"
-EndProject
-Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "02-HikerAI", "02-HikerAI\02-HikerAI.csproj", "{9DE74988-B019-4276-A99D-28999FC14D03}"
-EndProject
-Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "03-ChattingAboutMyHikes", "03-ChattingAboutMyHikes\03-ChattingAboutMyHikes.csproj", "{BAB4B723-FF79-4F78-B1B5-35959EEFB52F}"
-EndProject
-Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "05-HikeImages", "05-HikeImages\05-HikeImages.csproj", "{AEDE95A2-2723-41B2-9DC7-9EFBD3CD24C8}"
-EndProject
-Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "04-HikerAIPro", "04-HikerAIPro\04-HikerAIPro.csproj", "{9122744F-C81C-4403-9C02-F371369262C6}"
-EndProject
-Global
- GlobalSection(SolutionConfigurationPlatforms) = preSolution
- Debug|Any CPU = Debug|Any CPU
- Release|Any CPU = Release|Any CPU
- EndGlobalSection
- GlobalSection(ProjectConfigurationPlatforms) = postSolution
- {33EF16E1-A012-4F0A-9545-3EA65EE2FD9A}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
- {33EF16E1-A012-4F0A-9545-3EA65EE2FD9A}.Debug|Any CPU.Build.0 = Debug|Any CPU
- {33EF16E1-A012-4F0A-9545-3EA65EE2FD9A}.Release|Any CPU.ActiveCfg = Release|Any CPU
- {33EF16E1-A012-4F0A-9545-3EA65EE2FD9A}.Release|Any CPU.Build.0 = Release|Any CPU
- {9DE74988-B019-4276-A99D-28999FC14D03}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
- {9DE74988-B019-4276-A99D-28999FC14D03}.Debug|Any CPU.Build.0 = Debug|Any CPU
- {9DE74988-B019-4276-A99D-28999FC14D03}.Release|Any CPU.ActiveCfg = Release|Any CPU
- {9DE74988-B019-4276-A99D-28999FC14D03}.Release|Any CPU.Build.0 = Release|Any CPU
- {BAB4B723-FF79-4F78-B1B5-35959EEFB52F}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
- {BAB4B723-FF79-4F78-B1B5-35959EEFB52F}.Debug|Any CPU.Build.0 = Debug|Any CPU
- {BAB4B723-FF79-4F78-B1B5-35959EEFB52F}.Release|Any CPU.ActiveCfg = Release|Any CPU
- {BAB4B723-FF79-4F78-B1B5-35959EEFB52F}.Release|Any CPU.Build.0 = Release|Any CPU
- {AEDE95A2-2723-41B2-9DC7-9EFBD3CD24C8}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
- {AEDE95A2-2723-41B2-9DC7-9EFBD3CD24C8}.Debug|Any CPU.Build.0 = Debug|Any CPU
- {AEDE95A2-2723-41B2-9DC7-9EFBD3CD24C8}.Release|Any CPU.ActiveCfg = Release|Any CPU
- {AEDE95A2-2723-41B2-9DC7-9EFBD3CD24C8}.Release|Any CPU.Build.0 = Release|Any CPU
- {9122744F-C81C-4403-9C02-F371369262C6}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
- {9122744F-C81C-4403-9C02-F371369262C6}.Debug|Any CPU.Build.0 = Debug|Any CPU
- {9122744F-C81C-4403-9C02-F371369262C6}.Release|Any CPU.ActiveCfg = Release|Any CPU
- {9122744F-C81C-4403-9C02-F371369262C6}.Release|Any CPU.Build.0 = Release|Any CPU
- EndGlobalSection
- GlobalSection(SolutionProperties) = preSolution
- HideSolutionNode = FALSE
- EndGlobalSection
- GlobalSection(ExtensibilityGlobals) = postSolution
- SolutionGuid = {99AE4E2C-822E-495B-ADCE-7B44E1AF337B}
- EndGlobalSection
-EndGlobal
diff --git a/src/quickstarts/azure-openai/01-HikeBenefitsSummary/README.md b/src/quickstarts/azure-openai/01-HikeBenefitsSummary/README.md
index 599d2974..b9aed2b2 100644
--- a/src/quickstarts/azure-openai/01-HikeBenefitsSummary/README.md
+++ b/src/quickstarts/azure-openai/01-HikeBenefitsSummary/README.md
@@ -7,7 +7,7 @@ Everything will be deployed automatically using the Azure Developer CLI.
## Deploying the Azure resources
-If it's not already done, follow the [Getting-started: Deploying the Azure resources](../../README.md#deploying-the-azure-resources) to deploy the Azure OpenAI Service with the models.
+If it's not already done, follow the [Getting-started: Deploying the Azure resources](../README.md#deploying-the-azure-resources) to deploy the Azure OpenAI Service with the models.
## Trying Hiking Benefits
@@ -26,4 +26,4 @@ If it's not already done, follow the [Getting-started: Deploying the Azure resou
## Clean up resources
-Once you are done experimenting with the samples, follow the instructions from the [Getting-started: Clean up resources](../../README.md#clean-up-resources) to delete the Azure resources created using the Azure Developer CLI.
\ No newline at end of file
+Once you are done experimenting with the samples, follow the instructions from the [Getting-started: Clean up resources](../README.md#clean-up-resources) to delete the Azure resources created using the Azure Developer CLI.
\ No newline at end of file
diff --git a/src/quickstarts/azure-openai/02-HikerAI/README.md b/src/quickstarts/azure-openai/02-HikerAI/README.md
index d3b09baa..87058466 100644
--- a/src/quickstarts/azure-openai/02-HikerAI/README.md
+++ b/src/quickstarts/azure-openai/02-HikerAI/README.md
@@ -4,7 +4,7 @@ This sample demonstrates how to use the Azure OpenAI with a `gpt-35-turbo` model
## Deploying the Azure resources
-If it's not already done, follow the [Getting-started: Deploying the Azure resources](../../README.md#deploying-the-azure-resources) to deploy the Azure OpenAI Service with the models.
+If it's not already done, follow the [Getting-started: Deploying the Azure resources](../README.md#deploying-the-azure-resources) to deploy the Azure OpenAI Service with the models.
## Trying HikerAI
@@ -21,5 +21,5 @@ If it's not already done, follow the [Getting-started: Deploying the Azure resou
## Clean up resources
-Once you are done experimenting with the samples, follow the instructions from the [Getting-started: Clean up resources](../../README.md#clean-up-resources) to delete the Azure resources created using the Azure Developer CLI.
+Once you are done experimenting with the samples, follow the instructions from the [Getting-started: Clean up resources](../README.md#clean-up-resources) to delete the Azure resources created using the Azure Developer CLI.
diff --git a/src/quickstarts/azure-openai/03-ChattingAboutMyHikes/README.md b/src/quickstarts/azure-openai/03-ChattingAboutMyHikes/README.md
index a100d715..f2e571fc 100644
--- a/src/quickstarts/azure-openai/03-ChattingAboutMyHikes/README.md
+++ b/src/quickstarts/azure-openai/03-ChattingAboutMyHikes/README.md
@@ -7,7 +7,7 @@ Everything will be deployed automatically using the Azure Developer CLI.
## Deploying the Azure resources
-If it's not already done, follow the [Getting-started: Deploying the Azure resources](../../README.md#deploying-the-azure-resources) to deploy the Azure OpenAI service with the models.
+If it's not already done, follow the [Getting-started: Deploying the Azure resources](../README.md#deploying-the-azure-resources) to deploy the Azure OpenAI service with the models.
## Trying Chatting About My Previous Hikes
@@ -26,4 +26,4 @@ If it's not already done, follow the [Getting-started: Deploying the Azure resou
## Clean up resources
-Once you are done experimenting with the samples, follow the instructions from the [Getting-started: Clean up resources](../../README.md#clean-up-resources) to delete the Azure resources created using the Azure Developer CLI.
\ No newline at end of file
+Once you are done experimenting with the samples, follow the instructions from the [Getting-started: Clean up resources](../README.md#clean-up-resources) to delete the Azure resources created using the Azure Developer CLI.
\ No newline at end of file
diff --git a/src/quickstarts/azure-openai/04-HikerAIPro/README.md b/src/quickstarts/azure-openai/04-HikerAIPro/README.md
index b2cac3b7..562f9aa9 100644
--- a/src/quickstarts/azure-openai/04-HikerAIPro/README.md
+++ b/src/quickstarts/azure-openai/04-HikerAIPro/README.md
@@ -4,7 +4,7 @@ This sample demonstrates how to use the Azure OpenAI with a `gpt-35-turbo` model
## Deploying the Azure resources
-If it's not already done, follow the [Getting-started: Deploying the Azure resources](../../README.md#deploying-the-azure-resources) to deploy the Azure OpenAI service with the models.
+If it's not already done, follow the [Getting-started: Deploying the Azure resources](../README.md#deploying-the-azure-resources) to deploy the Azure OpenAI service with the models.
## Trying HikerAI Pro
@@ -20,4 +20,4 @@ If it's not already done, follow the [Getting-started: Deploying the Azure resou
## Clean up resources
-Once you are done experimenting with the samples, follow the instructions from the [Getting-started: Clean up resources](../../README.md#clean-up-resources) to delete the Azure resources created using the Azure Developer CLI.
\ No newline at end of file
+Once you are done experimenting with the samples, follow the instructions from the [Getting-started: Clean up resources](../README.md#clean-up-resources) to delete the Azure resources created using the Azure Developer CLI.
\ No newline at end of file
diff --git a/src/quickstarts/azure-openai/05-HikeImages/README.md b/src/quickstarts/azure-openai/05-HikeImages/README.md
index a59580e1..3a6849a3 100644
--- a/src/quickstarts/azure-openai/05-HikeImages/README.md
+++ b/src/quickstarts/azure-openai/05-HikeImages/README.md
@@ -7,7 +7,7 @@ Everything will be deployed automatically using the Azure Developer CLI.
## Deploying the Azure resources
-If it's not already done, follow the [Getting-started: Deploying the Azure resources](../../README.md#deploying-the-azure-resources) to deploy the Azure OpenAI service with the models.
+If it's not already done, follow the [Getting-started: Deploying the Azure resources](../README.md#deploying-the-azure-resources) to deploy the Azure OpenAI service with the models.
## Trying Chatting About My Previous Hikes
@@ -26,4 +26,4 @@ If it's not already done, follow the [Getting-started: Deploying the Azure resou
## Clean up resources
-Once you are done experimenting with the samples, follow the instructions from the [Getting-started: Clean up resources](../../README.md#clean-up-resources) to delete the Azure resources created using the Azure Developer CLI.
\ No newline at end of file
+Once you are done experimenting with the samples, follow the instructions from the [Getting-started: Clean up resources](../README.md#clean-up-resources) to delete the Azure resources created using the Azure Developer CLI.
\ No newline at end of file