This sample is a C# console application that uses Generative AI services like Ollama or Azure OpenAI to:
- Generate customer support ticket summaries
- Generate embeddings for product manuals
- Perform semantic search over product manuals
- ManualIngestor.cs - Ingestion service that extracts data from product manual PDF files, chunks text into smaller segments, generates embeddings, saves them to a JSON file.
- ProductManualService.cs - Storage service that uses an
IVectorStore
to save and search product manual embeddings. - TicketSummarizer - AI service which uses an AI model to generate summaries of customer support tickets.
- .NET 8 SDK
- Ollama
- (Optional) Azure subscription. Create one for free.
Get started setting up your environment using either GitHub Codespaces or Dev Containers.
Environment | Codespaces | DevContainer |
---|---|---|
GPU (Recommended) | N/A | Coming Soon |
CPU | Coming soon |
For this application, you can either use local language and embedding models with Ollama or models hosted on Azure OpenAI.
-
Download llama3.2 language model
ollama pull llama3.2
-
Download all-minilm embedding model
ollama pull all-minilm
-
In Program.cs, depending on what you want to use the model for set:
useOpenAIChat
tofalse
useOpenAIEmbeddings
tofalse
-
Deploy a chat and embedding model. For more details, see the Azure OpenAI documentation.
- chat - A language model that supports chat. (i.e.
gpt-35-turbo
) - embedding - An embedding model. (i.e.
text-embedding-3-small
)
See the Azure OpenAI documentation for a full list of models available.
If you use deployment names other than chat and embedding, update them in
Program.cs
; - chat - A language model that supports chat. (i.e.
-
In Program.cs, depending on what you want to use the model for set:
useOpenAIChat
totrue
useOpenAIEmbeddings
totrue
-
Configure environment variables for your endpoint and key. For more details, see the Azure OpenAI documentation.
- AZURE_OPENAI_ENDPOINT - Your Azure OpenAI endpoint.
- AZURE_OPENAI_KEY - Your Azure OpenAI Key.
By using a managed identity from Microsoft Entra, your application can easily access protected Azure OpenAI resources without having to manually provision or rotate any secrets.
- Assign Azure OpenAI user role to your managed identity. For more details, see the documentation.
- In Program.cs, set
useManagedIdentity
totrue
.