This repo contains a demo of how to use the Microsoft.Extensions.AI library.
The code is not intended for production and has been written with the purpose of clearly presenting the library concepts. No best practices nor patterns were used when writing this code.
All local models used in the application are served by Ollama. You must install Ollama in order to execute those models. Install instructions and requirements can be found on https://ollama.com.
The following models where downloaded from Ollama
- llama3.1:8b
- llama3.2
- qwen2.5:7b
You can change the models used or add extra models by modifying ChatClientFactory.cs
Azure Open AI can be used to run this application. You can follow this link to deploy the models on Azure.
The code expects gpt-4o to be deployed on your endpoint as well OPENAI_ENDPOINT and OPENAI_KEY to be set in your environment variables, alternatively you can modify ChatClientFactory.cs to use the values directly.
You can download the SDK from here
- Make sure to have the requirements installed
- Start Ollama by running
ollama serve - Ensure the required models are downloaded
- Clone the repository
- Navigate to directory
- Run
dotnet run