Skip to content

Commit 0b52f85

Browse files
authored
Merge pull request #91 from microsoft/bruno-adding-phi4-mini
Adding "phi4-mini" in samples, codespaces and docs
2 parents cc277f7 + d57922f commit 0b52f85

File tree

9 files changed

+24
-17
lines changed

9 files changed

+24
-17
lines changed

.devcontainer/Ollama/devcontainer.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,7 @@
3737
},
3838

3939
// Use 'postCreateCommand' to run commands after the container is created.
40-
"postCreateCommand": "sudo dotnet workload update && sudo dotnet workload install aspire && sudo dotnet workload list && ollama pull all-minilm && ollama pull llama3.2 && ollama pull phi3.5",
40+
"postCreateCommand": "sudo dotnet workload update && sudo dotnet workload install aspire && sudo dotnet workload list && ollama pull all-minilm && ollama pull llama3.2 && ollama pull phi4-mini",
4141
"postStartCommand": "",
4242

4343
// Uncomment to connect as root instead. More info: https://aka.ms/dev-containers-non-root.

02-SetupDevEnvironment/getting-started-ollama.md

+1-3
Original file line numberDiff line numberDiff line change
@@ -63,7 +63,7 @@ Once your Codespace is fully loaded and configured, let's run a sample app to ve
6363
6464
## Swap out the model in Ollama
6565
66-
One of the cool things about Ollama is that it's easy to change models. The current app uses the "**llama3.2**" model. Let’s switch it up and try the "**phi3.5**" model instead.
66+
One of the cool things about Ollama is that it's easy to change models. The sample apps uses models like "**phi4-mini**" or "**llama3.2**" model. Let’s switch it up and try the "**phi3.5**" model instead.
6767

6868
1. Download the Phi3.5 model by running the command from the terminal:
6969

@@ -93,8 +93,6 @@ One of the cool things about Ollama is that it's easy to change models. The curr
9393
1. **Narrow AI** – Designed for specific tasks, such as facial recognition software, voice assistants like Siri or Alexa, autonomous vehicles, etc., which operate under a limited preprogrammed set of behaviors and rules but excel within their domain when compared to humans in these specialized areas.
9494
9595
2. **General AI** – Capable of understanding, learning, and applying intelligence broadly across various domains like human beings do (natural language processing, problem-solving at a high level). General AIs are still largely theoretical as we haven't yet achieved this form to the extent necessary for practical applications beyond narrow tasks.
96-
97-
...
9896
```
9997
10098
> 🙋 **Need help?**: Something not working? [Open an issue](https://github.com/microsoft/Generative-AI-for-beginners-dotnet/issues/new?template=Blank+issue) and we'll help you out.

02-SetupDevEnvironment/readme.md

+4-4
Original file line numberDiff line numberDiff line change
@@ -37,16 +37,16 @@ Here's a quick rundown of the services:
3737

3838
The Ollama Codespace will provision all the necessary models that you need. However, if you are working in local mode, once you have installed Ollama, you need to pull the models for the lessons you want to run.
3939

40-
- For lesson "**02 - Setting Up for .NET Development with Generative AI**" and project [MEAIFunctionsOllama](https://github.com/microsoft/Generative-AI-for-beginners-dotnet/tree/main/02-SetupDevEnvironment/src/BasicChat-03Ollama) you need to pull model [llama3.2](https://ollama.com/library/llama3.2) by entering in terminal
40+
- For lesson "**02 - Setting Up for .NET Development with Generative AI**" and project [MEAIFunctionsOllama](https://github.com/microsoft/Generative-AI-for-beginners-dotnet/tree/main/02-SetupDevEnvironment/src/BasicChat-03Ollama) you need to pull a model like [phi4-mini](https://ollama.com/library/phi4-mini) or [llama3.2](https://ollama.com/library/llama3.2) by entering in terminal
4141

4242
```bash
43-
ollama pull llama3.2
43+
ollama pull phi4-mini
4444
```
4545

46-
- For lesson "**03 - Core Generative AI Techniques with .NET**", when running the ollama projects like [RAGSimple-10SKOllama](https://github.com/microsoft/Generative-AI-for-beginners-dotnet/tree/main/03-CoreGenerativeAITechniques/src/RAGSimple-10SKOllama), you need to pull the models [all-minilm](https://ollama.com/library/all-minilm) and [phi3.5](https://ollama.com/library/phi3.5) by entering in terminal:
46+
- For lesson "**03 - Core Generative AI Techniques with .NET**", when running the ollama projects like [RAGSimple-10SKOllama](https://github.com/microsoft/Generative-AI-for-beginners-dotnet/tree/main/03-CoreGenerativeAITechniques/src/RAGSimple-10SKOllama), you need to pull the models [all-minilm](https://ollama.com/library/all-minilm) and [phi4-mini](https://ollama.com/library/phi4-mini) by entering in terminal:
4747

4848
```bash
49-
ollama pull phi3.5
49+
ollama pull phi4-mini
5050
ollama pull all-minilm
5151
```
5252

02-SetupDevEnvironment/src/BasicChat-03Ollama/Program.cs

+3-3
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,10 @@
11
using Microsoft.Extensions.AI;
22

3-
// you can test with the models "llama3.2" and "phi3.5"
3+
// you can test with the models "phi4-mini" or "llama3.2"
44
// to test other models you can download them with the command "ollama pull <modelId>"
5-
// in example: "ollama pull deepseek-r1" or "ollama pull phi4-mini" (for the phi4-mini model which is still being tested)
5+
// in example: "ollama pull deepseek-r1" or "ollama pull phi3.5"
66
IChatClient client =
7-
new OllamaChatClient(new Uri("http://localhost:11434/"), "llama3.2");
7+
new OllamaChatClient(new Uri("http://localhost:11434/"), "phi4-mini");
88

99
var response = client.GetStreamingResponseAsync("What is AI?");
1010
await foreach (var item in response)

03-CoreGenerativeAITechniques/src/BasicChat-03Ollama/Program.cs

+2-2
Original file line numberDiff line numberDiff line change
@@ -2,11 +2,11 @@
22
using System.Text;
33

44
IChatClient client =
5-
new OllamaChatClient(new Uri("http://localhost:11434/"), "llama3.2");
5+
new OllamaChatClient(new Uri("http://localhost:11434/"), "phi4-mini");
66

77
// here we're building the prompt
88
StringBuilder prompt = new StringBuilder();
9-
prompt.AppendLine("You will analyze the sentiment of the following product reviews. Each line is its own review. Output the sentiment of each review in a bulleted list and then provide a generate sentiment of all reviews. ");
9+
prompt.AppendLine("You will analyze the sentiment of the following product reviews. Each line is its own review. Output the sentiment of each review in a bulleted list including the original text and the sentiment, and then provide a generate sentiment of all reviews. ");
1010
prompt.AppendLine("I bought this product and it's amazing. I love it!");
1111
prompt.AppendLine("This product is terrible. I hate it.");
1212
prompt.AppendLine("I'm not sure about this product. It's okay.");

03-CoreGenerativeAITechniques/src/BasicChat-04OllamaSK/Program.cs

+1-1
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
using Microsoft.SemanticKernel.Connectors.Ollama;
66
using OllamaSharp;
77

8-
var modelId = "llama3.2";
8+
var modelId = "phi4-mini";
99
var uri = "http://localhost:11434/";
1010

1111

03-CoreGenerativeAITechniques/src/RAGSimple-10SKOllama/Program.cs

+1-2
Original file line numberDiff line numberDiff line change
@@ -25,13 +25,12 @@
2525

2626
#pragma warning disable SKEXP0001, SKEXP0003, SKEXP0010, SKEXP0011, SKEXP0050, SKEXP0052, SKEXP0070
2727

28-
using DocumentFormat.OpenXml.Bibliography;
2928
using Microsoft.KernelMemory;
3029
using Microsoft.KernelMemory.AI.Ollama;
3130
using Microsoft.SemanticKernel;
3231

3332
var ollamaEndpoint = "http://localhost:11434";
34-
var modelIdChat = "phi3.5";
33+
var modelIdChat = "phi4-mini";
3534
var modelIdEmbeddings = "all-minilm";
3635

3736
// questions

03-CoreGenerativeAITechniques/src/RAGSimple-15Ollama-DeepSeekR1/Program.cs

-1
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,6 @@
3030
using Microsoft.SemanticKernel;
3131

3232
var ollamaEndpoint = "http://localhost:11434";
33-
//var modelIdChat = "phi";
3433
var modelIdChat = "deepseek-r1";
3534
var modelIdEmbeddings = "all-minilm";
3635

README.md

+11
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,16 @@ Don't forget to [star (🌟) this repo](https://docs.github.com/en/get-started/e
2626

2727
➡️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.
2828

29+
## ✨ What's New!
30+
31+
We're constantly improving this course with the latest AI tools and models:
32+
33+
- **phi4-mini model support**: The [Ollama Codespace](https://github.com/microsoft/Generative-AI-for-beginners-dotnet/blob/main/02-SetupDevEnvironment/getting-started-ollama.md) now automatically downloads the [phi4-mini model](https://ollama.com/library/phi4-mini) - Microsoft's compact yet powerful LLM. Try it in samples like:
34+
- [Chat Application](https://github.com/microsoft/Generative-AI-for-beginners-dotnet/blob/main/03-CoreGenerativeAITechniques/src/BasicChat-03Ollama/Program.cs) - Experience fast responses with this efficient model
35+
- [RAG Implementation](https://github.com/microsoft/Generative-AI-for-beginners-dotnet/blob/main/03-CoreGenerativeAITechniques/src/RAGSimple-10SKOllama/Program.cs) - See how phi4-mini handles retrieval-augmented generation tasks
36+
- Learn more about the model in the [Phi Cookbook](https://aka.ms/phicookbook)
37+
38+
2939
## 🚀 Introduction
3040

3141
Generative AI is transforming software development, and .NET is no exception. This course aims to simplify the journey by offering:
@@ -124,5 +134,6 @@ We have a lot of other content to help your learning journey. Check out:
124134
- [Mastering GitHub Copilot for Paired Programming](https://github.com/microsoft/Mastering-GitHub-Copilot-for-Paired-Programming)
125135
- [Mastering GitHub Copilot for C#/.NET Developers](https://github.com/microsoft/mastering-github-copilot-for-dotnet-csharp-developers)
126136
- [Choose Your Own Copilot Adventure](https://github.com/microsoft/CopilotAdventures)
137+
- [Phi Cookbook: Hands-On Examples with Microsoft's Phi Models](https://aka.ms/phicookbook)
127138

128139
[Let's start learning Generative AI and .NET!](02-SetupDevEnvironment/readme.md) 🚀

0 commit comments

Comments
 (0)