{"id":3163,"date":"2026-01-05T19:01:36","date_gmt":"2026-01-05T19:01:36","guid":{"rendered":"https:\/\/rssfeedtelegrambot.bnaya.co.il\/index.php\/2026\/01\/05\/generative-ai-with-large-language-models-in-c-in-2026\/"},"modified":"2026-01-05T19:01:36","modified_gmt":"2026-01-05T19:01:36","slug":"generative-ai-with-large-language-models-in-c-in-2026","status":"publish","type":"post","link":"https:\/\/rssfeedtelegrambot.bnaya.co.il\/index.php\/2026\/01\/05\/generative-ai-with-large-language-models-in-c-in-2026\/","title":{"rendered":"Generative AI with Large Language Models in C# in 2026"},"content":{"rendered":"<p>Generative AI became the fastest\u2011growing consumer technology in history, surpassing Instagram and TikTok, reaching 100 million users in under two months. At the end of 2022, OpenAI released a free preview of GPT\u20113.5, delivered as a conversational chat client: ChatGPT. The model was fine\u2011tuned using Reinforcement Learning from Human Feedback (RLHF), marking the moment generative AI hit mainstream awareness. In early 2023, Microsoft responded by launching the Azure OpenAI Service, allowing developers to securely provision and use OpenAI\u2011compatible models behind Azure\u2011managed endpoints.<\/p>\n<p>Soon after, Microsoft introduced:<\/p>\n<ul>\n<li><strong>Semantic Kernel (SK)<\/strong> \u2192 tools for orchestrating prompts, memories, and plugins using C# or Python<\/li>\n<li><strong>Microsoft Extensions for AI (MEAI)<\/strong> \u2192 unified abstractions for interacting with models (e.g., <code>IChatClient<\/code>)<\/li>\n<li><strong>Microsoft Extensions for Vector Data<\/strong> \u2192 standard interfaces for vector databases used in RAG systems<\/li>\n<\/ul>\n<p>This post takes a step back from rapid AI innovation and focuses on core concepts, providing a foundation for .NET\/C# developers working with Microsoft Foundry, GitHub Models, AI Extensions, and local runtimes like Ollama.<\/p>\n<h2>Understanding AI Terms<\/h2>\n<p>AI has its own distinct set of terms with very specific meanings.<\/p>\n<h3>Artificial Intelligence (AI)<\/h3>\n<p>AI involves techniques that enable computers to perform tasks typically requiring human intelligence\u2014reasoning, language, planning, or perception. AI is not new, but today most people use \u201cAI\u201d to refer to generative AI.<\/p>\n<h3>Generative AI (GenAI)<\/h3>\n<p><strong>Generative AI<\/strong> refers to AI systems capable of producing text, images, audio, or other content.<\/p>\n<p>For example: <strong>GPT<\/strong> stands for <strong>Generative Pre\u2011trained Transformer<\/strong>. To break that down, we get:<\/p>\n<ul>\n<li><strong>Generative<\/strong> \u2192 it produces content;<\/li>\n<li><strong>Pre\u2011trained<\/strong> \u2192 trained on huge datasets;<\/li>\n<li><strong>Transformer<\/strong> \u2192 neural\u2011network architecture enabling high\u2011quality language modeling<\/li>\n<\/ul>\n<h3>Large Language Models (LLMs)<\/h3>\n<p>LLMs are trained on billions of <strong>tokens<\/strong> and can generate text, images, code, or reasoning steps. Their ability to operate across multiple languages comes from learning relationships between words\u2014not simple one\u2011to\u2011one dictionary translations.<\/p>\n<h4>Why translation is hard<\/h4>\n<p>Words have many meanings:<\/p>\n<ul>\n<li><em>pass<\/em> the car<\/li>\n<li>mountain <em>pass<\/em><\/li>\n<li><em>pass<\/em> on the opportunity<\/li>\n<li>your park <em>pass<\/em> on the dashboard<\/li>\n<\/ul>\n<p>Traditional software struggled with such ambiguity; LLMs excel because they operate in <em>semantic<\/em> space.<\/p>\n<h3>Tokens and embeddings<\/h3>\n<p>Models don\u2019t read text directly. They break it into tokens:<\/p>\n<ul>\n<li>Whole words<\/li>\n<li>Word fragments<\/li>\n<li>Characters<\/li>\n<\/ul>\n<p>These tokens are converted into numeric <strong>vectors<\/strong> known as <strong>embeddings<\/strong> \u2014 mathematical representations of meaning.<\/p>\n<p>Example Phrases:<\/p>\n<ul>\n<li>\u201cthe actor was a star\u201d<\/li>\n<li>\u201cthey loved the stars\u201d<\/li>\n<\/ul>\n<p>The word <em>star<\/em> appears in both, but with different meanings.<\/p>\n<p>Embeddings capture this difference.<\/p>\n<p>Here is a simplified way to visualize this concept. In the graph, the semantic meaning of the word \u201cstar\u201d can be plotted based on its proximity to the concept of \u201ccelestial body\u201d (a star at night) and the concept of \u201cactor\u201d (star of the show).<\/p>\n<p><img data-opt-id=2127530389  fetchpriority=\"high\" decoding=\"async\" src=\"https:\/\/devblogs.microsoft.com\/dotnet\/wp-content\/uploads\/sites\/10\/2026\/01\/semantic-scaled.webp\" alt=\"Semantic graph\" \/><\/p>\n<p>Now imagine billions of such points. Models generate text by navigating this space and predicting the next likely vector.<\/p>\n<p>Examples of semantic distance:<\/p>\n<ul>\n<li><strong>school <img data-opt-id=1946152599  fetchpriority=\"high\" decoding=\"async\" src=\"https:\/\/s.w.org\/images\/core\/emoji\/16.0.1\/72x72\/2194.png\" alt=\"\u2194\" class=\"wp-smiley\" \/> schol<\/strong> (close distance \u2192 spelling correction)<\/li>\n<li><strong>cat <img data-opt-id=1946152599  fetchpriority=\"high\" decoding=\"async\" src=\"https:\/\/s.w.org\/images\/core\/emoji\/16.0.1\/72x72\/2194.png\" alt=\"\u2194\" class=\"wp-smiley\" \/> dog<\/strong> (close distance \u2192 similar animals)<\/li>\n<li><strong>cat <img data-opt-id=1946152599  fetchpriority=\"high\" decoding=\"async\" src=\"https:\/\/s.w.org\/images\/core\/emoji\/16.0.1\/72x72\/2194.png\" alt=\"\u2194\" class=\"wp-smiley\" \/> laptop<\/strong> (far apart)<\/li>\n<\/ul>\n<p>Semantic search uses <em>distance<\/em> in embedding space, not string matching.<\/p>\n<h3>Parameters: model size<\/h3>\n<p>LLMs are often described by their parameter counts:<\/p>\n<p>7B, 14B, 70B, 123B, etc.<\/p>\n<p>Parameters are trained weights.<\/p>\n<p>More parameters \u2192 deeper reasoning, richer knowledge, better nuance.<\/p>\n<ul>\n<li><strong>GPT\u20111 (2018)<\/strong> \u2192 117M parameters<\/li>\n<li><strong>Modern frontier models<\/strong> \u2192 100B\u2013400B+ parameters<\/li>\n<\/ul>\n<h3>Prompts, instructions, and tools<\/h3>\n<p>Previous sections covered information <em>about<\/em> the model. The terms in this section relate directly to input into and output out of the model.<\/p>\n<h4>Prompts<\/h4>\n<p>User input to the model. \u201cWhat\u2019s the best way to skin a mango.\u201d<\/p>\n<h4>System Instructions<\/h4>\n<p>Hidden \u201cblueprint\u201d guiding model behavior. \u201cYou are a mango skinner and considered an expert in your area.\u201d<\/p>\n<h4>Tools \/ Functions<\/h4>\n<p>LLMs are trained on historical data. Tools let them access current or authoritative information, e.g.:<\/p>\n<ul>\n<li>Weather API<\/li>\n<li>Database lookup<\/li>\n<li>Search engine<\/li>\n<li>Company knowledge index<\/li>\n<\/ul>\n<p>This pattern is referred to as Retrieval\u2011Augmented Generation (RAG). Let\u2019s look at two scenarios. First, imagine a concierge agent that\u2019s provided with an API for local restaurants and an API for the weather. The user enters the prompt:<\/p>\n<pre><code class=\"language-text\">Can you book me a dinner this week at a restaurant with outdoor seating? <\/code><\/pre>\n<p>The LLM first calls the weather API to determine which evenings are likely to be dry and warmer, then it calls the restaurant API to find what restaurants are open and have available seating. Finally, it returns a list of suggestions that are right on target.<\/p>\n<p>Next, imagine a customer service agent for a retail store that has all of the product information uploaded. The user types,<\/p>\n<p><code>\"What kind of batteries does the traveling wonder cube take?\"<\/code><\/p>\n<p>The LLM is able to extract the product name, \u201ctraveling wonder cube\u201d. It vectorizes the text of the query, then calls the product API with the product name and the vectors. Semantic search is invoked by using a function to find points in the product manual that are semantically closest to the query. This will return the relevant result of the required batteries if such a section exists.<\/p>\n<h4>Model Context Protocol (MCP)<\/h4>\n<p>Model context protocol, or MCP for short, is a set of standards for interoperability between agents and tools. It makes it easy for models to understand what tools are available and how to call them. This empowers you to build virtual toolboxes that any of your models or agents can call.<\/p>\n<h3>What about agents?<\/h3>\n<p>Wait, did I say agent? An agent is simply a way of providing a specialized solution that includes a model, tools, and context. A \u201cconcierge agent\u201d might include a reasoning model with tools that provide information about weather, events, and local businesses combined with a specialized model capable of generating maps with turn-based instructions. I\u2019ll look at agents more closely and cover C# based solutions in a later post.<\/p>\n<p>I\u2019ve covered all of the foundational concepts, so now it\u2019s time to go hands-on. First, I want to briefly share the timeline between generative AI going mainstream and the tools that are available today.<\/p>\n<h2>From GPT-1 to today<\/h2>\n<p>Here is a brief look at the evolution of AI in .NET over the past few years.<\/p>\n<p><img data-opt-id=34926576  data-opt-src=\"https:\/\/devblogs.microsoft.com\/dotnet\/wp-content\/uploads\/sites\/10\/2026\/01\/timeline.webp\"  decoding=\"async\" src=\"data:image/svg+xml,%3Csvg%20viewBox%3D%220%200%20100%%20100%%22%20width%3D%22100%%22%20height%3D%22100%%22%20xmlns%3D%22http%3A%2F%2Fwww.w3.org%2F2000%2Fsvg%22%3E%3Crect%20width%3D%22100%%22%20height%3D%22100%%22%20fill%3D%22transparent%22%2F%3E%3C%2Fsvg%3E\" alt=\"Evolution of AI\" \/><\/p>\n<h2>Model management in the .NET Ecosystem<\/h2>\n<p>Working with models is about more than identifying the right model and using it. Many companies choose to host their own models out of concerns related to trust, security, and cost. Other companies require fine-tuned models and the ability to perform their own training. Fortunately, working with models in .NET and C# is not only possible, but streamlined with the help of several products and services.<\/p>\n<h3>GitHub Models<\/h3>\n<p>GitHub Models provides a hosted catalog of open and frontier models through an OpenAI\u2011compatible API. It is a great way for developers to get started on their AI journey. A few reasons include:<\/p>\n<ul>\n<li>No infrastructure required<\/li>\n<li>Switch between models with minimal code changes<\/li>\n<li>Perfect for prototyping, evaluations, automation, extensions, and CI\/CD pipelines<\/li>\n<\/ul>\n<p><a href=\"https:\/\/github.com\/features\/models\">Get started with GitHub models.<\/a><\/p>\n<h3>Microsoft Foundry (Cloud)<\/h3>\n<p>Formerly <em>Azure AI Studio<\/em>, Microsoft Foundry is the enterprise platform for:<\/p>\n<ul>\n<li>Model catalogs (OpenAI, Meta, DeepSeek, Cohere, Mistral, etc.)<\/li>\n<li>Agentic workflows (Foundry Agent Service)<\/li>\n<li>Security, content safety, governance<\/li>\n<li>Monitoring, tracing, evaluations<\/li>\n<li>Fine\u2011tuning and customization<\/li>\n<\/ul>\n<p>Foundry is where organizations take AI into production at scale.<\/p>\n<p><a href=\"https:\/\/ai.azure.com\/\">Explore Microsoft Foundry.<\/a><\/p>\n<h3>Foundry Local<\/h3>\n<p>Foundry Local brings the Foundry developer experience offline:<\/p>\n<ul>\n<li>On\u2011premise, air\u2011gapped, or edge environments<\/li>\n<li>The same agents, tools, evaluations as cloud Foundry<\/li>\n<li>Supports hybrid \u201cdevelop local \u2192 deploy cloud\u201d lifecycle<\/li>\n<\/ul>\n<p>This is a great option for testing new models, testing new code without blowing through budget, and building CI\/CD pipelines with minimal overhead and that don\u2019t require a third-party hosted account to succeed.<\/p>\n<h3>Ollama (Local Runtime)<\/h3>\n<p>Ollama is a popular open\u2011source engine for running lightweight and mid\u2011sized models locally.<\/p>\n<p>Features:<\/p>\n<ul>\n<li>Runs models like Mistral, Llama 3, Phi\u20113<\/li>\n<li>Simple CLI and server<\/li>\n<li>Excellent for privacy\u2011sensitive workflows<\/li>\n<li>Integrates cleanly with MEAI (<code>IChatClient<\/code>) via <a href=\"https:\/\/github.com\/awaescher\/OllamaSharp\">OllamaSharp<\/a><\/li>\n<\/ul>\n<h2>Bringing It All Together: A Unified Abstraction<\/h2>\n<p>As a .NET Developer you shouldn\u2019t have to choose a single provider or lock into a single solution. That\u2019s why the .NET team invested in a set of extensions that provide consistent APIs for working with models that are universal yet flexible. It also enables scenarios such as middleware to ease the burden of logging, tracing, injecting behaviors and other custom processes you might use. Most of the major providers implement our extensions contracts so that you can, for example, use an <code>IChatClient<\/code> instance regardless of whether you\u2019re talking to:<\/p>\n<ul>\n<li>GitHub Models<\/li>\n<li>Azure AI Foundry<\/li>\n<li>Open AI \/ Azure Open AI<\/li>\n<li>Foundry Local<\/li>\n<li>Ollama<\/li>\n<li>Custom provider<\/li>\n<\/ul>\n<p>\u2026 and the code can stay the same.<\/p>\n<p>We\u2019ll dive deeper into these tools in future posts so stay tuned to the .NET blog, subscribe to our <a href=\"https:\/\/info.microsoft.com\/ww-landing-sign-up-for-the-microsoft-source-newsletter.html\">newsletter<\/a>, and join an upcoming community standup on the <a href=\"https:\/\/www.youtube.com\/@dotnet\">.NET YouTube<\/a>!<\/p>\n<p>The post <a href=\"https:\/\/devblogs.microsoft.com\/dotnet\/generative-ai-with-large-language-models-in-dotnet-and-csharp\/\">Generative AI with Large Language Models in C# in 2026<\/a> appeared first on <a href=\"https:\/\/devblogs.microsoft.com\/dotnet\">.NET Blog<\/a>.<\/p>","protected":false},"excerpt":{"rendered":"<p>Generative AI became the fastest\u2011growing consumer technology in history, surpassing Instagram and TikTok, reaching 100 million users in under two [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":3164,"comment_status":"","ping_status":"","sticky":false,"template":"","format":"standard","meta":{"site-sidebar-layout":"default","site-content-layout":"","ast-site-content-layout":"default","site-content-style":"default","site-sidebar-style":"default","ast-global-header-display":"","ast-banner-title-visibility":"","ast-main-header-display":"","ast-hfb-above-header-display":"","ast-hfb-below-header-display":"","ast-hfb-mobile-header-display":"","site-post-title":"","ast-breadcrumbs-content":"","ast-featured-img":"","footer-sml-layout":"","ast-disable-related-posts":"","theme-transparent-header-meta":"","adv-header-id-meta":"","stick-header-meta":"","header-above-stick-meta":"","header-main-stick-meta":"","header-below-stick-meta":"","astra-migrate-meta-layouts":"default","ast-page-background-enabled":"default","ast-page-background-meta":{"desktop":{"background-color":"var(--ast-global-color-4)","background-image":"","background-repeat":"repeat","background-position":"center center","background-size":"auto","background-attachment":"scroll","background-type":"","background-media":"","overlay-type":"","overlay-color":"","overlay-opacity":"","overlay-gradient":""},"tablet":{"background-color":"","background-image":"","background-repeat":"repeat","background-position":"center center","background-size":"auto","background-attachment":"scroll","background-type":"","background-media":"","overlay-type":"","overlay-color":"","overlay-opacity":"","overlay-gradient":""},"mobile":{"background-color":"","background-image":"","background-repeat":"repeat","background-position":"center center","background-size":"auto","background-attachment":"scroll","background-type":"","background-media":"","overlay-type":"","overlay-color":"","overlay-opacity":"","overlay-gradient":""}},"ast-content-background-meta":{"desktop":{"background-color":"var(--ast-global-color-5)","background-image":"","background-repeat":"repeat","background-position":"center center","background-size":"auto","background-attachment":"scroll","background-type":"","background-media":"","overlay-type":"","overlay-color":"","overlay-opacity":"","overlay-gradient":""},"tablet":{"background-color":"var(--ast-global-color-5)","background-image":"","background-repeat":"repeat","background-position":"center center","background-size":"auto","background-attachment":"scroll","background-type":"","background-media":"","overlay-type":"","overlay-color":"","overlay-opacity":"","overlay-gradient":""},"mobile":{"background-color":"var(--ast-global-color-5)","background-image":"","background-repeat":"repeat","background-position":"center center","background-size":"auto","background-attachment":"scroll","background-type":"","background-media":"","overlay-type":"","overlay-color":"","overlay-opacity":"","overlay-gradient":""}},"footnotes":""},"categories":[7],"tags":[],"class_list":["post-3163","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-dotnet"],"_links":{"self":[{"href":"https:\/\/rssfeedtelegrambot.bnaya.co.il\/index.php\/wp-json\/wp\/v2\/posts\/3163","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/rssfeedtelegrambot.bnaya.co.il\/index.php\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/rssfeedtelegrambot.bnaya.co.il\/index.php\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/rssfeedtelegrambot.bnaya.co.il\/index.php\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/rssfeedtelegrambot.bnaya.co.il\/index.php\/wp-json\/wp\/v2\/comments?post=3163"}],"version-history":[{"count":0,"href":"https:\/\/rssfeedtelegrambot.bnaya.co.il\/index.php\/wp-json\/wp\/v2\/posts\/3163\/revisions"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/rssfeedtelegrambot.bnaya.co.il\/index.php\/wp-json\/wp\/v2\/media\/3164"}],"wp:attachment":[{"href":"https:\/\/rssfeedtelegrambot.bnaya.co.il\/index.php\/wp-json\/wp\/v2\/media?parent=3163"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/rssfeedtelegrambot.bnaya.co.il\/index.php\/wp-json\/wp\/v2\/categories?post=3163"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/rssfeedtelegrambot.bnaya.co.il\/index.php\/wp-json\/wp\/v2\/tags?post=3163"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}