You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Customize the text content of the file or the length of the summary to see the differences in the responses.
111
-
112
110
:::zone-end
113
111
112
+
Customize the text content of the file or the length of the summary to see the differences in the responses.
113
+
114
114
:::zone target="docs" pivot="semantic-kernel"
115
115
116
116
Get started with AI by creating a simple .NET 8.0 console chat application to summarize text. The application runs locally and uses the OpenAI `gpt-3.5-turbo` model. Follow these steps to get access to OpenAI and learn how to use Semantic Kernel.
@@ -168,61 +168,28 @@ Get started with AI by creating a simple .NET 8.0 console chat application to su
168
168
169
169
The app uses the [`Microsoft.SemanticKernel`](https://www.nuget.org/packages/Microsoft.SemanticKernel) package to send and receive requests to the OpenAI service.
170
170
171
-
The **Program.cs** file contains all of the app code. The first several lines of code set configuration values and get the OpenAI Key that was previously set using the `dotnet user-secrets` command.
171
+
The **Program.cs** file contains all of the app code. The first several lines of code set configuration values and get the OpenAI Key that was previously set using the `dotnet user-secrets` command. The `Kernel` class facilitates the requests and responses and registers an `OpenAIChatCompletion` service.
172
172
173
173
# [OpenAI](#tab/openai)
174
174
175
-
```csharp
176
-
var config = new ConfigurationBuilder().AddUserSecrets<Program>().Build();
> `DefaultAzureCredential` searches for credentials from your local tooling. If you are not using the `azd` template to provision the Azure OpenAI resource, you'll need to assign the `Azure AI Developer` role to the account you used to sign-in to Visual Studio or the Azure CLI.
192
181
193
-
The `Kernel` class facilitates the requests and responses and registers an `OpenAIChatCompletion` service.
// Create a Kernel containing the OpenAI Chat Completion Service
197
-
Kernel kernel = Kernel.CreateBuilder()
198
-
.AddOpenAIChatCompletion(model, key)
199
-
.Build();
200
-
```
184
+
---
201
185
202
186
Once the `Kernel` is created, the app code reads the `benefits.md` file content and uses it to create a `prompt`for model. The prompt instructs the model to summarize the file text content.
203
187
204
-
```csharp
205
-
// Create and print out the prompt
206
-
string prompt = $"""
207
-
Please summarize the the following text in 20 words or less:
**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:
4
+
5
+
1.**Physical Fitness**:
6
+
-**Cardiovascular Health**: Hiking gets your heart pumping, improving cardiovascular fitness. The varied terrain challenges your body and burns calories.
7
+
- Strength and Endurance: Uphill climbs and uneven trails engage different muscle groups, enhancing strength and endurance.
8
+
- Weight Management: Regular hiking can help you maintain a healthy weight.
9
+
2. Mental Well-Being:
10
+
- Stress Reduction: Nature has a calming effect. Hiking outdoors reduces stress, anxiety, and promotes relaxation.
11
+
- Improved Mood: Fresh air, sunlight, and natural surroundings boost your mood and overall happiness.
12
+
- Mindfulness: Disconnect from screens and immerse yourself in the present moment. Hiking encourages mindfulness.
13
+
3. Connection with Nature:
14
+
- Scenic Views: Explore breathtaking landscapes, from lush forests to mountain peaks. Nature's beauty rejuvenates the soul.
15
+
- Wildlife Encounters: Spot birds, animals, and plant life. Connecting with nature fosters appreciation and wonder.
16
+
4. Social Interaction:
17
+
- Group Hikes: Join hiking clubs or go with friends. It's a great way to bond and share experiences.
18
+
- Solitude: Solo hikes provide introspection and solitude, allowing you to recharge.
19
+
5. Adventure and Exploration:
20
+
- Discover Hidden Gems: Hiking takes you off the beaten path. Discover hidden waterfalls, caves, and scenic trails.
21
+
- Sense of Accomplishment: Reaching a summit or completing a challenging trail gives a sense of achievement.
22
+
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!
**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:
4
+
5
+
1.**Physical Fitness**:
6
+
-**Cardiovascular Health**: Hiking gets your heart pumping, improving cardiovascular fitness. The varied terrain challenges your body and burns calories.
7
+
- Strength and Endurance: Uphill climbs and uneven trails engage different muscle groups, enhancing strength and endurance.
8
+
- Weight Management: Regular hiking can help you maintain a healthy weight.
9
+
2. Mental Well-Being:
10
+
- Stress Reduction: Nature has a calming effect. Hiking outdoors reduces stress, anxiety, and promotes relaxation.
11
+
- Improved Mood: Fresh air, sunlight, and natural surroundings boost your mood and overall happiness.
12
+
- Mindfulness: Disconnect from screens and immerse yourself in the present moment. Hiking encourages mindfulness.
13
+
3. Connection with Nature:
14
+
- Scenic Views: Explore breathtaking landscapes, from lush forests to mountain peaks. Nature's beauty rejuvenates the soul.
15
+
- Wildlife Encounters: Spot birds, animals, and plant life. Connecting with nature fosters appreciation and wonder.
16
+
4. Social Interaction:
17
+
- Group Hikes: Join hiking clubs or go with friends. It's a great way to bond and share experiences.
18
+
- Solitude: Solo hikes provide introspection and solitude, allowing you to recharge.
19
+
5. Adventure and Exploration:
20
+
- Discover Hidden Gems: Hiking takes you off the beaten path. Discover hidden waterfalls, caves, and scenic trails.
21
+
- Sense of Accomplishment: Reaching a summit or completing a challenging trail gives a sense of achievement.
22
+
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!
0 commit comments