Skip to content

Commit bc1f0f4

Browse files
authored
Merge pull request #229 from microsoft/bruno-add-gpt-oss
Add BasicChat-07Ollama-gpt-oss project and initial implementation
2 parents d6e674a + 20417b8 commit bc1f0f4

File tree

4 files changed

+56
-6
lines changed

4 files changed

+56
-6
lines changed
Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
<Project Sdk="Microsoft.NET.Sdk">
2+
3+
<PropertyGroup>
4+
<OutputType>Exe</OutputType>
5+
<TargetFramework>net9.0</TargetFramework>
6+
<RootNamespace>BasicChat_07Ollama_gpt_oss</RootNamespace>
7+
<ImplicitUsings>enable</ImplicitUsings>
8+
<Nullable>enable</Nullable>
9+
</PropertyGroup>
10+
<ItemGroup>
11+
<PackageReference Include="Microsoft.Extensions.AI.Ollama" Version="9.5.0-preview.1.25265.7" />
12+
<PackageReference Include="Microsoft.Extensions.Configuration.UserSecrets" Version="9.0.7" />
13+
</ItemGroup>
14+
15+
</Project>
Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
using Microsoft.Extensions.AI;
2+
using System.Text;
3+
4+
// download the model from: https://ollama.com/library/gpt-oss:20b
5+
6+
IChatClient client =
7+
new OllamaChatClient(new Uri("http://localhost:11434/"), "gpt-oss:20b");
8+
9+
// Prompt to test a reasoning model capability
10+
var prompt = new StringBuilder();
11+
prompt.AppendLine("You are a helpful assistant.");
12+
prompt.AppendLine("Answer the following question with a short explanation:");
13+
prompt.AppendLine("Why is the sky blue?");
14+
15+
var response = await client.GetResponseAsync(prompt.ToString());
16+
17+
Console.WriteLine(response.Text);

03-CoreGenerativeAITechniques/src/CoreGenerativeAITechniques.sln

Lines changed: 16 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11

22
Microsoft Visual Studio Solution File, Format Version 12.00
33
# Visual Studio Version 18
4-
VisualStudioVersion = 18.0.10829.221 main
4+
VisualStudioVersion = 18.0.10829.221
55
MinimumVisualStudioVersion = 10.0.40219.1
66
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "BasicChat-01MEAI", "BasicChat-01MEAI\BasicChat-01MEAI.csproj", "{F924B9FC-D806-4350-BEC8-C0D4BB9E7C6D}"
77
EndProject
@@ -107,6 +107,8 @@ Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "MCP-02-HuggingFace-Ollama",
107107
EndProject
108108
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "BasicChat-06OpenAIAPIs", "BasicChat-06OpenAIAPIs\BasicChat-06OpenAIAPIs.csproj", "{48371925-76C4-40BD-A6F4-95E983771191}"
109109
EndProject
110+
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "BasicChat-07Ollama-gpt-oss", "BasicChat-07Ollama-gpt-oss\BasicChat-07Ollama-gpt-oss.csproj", "{638B75D9-0314-4867-A75A-4E00046B8E27}"
111+
EndProject
110112
Global
111113
GlobalSection(SolutionConfigurationPlatforms) = preSolution
112114
Debug|Any CPU = Debug|Any CPU
@@ -573,6 +575,18 @@ Global
573575
{48371925-76C4-40BD-A6F4-95E983771191}.Release|x64.Build.0 = Release|Any CPU
574576
{48371925-76C4-40BD-A6F4-95E983771191}.Release|x86.ActiveCfg = Release|Any CPU
575577
{48371925-76C4-40BD-A6F4-95E983771191}.Release|x86.Build.0 = Release|Any CPU
578+
{638B75D9-0314-4867-A75A-4E00046B8E27}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
579+
{638B75D9-0314-4867-A75A-4E00046B8E27}.Debug|Any CPU.Build.0 = Debug|Any CPU
580+
{638B75D9-0314-4867-A75A-4E00046B8E27}.Debug|x64.ActiveCfg = Debug|Any CPU
581+
{638B75D9-0314-4867-A75A-4E00046B8E27}.Debug|x64.Build.0 = Debug|Any CPU
582+
{638B75D9-0314-4867-A75A-4E00046B8E27}.Debug|x86.ActiveCfg = Debug|Any CPU
583+
{638B75D9-0314-4867-A75A-4E00046B8E27}.Debug|x86.Build.0 = Debug|Any CPU
584+
{638B75D9-0314-4867-A75A-4E00046B8E27}.Release|Any CPU.ActiveCfg = Release|Any CPU
585+
{638B75D9-0314-4867-A75A-4E00046B8E27}.Release|Any CPU.Build.0 = Release|Any CPU
586+
{638B75D9-0314-4867-A75A-4E00046B8E27}.Release|x64.ActiveCfg = Release|Any CPU
587+
{638B75D9-0314-4867-A75A-4E00046B8E27}.Release|x64.Build.0 = Release|Any CPU
588+
{638B75D9-0314-4867-A75A-4E00046B8E27}.Release|x86.ActiveCfg = Release|Any CPU
589+
{638B75D9-0314-4867-A75A-4E00046B8E27}.Release|x86.Build.0 = Release|Any CPU
576590
EndGlobalSection
577591
GlobalSection(SolutionProperties) = preSolution
578592
HideSolutionNode = FALSE
@@ -616,6 +630,7 @@ Global
616630
{769320A2-CE09-41EF-A345-8BE6ABBE2696} = {3D13EC01-716A-41D9-BC54-1871EC14D3DE}
617631
{CB155DBA-0E2D-437D-AB29-FF5B65B44A27} = {3D13EC01-716A-41D9-BC54-1871EC14D3DE}
618632
{48371925-76C4-40BD-A6F4-95E983771191} = {1248F5FA-C7D6-4876-8313-A15A942F84FE}
633+
{638B75D9-0314-4867-A75A-4E00046B8E27} = {1248F5FA-C7D6-4876-8313-A15A942F84FE}
619634
EndGlobalSection
620635
GlobalSection(ExtensibilityGlobals) = postSolution
621636
SolutionGuid = {961EEBAB-4149-4AA4-BEE7-9DAAE4C94133}

README.md

Lines changed: 8 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -28,18 +28,22 @@ Don't forget to [star (🌟) this repo](https://docs.github.com/en/get-started/e
2828

2929
➡️Get your own copy by [Forking this repo](https://github.com/microsoft/Generative-AI-for-beginners-dotnet/fork) and find it next in your own repositories.
3030

31-
## ✨ What's New!
31+
## ✨ What's New
3232

3333
We're constantly improving this course with the latest AI tools, models, and practical samples:
3434

35-
- **🖼️ New! Hugging Face MCP Server Image Generation Samples!**
35+
- **� New! Basic Chat App for OpenAI gpt-oss Model!**
36+
37+
Try out our new [Basic Chat application](./03-CoreGenerativeAITechniques/src/BasicChat-07Ollama-gpt-oss) designed to test the [OpenAI gpt-oss model](https://openai.com/index/introducing-gpt-oss/). This sample demonstrates how to use the latest open-source model from OpenAI in a .NET console app, making it easy to experiment with conversational AI locally or in the cloud.
38+
39+
- **🖼️ Hugging Face MCP Server Image Generation Samples!**
3640

3741
Explore new C# console app samples that show how to use the Hugging Face MCP Server to generate images directly from your code.
3842

3943
- [Try the sample using GitHub Models or Azure AI Foundry](./03-CoreGenerativeAITechniques/src/MCP-01-HuggingFace/Program.cs)
4044
- [Use Ollama for local model inference](./03-CoreGenerativeAITechniques/src/MCP-02-HuggingFace-Ollama/Program.cs)
4145

42-
- **🕹️ New! Apps Generated with AI**
46+
- **🕹️ Apps Generated with AI**
4347

4448
We're excited to introduce a new section featuring full applications generated with AI tools like GitHub Copilot Agent. These apps demonstrate how generative AI can be used to build real-world .NET solutions leveraging AI as a co-pilot.
4549

@@ -88,7 +92,6 @@ You'll learn how to implement Generative AI into .NET projects, from basic text
8892
| Spanish | es | [Spanish Translation](./translations/es/README.md) | 2025-06-24 |
8993
| German | de | [German Translation](./translations/de/README.md) | 2025-06-24 |
9094

91-
9295
> **Note:** All translations were updated to match the original content on **2025-06-24**. See [PR #161](https://github.com/microsoft/Generative-AI-for-beginners-dotnet/pull/161) for details.
9396
9497
## 🛠️ What You Need
@@ -142,7 +145,7 @@ We have a lot of other content to help your learning journey. Check out:
142145
- [AI Agents for Beginners - A Course](https://aka.ms/ai-agents-beginners)
143146
- [Data Science for Beginners](https://aka.ms/datascience-beginners)
144147
- [ML for Beginners](https://aka.ms/ml-beginners)
145-
- [Cybersecurity for Beginners](https://github.com/microsoft/Security-101)
148+
- [Cybersecurity for Beginners](https://github.com/microsoft/Security-101)
146149
- [Web Dev for Beginners](https://aka.ms/webdev-beginners)
147150
- [IoT for Beginners](https://aka.ms/iot-beginners)
148151
- [XR Development for Beginners](https://github.com/microsoft/xr-development-for-beginners)

0 commit comments

Comments
 (0)