Skip to main content

Posts

Showing posts with the label C# OpenAI API

Azure AI Search with C#: Build Smart Search (2026)

Learn Azure AI Search with C# — index data, run vector and hybrid queries, and add RAG to your .NET app. Start building intelligent search today. If your application's search box still runs a LIKE '%term%' query against SQL Server, your users are quietly suffering. They type "cheap laptop for uni" and get zero results because your catalogue says "affordable notebook for students." Azure AI Search with C# fixes exactly this problem: it combines classic keyword search, vector embeddings, and semantic reranking into a single managed service that you can drive from .NET with a few dozen lines of code. In this tutorial you'll build a working search index from scratch, run keyword, vector, and hybrid queries, and finish with a Retrieval Augmented Generation (RAG) pattern that grounds an LLM in your own data. This guide targets .NET 9 and the Azure.Search.Documents v11 SDK. Every snippet is runnable. We'll explain why each design choice matter...

Fine-Tune AI Models & Call Them From C# (2026 Guide)

Learn how to fine-tune AI models and call them from C# with OpenAI and Azure OpenAI. Step-by-step code examples inside — start building today. Why Fine-Tuning AI Models Matters for C# Developers Fine-tuning AI models is one of the most searched-for skills in modern software development — and for good reason. While base models like GPT-4o and Claude are impressively general, they don't know your company's tone of voice, your domain-specific terminology, or your internal classification rules. Fine-tuning solves this: you take a pre-trained model and continue training it on your own examples, producing a custom model that responds exactly the way your business needs. In this guide, you'll learn how fine-tuning works, when to use it (and when not to), how to prepare training data, how to run a fine-tuning job, and — most importantly for us — how to call your fine-tuned model from a C# application using .NET 8/9. Here's the WHY before the HOW: a fine-tuned smaller mode...

Fine-Tune AI Models and Call Them from C# (Full Guide)

Learn how to fine-tune AI models like GPT and call them from C# with the OpenAI .NET SDK. Step-by-step code, best practices — start building today. Fine-tuning AI models is one of the most searched-for skills in modern software development — and for good reason. A fine-tuned model can outperform a much larger general-purpose model on your specific task, respond faster, and cost less per request. In this full guide, you'll learn what fine-tuning actually does, when you should (and shouldn't) use it, how to prepare training data, how to run a fine-tuning job on the OpenAI platform, and — most importantly for us — how to call your custom model from a C# application using the official OpenAI .NET SDK. Everything here is practical and runnable with .NET 8 or later. Whether you're a beginner searching "how to fine-tune GPT in C#" or a senior engineer evaluating fine-tuning versus RAG for a production system, this guide covers the full workflow end to end. What I...

Build an AI Chatbot with C# and OpenAI API (2026 Guide)

Learn how to build an AI chatbot in C# with the OpenAI API. Step-by-step .NET 8 tutorial with streaming, history & function calling. Start coding now! Building an AI chatbot is one of the most in-demand skills for .NET developers in 2026, and the good news is that the C# OpenAI API integration story has never been better. With the official OpenAI .NET SDK, you can go from an empty console project to a fully functional, streaming, context-aware chatbot in under an hour. In this complete tutorial, you'll learn how to build an AI chatbot with C# and the OpenAI API from scratch — including conversation history, streaming responses, function calling, and the production best practices most tutorials skip. We'll explain not just how each piece works, but why it's designed that way, so you can adapt this foundation to web apps, Blazor, ASP.NET Core APIs, or desktop applications. What You'll Build and What You Need By the end of this tutorial you'll have a c...