Posts

Showing posts with the label azure

Using LLMs and MCP in .NET

Introduction This post picks up where this one left. It will be my second post on using LLMs, and AI, in general. This time I'm going to cover integrating MCP tools with the LLM's response. MCP stands for Model Context Protocol , and it is an open standard . In a nutshell, it is a protocol designed to help LLMs communicating with the real world, for example, accessing a database, getting real-time weather information for a specific location, creating a ticket in some system, sending out an email, etc. We need an MCP host and some tools registered with it. There are many ways by which LLMs can communicate with the MCP host, always using JSON-RPC 2.0 for messaging: Standard input/output, if running on the same machine HTTP calls Streams, mainly for the same machine Custom-defined Now, I won't go through all of them now, I'll just pick HTTP transport, as it's probably the most usual one. Also, I will be using the  OpenAI  API. Essentially, we registe...

Generating Structured Code Using Azure, OpenAI and .NET

Image
Introduction This will be the first post on AI that I write, which is really a shame, as it's such an interesting and vast topic; you should expect more in the future! This time I'm going to talk about code generation from inside .NET using OpenAI  and it's Azure integration , in a structured way. As you know, code generation is one of the typical usages for Large Language Models (LLMs); it is part of what is called generative AI . It essentially works out of the box, but we can tweak it to be more useful. In this post I’ll show how we can get multiple files in response to a prompt. We will use Azure, but all the concepts are really from OpenAI. Let's start from the beginning. Setting Up OpenAI in Azure From the Azure portal , start by creating a new resource of type Microsoft Foundry  (it supports OpenAI  and others): QIf you need more info on this operation, please have a look here . You can now see it in the dashboard page: The end...