hello-ai: A Simple Demonstration of Azure OpenAI

I wrote some code demonstrating how to use Azure OpenAI to support the AI mini-workshop we ran for Virtual Boston Azure. I created versions in Python and C#.

This weekend I create a web front-end for it and deployed as an Azure Static Web App with an Azure Function supporting the refactored C# logic to execute the Azure OpenAI service calls.

The new app is running here: https://hello-ai.doingazure.com

You can find the source code here: https://github.com/codingoutloud/hello-ai

Note that while the additional grounding fails to stop all of the hallucinations, it does help with the most obvious one (so we are making progress) but there’s more to be done.

Workshop: AI Mini-Workshop at Boston Azure

The March 28 Virtual Boston Azure was headlined by Pamela Fox from Microsoft. She explained all about the RAG pattern which is commonly used for building effective applications based on Large Language Models (“LLMs”) and Generative AI (“GenAI”). Pamela shared many superb insights, including lots of depth, while answering a ton of interesting follow-up questions. Was a fantastic talk. Boston Azure has a YouTube channel at youtube.com/bostonazure where you can find recordings of many past events. Pamela Fox’s talk is available there as the 48th video to be posted to the channel.

After Pamela’s talk around 15 people stuck around to participate in our first ever “AI mini-workshop” hands-on experience. The remainder of this post is about that mini-workshop.

The AI mini-workshop was a facilitated hands-on coding experience with the following goals:

1. Demystify Azure OpenAI

As background, OpenAI’s ChatGPT burst onto the scene in November 2022. That led to an explosion of people learning about AI and associated technologies such as “LLMs” which is the common shorthand for Large Language Models.

The vast majority of people interact with LLMs via chat interfaces such as available from OpenAI’s public version of ChatGPT or via Copilot on Microsoft Bing search. There’s also a more integrated programming experience surfaced through GitHub Copilot for use with VS Code and several other popular IDEs.

But what about programming your own solution that uses an LLM? Microsoft has done a great job of providing an enterprise-grade version of the OpenAI LLM as a set of services known as Azure OpenAI.

The first goal of this AI mini-workshop was to demystify this programming experience.

This was accomplished by giving the mini-workshop participants a working C# or Python program that fit on a page. And there are only around 10 lines of meaningful code needed to interact with the AI service. This is NOT that complex.

Creating a production-grade application has additional requirements, but at its core, it is straight-forward to interact with Azure OpenAI service programmatically.

The hoped for “Aha!” moment was this:

Aha #1! I can do this! I can programmatically interact with the Azure OpenAI LLM. It isn’t that mysterious after all.

Aha #2! This is possible without much code! In the Python and C# solutions shared there were only around 10 lines of core code.

2. Understand Some AI Concepts

Part of the mini-workshop exercise was to recognize a hallucination and fix it through some additional grounding using a very simple form of RAG.

The hope here is for some “Aha!” moments:

Aha #3! Here’s a concrete, understandable example of a hallucination!

Aha #4! And here’s a concrete, simple example use of RAG pattern to better ground the AI so that it no longer hallucinates about today’s date! But do note that other hallucinations remain…

3. Wield Great Power

The ability to program a LLM to generate unique content is something that essentially NO DEVELOPER COULD DO, EVER, before the super-powerful LLMs that were developed at costs of hundreds of millions of dollars and democratized by the Microsoft Azure OpenAI services (as well as by OpenAI themselves).

The hands-on AI mini-workshop required either (a) a functional Python 3 environment, or (b) a functional C#/.NET environment – everything else was provided, including sufficient access to the Azure OpenAI LLM service to complete the mini-workshop.

But in the end with very little coding you can get to the 5th Aha! moment which is:

Aha #5! I have at my command capabilities that have not been possible in all of the history of computers. The magic of LLMs available via Azure OpenAI gives me superpowers that we are only in the very beginning of understanding the ways this can be put to use.


The source code for the AI mini-working is available here. Note that the API key has subsequently been rolled (invalidated), but the code works pretty well otherwise. 🙂

My original thinking was to distribute the keys separately (like this). If this was an in-person workshop I would have kept the configuration values separated from the source, but given the added challenge of doing this with an online distributed audience I decided to simplify the mini workshop by included the configuration values directly in the source code. Looking back, I believe it was a good concession for minimizing obstacles to learning. So I’d do it again next time.

Talk: Boston Code Camp 36 – Meet GitHub Copilot, Your AI Coding Assistant!

23-Mar-2024

Always great to hang out with the greater Boston tech community. Today I attended and contributed a talk to Boston Code Camp 36 (the 36th edition of this event).

I made the trip with Maura (she gave a talk on blockchain). and we met a lot of cool people and had a great time.

I spoke on GitHub Copilot. Much of my talk was demo and discussion – you have to see this in action (or use it) to appreciate what’s happening. I consider this a glimpse into the future – it will surely become then norm to have an AI assistant when programming.

It is fun have one AI 🤖 (GitHub Copilot) help us program another AI 🤖 (Azure OpenAI). 🤖 🤖 🤖 😀 After Copilot Chat was able to explain that Azure OpenAI did not have any notion of “today” we used Copilot to implement a trivial version of RAG to anchor the prompt to the current day.

We saw how the agents like @workspace can explain a body of code and even help us figure out where to implement a new feature (such as the --joke command line param).

Another demo was to get Copilot to write unit tests for me. The demo gods were not helpful 😱 😱 😱 and I ran into an error. I moved on without fixing it since time was short. I diagnosed it later and it turns out I had double-pasted (classic demo failure!) which caused the problem. We did use /tests to create unit tests, which were initially NUnit test, but then we asked Copilot to recast them as xUnit tests, then to more efficiently create test cases using the InlineData attribute to consolidate similar test cases.We didn’t get to run the tests at the end, but hopefully the power of GitHub Copilot in helping to create unit tests came through.

I also had the opportunity to hang out with some smart soon-to-be graduates from my alma mater – University of Massachusetts at Boston (some of them were Rohini Deshmukh, Master’s in Information Technology, Kunal Sahjwani, Master’s in Information Technology, and Shounak Kulkarni, Master’s in Business Analytics). Great to see our profession is in such capable hands from chatting with these very smart and capable technologists, analysts, and future leaders.

Here is the published talk abstract for the talk I delivered – and though much of the session was demos, the PowerPoint deck is attached after the abstract.

Meet GitHub Copilot, Your AI Coding Assistant

Imagine an assistant who anticipates your needs as you code, handling mundane and time-consuming steps, allowing you to focus on more complex challenges (the fun stuff). Allow me to introduce you to GitHub Copilot.

GitHub Copilot is an AI-powered coding assistant that integrates with your developer IDE adding many powerful productivity features. Backed by the same OpenAI Large Language Model (LLM) behind ChatGPT, it has an uncanny ability to suggest code snippets that you were about to type in. But suggesting code snippets is just the beginning.

In this demo-heavy talk, we’ll show usage basics, distinguish scenarios where it excels vs. some it finds challenging, and point out a few common anti-patterns so you can avoid them.

Since it is still early days, big features are still showing up at a fast clip, so we’ll highlight some recent features and some others just emerging. At the end we’ll squeeze in just a bit of prognosticating about what it might mean for the future of software development.

As you’ll learn in more depth during this session, the promise of GitHub Copilot is to help you be more productive – go faster, stay in flow, build even more robust software. We are not fully there but we are on the way. This imperfect tool is still a game changer.

I believe the rise of AI coding assistants is unstoppable at this point – and that’s a good thing. By the end of this session, you might agree. And maybe you’ll join the revolution early.

Talk: Orlando Code Camp – Meet GitHub Copilot

24-Feb-2024

Had a great time hanging out with the Orlando tech community at their annual Code Camp. I made the trip with Maura (she gave a talk on blockchain) and we met a lot of cool people and had a great time.

I spoke on GitHub Copilot. Much of my talk was demo and discussion – you have to see this in action (or use it) to appreciate what’s happening. I consider this a glimpse into the future – it will surely become then norm to have an AI assistant when programming.

One part of the demo showed using one AI (GitHub Copilot) to help program another AI (Azure OpenAI).

It is invigorating to engage with a vibrant community of technologists. Thank you Orlando Code Camp organizers, sponsors, and all those in the tech community!

The deck I used in the talk is both attached for download and available on slideshare.

Talk: Meet GitHub Copilot, your AI Coding Assistant at Granite State Code Camp 02-Dec-2024

My talk description:

According to legend, programmers back in the stone age would write code without IntelliSense and refactoring tools. The next generation of developers will wonder how our generation got anything done without AI-powered assistants. If you don’t know what GitHub Copilot is all about then come on by to get a glimpse of the future.

In this fast-paced demo-heavy talk we will see how you can go faster, stay in flow, and maybe even do more (unit tests anyone?) with GitHub Copilot, which became commercially available during 2023. Along the way we’ll learn to talk like an AI nerd by explaining and examining terms like “prompt engineering” (how to get Copilot to do what we really want), prompts vs. suggestions, what is a “conversational AI”, what do you mean by “non-deterministic”, and how does this relate to ChatGPT (and its underlying LLM). And hallucinations. All will be explained.

The deck I used:

Talk: Exploring DORA! at Boston Code Camp 35

(I gave two talks at this event – the other one was on GitHub Copilot.)

Always great to engage with the OG Code Camp crew at Boston Code Camp. My talk description:

Haven’t heard about DORA yet? You will.

The annual DevOps Research and Assessment Report — affectionately known as the “DORA Report” — is a data-driven, research-backed set of practices and metrics that will make engineers happier and more productive while improving not just dev, ops, and security outcomes, but also business outcomes. DORA tends to also shine a light on practices that are common within teams that are measurably more effective than industry averages – examples will be drawn from cloud technologies, automation, and security outcomes.

In this talk we’ll explore the DORA report as a data-driven toolbox for helping you “get better at getting better” in the software delivery realm. We will give some historical context, then zoom in on findings from the recently published 2023 report. The goal is for you to leave this talk with an overall appreciation of the breadth of coverage and the impact of DORA as well as some specific metrics and capabilities you’ll want to focus on to level up your own teams.

The deck I used:

Talk: Meet GitHub Copilot! at Boston Code Camp 35

(I gave two talks at this event – the other one was on DORA.)

Always great to engage with the OG Code Camp crew at Boston Code Camp. My talk description:

According to legend, programmers back in the stone age would write code without IntelliSense and refactoring tools. The next generation of developers will wonder how our generation got anything done without AI-powered assistants. If you don’t know what GitHub Copilot is all about then come on by to get a glimpse of the future.

In this fast-paced demo-heavy talk we will see how you can go faster, stay in flow, and maybe even do more (unit tests anyone?) with GitHub Copilot, which became commercially available during 2023. Along the way we’ll learn to talk like an AI nerd by explaining and examining terms like “prompt engineering” (how to get Copilot to do what we really want), prompts vs. suggestions, what is a “conversational AI”, what do you mean by “non-deterministic”, and how does this relate to ChatGPT (and its underlying LLM). And hallucinations. All will be explained.

The deck I used:

Talk: GitHub Copilot is your AI Pair Programming Assistant

08-Aug-2023

I gave an extended demo of GitHub Copilot at the Boston Azure AI event tonight. Most of the session was a demo, but I did also walk through some slides. Those slides are attached.

I also showed these links or services:

Talk: GitHub Copilot: Meet Your AI Pair Programming Assistant!

On 27-June-2023 at our first back-from-the-pandemic in-person regularly scheduled Boston Azure monthly meeting, the main event featured Juan Pablo Garcia Gonzalez from Microsoft talking about Azure OpenAI ChatGPT Prompt Engineering for Developers. Juan Pablo was kind enough to share his slides and code samples.

Keeping with the AI theme, I opened with a talk about GitHub Copilot where I gave a brief demo and explanation, then attempted to put it into context among other AI tools (including other Microsoft Copilot initiatives).

The deck I used is attached to this post:

Talk: Using GitHub Copilot to Code Azure (Boston Azure edition of Global Azure Bootcamp)

13-May-2023

Veronika Kolesnikova, Jason Haley, and myself jointly hosted the Boston Azure edition of Global Azure Bootcamp. It was a sold out show – excellent turnout (around 50 participants).

I presented a couple of segments, one of which was to inspire use of AI tools. For that I gave a demo of GitHub Copilot, explained how to use the free trial, and was there to support the occasional questions by new users of GitHub Copilot during the bootcamp.

The opening talk was also AI:

My talks were later – GitHub Copilot the rolled into hacking on Azure for the rest of the day. And of course, those who opted to do so used GitHub Copilot to help them do so more efficiently. 😉