Teams AI Library – Boost your Teams bots with AI

If you are a developer, or a consultant who isn’t afraid to open Visual Studio, who wants to create smarter bots for Microsoft Teams, you should be interested in the Teams AI Library, a new tool that simplifies the integration of generative AI and user intent engines into your apps. The Teams AI library is currently in public developer preview, and it offers a range of features and benefits that can help you build intelligent apps quicker and easier. I am not a dev, and yet I was able to create smart bot with user intent functions as a demo / PoC. Teams AI Library simplifies a lot of things.

What is Teams AI Library?

Teams AI library is a Teams-centric interface to GPT-based common language models and user intent. This means that you don’t need to write complex conversational bot logic to leverage the power of LLMs, such as Azure OpenAI’s GPT model. Instead, you can use prebuilt, reusable code snippets that provide a simple capabilities-driven approach for your app. This also means that more devs can take action on developing smarter Teams bots.

The Teams AI library helps you focus on building the business logic rather than diving deep to Teams bot development (not that it wouldn’t hurt – in fact with deeper understanding you can create more and better experiences when combining that knowledge with Teams AI Library).  You can use prebuilt templates and add your own modules such as bots, message extensions, Adaptive Cards, etc.

Picture from Teams AI Library page in Learn.

Main features

The Teams AI library has several features that make it a powerful tool for building intelligent apps for Teams. Some of the main features are:

  • GPT-powered language models: The Teams AI library uses GPT-powered language models to understand user intents and generate natural language responses. This makes building AI-powered Teams apps easier, more compliant, and consistently usable than ever before.
  • In-context bots: Library allows your bots to run in-context and assist when they recognize a user intent that maps to one of their actions. This boosts the conversation without requiring users to explicitly talk to the bot using a small set of registered actions
  • Prompt engineering: You can add prompts that consider user’s intent, context of the conversation, and the bot personality. You can personalize and customize your bots to meet user needs and preferences.
  • Context-aware conversations: Bots can remember context across messages and it helps to improve the bot performance by analyzing patterns in user behavior. Your bots can also use ambient presence to learn intent, use prompts based on business logic, and generate responses.
  • LLM flexibility: The Teams AI library is built to use OpenAI’s GPT model, but you have the flexibility to swap with any LLM of your choice without changing the bot logic. This means you can choose to keep your app’s content outside the public domain and confined to your preferred LLM model.
  • Ethical and responsible conversational apps: You can create ethical and responsible conversational apps by providing moderation hooks. This help you regulate bot responses and monitor conversations. Azure Content Safety moderation hooks are not there just yet, but they will be. However Content Safety moderation is there, working under the hood.

Testing Teams AI Library

Since this was announced at Microsoft Build 2023, I was curious to take a look at it – and could I be utilizing it as well. As I am no dev, there were obvious bumps on the road until I got pieces together. Of course I wanted to give a live demo about Teams AI Library in Scottish Summit 2023, so I spent several evenings during July building and breaking my demo. I did manage to get it working, despite strange preview-“features” like requirement to name model deployment to start with gpt or otherwise intent events didn’t work. I am sure it will be fixed.

For my demo at Scottish Summit, I included obviously some jokes that included something Scottish and gave the AI a bit of personality there. This is the chat conversation I had with the bot at the Summit session.

What is the cool thing about Teams AI Library is that it uses AI to understand the meaning and then relays that to the bot actions. In this example I had defined get and set functions for the conference name and event location. Whenever AI understood from the text the intent, it fired the event to call the function in question. This means that we don’t have to write exact commands to the bot, but we can say things in the natural language.

Prompt Engineering part is where it is possible define what kind of abilities bot has. And of course its personality as well. So I gave the bot caricature Scottish accent.

In the available prompt actions are presented. Those are then translated to functions in the code

As this was a very simple demo, and the first POC for me, I just wanted to see that those relevant functions are called. While I just have a fixed content there, it can be easily expanded to calls to other services and to more complex logic.

It is also possible to add standard bot commands and actions to the bot as well.

Microsoft has also stated that Teams AI Library is a way to extend current bots with AI capabilities. So if you have a bot, which one you want to upgrade to AI era – you definitely should take a look at Teams AI Library!

How can I get started with Teams AI Library?

If you want to try out the Teams AI library and see how it can help you build intelligent bots for Teams faster and easier, you can follow these steps:

The experience

As a consultant who hasn’t been building this kind of application it wasn’t a breeze for me. Luckily Teams Toolkit and sample applications were there, because after getting through some weird bugs (like the model name..) pieces started to click together to form a whole object. From that experience I can say that seasoned devs will find this easy. For seasoned consultants – you can do it, if you just explore a bit!

I see this a one good step on the road towards smarter user experience!

One thought on “Teams AI Library – Boost your Teams bots with AI

Leave a comment

This site uses Akismet to reduce spam. Learn how your comment data is processed.