CoPhilot

Creating the model driven app

​Now we have our tables with the UX ready we can create the app. It is mainly about organizing the navigation, and which tables should be on the menu.

Do not forget to save and publish.

You can play the app from here to test it.

Shot 14

Creating the bot in Copilot Studio

This section is pure conversational UX design. I personally find it practical to build the bot unfolding linearly the conversation. I like to think of it as designing “chat wireframes”. First, make sure to create the bot (agent) in the proper solution.

Once the agent (bot) gets created it comes with examples of custom topics. I usually start by deleting them all. We can’t delete system topics. I turn off the ones I am not planning on using. It keeps things cleaner.

Shot 15

Conversational orchestration engine

Deciding on the conversation engine is a structuring decision in the bot design. You can change it as you iterate on the agent.

Shot 16

The Generative orchestration is Microsoft novel conversation engine leveraging generative AI to detect topics and actions that needs to be launched (example : if the user says, “I want to eat sushi”, the orchestration understand we need to trigger a topic for restaurant reservations without the need to have a trigger phrase saying “Eat sushi”).

It is essentially using function calling for the conversation orchestrator. It aims to simplify drastically bot authoring and offer more fluid conversations with the user. Today it is in preview, it is free to use but not ready for production. Product team is working hard to make it GA. It will most likely have an additional cost every time it orchestrates to a particular topic or action.

Classic is the classic orchestration Conversational UX engine. It detects topic based on triggered phrases (and more). It works, it is GA, it is in production at scale all over the world.

I suggest starting with the classic engine, first it is GA and you will appreciate and design better with the new conversion engine later. With the bot architecture pattern we are building here, there are plenty other places where it makes sense to inject GenAI first. With this architecture we also could make our own little orchestration engine if we need to.

Shot 17

The Conversation Start topic

The first topic that triggers in the bot is the Conversation Start topic. It is a system topic (you can’t delete it) that you can and should author.

When deploying the bot in Teams, it only triggers once when the user installs the bot. Think of Teams channel as an infinite conversation from an orchestration perspective.

In our example, we’ll be surfacing in Teams, that is why we are not putting business logic in there.

All we do is redirect the Conversation Starter topic to the Reset Conversation topic.

The Reset Conversation topic

This topic is called every time the user wants to have a new conversation with the model.

We first launched a Power Automate flow, detailed in the next section, to create a new conversation in our Conversation Dataverse table and return as a front-end variable the internal id of the newly created conversation that we display for debugging in the chat.

Make the ConversationId variable a global variable as we’ll carry it across topic.

Shot 18

Now we have our conversation created, it is good place to script whatever introduction message to the user.

Now we have the conversation with the other global variables we’ll need to call our model are the system prompt and API endpoint and keys. We use the environment variables previously created to initialize them with Phi 3 endpoint and key.

Shot 19

As an example, here is the system prompt I am using in this agent (bot):

"You are chatting with the user in MS Teams.

Your name is CoPhilot. It is a silly play with Microsoft 'Phi' Small Language Model and Microsoft 'Copilot Studio' the chat orchestration solution.

You are the technology proof data science teams can bring their own Azure AI model in Copilot Studio so everyone can chat with it safely and securely in Teams like we are doing now.

Your architecture is Phi 3 deployed as a Model as a Service on Azure AI and surfaced here in Teams by Copilot Studio.

Your actual goal is to help the user with whatever they ask."

Shot 20
Shot 21
Shot 22

Calling Power Automate to create a new Conversation

In the context of Copilot Studio, I like to think of Power Automate as the gate between frontend and backend development. Almost like my Power Automate flows are equivalent to an API call I can design. When call from Copilot Studio Power Automate premium connectors are entitled. In essence, it makes Power Automate a great feature of Copilot Studio for prototyping.

It is important to note that Power Automate is an event driven architecture. Even if the calls from Copilot Studio feel real time it is asynchronous. Copilot Studio also offers other options to true real time API calls like when using the send HTTP request node.

When prototyping I always start with Power Automate as it helps to keep the user’s experience elegant. In a pure design thinking spirit, I often mockup my Power Automate flow with test fake data and work with the backend later, allowing me to ‘stay in the flow’ of the Copilot Studio topic I am working on.