All right. >>> Welcome, everyone to the end
Of day two at build. We appreciate you hanging with
Us for two really, really long days. My name is mark.
This is pria. And we are here to talk to you
About building an inclusive language feedback loop using
Microsoft graphic cognitive services.
This is going to be a lot of live demo.
Not too much talking. We recognize we are the last
Thing between you and dinner or beer. Although i guess this guy found
A beer somewhere. Can you fight him for his beer.
We will move quickly for this and be available for questions afterwards.
All right. So there is this amazing quote
About inclusive language. There exists everyone a
Sentence, a serious of words that has the power to destroy
Pup one exists. Another series of woortsdz this w ords that can
Heal you. In today's day and age,
Inclusive langth with is an important facet of being
Important in the modern workplace. Not just because it is the right
Thing to did but because it enablees a better workplace.
When you use encollusive eninclusive
We use exclusive language or noninclusive language in various
Times and place possess p when i was putting it deck together, i
Have a slide coming up in a couple of slides with a whole
Bunch of different emojies. One i use is the rock and roll
Hand or the i love you sign. Someone pointed out it me in a
Private e-mail thread that sometimes e-mail threads are not
Tirp rhett had the same across the world.
While that doesn't seem to be interpret had rudely anywhere i
Did remove it and replace it with something else.
Sometimes we just have these unconscious usages of language
Or emojis or what have you that result in bad outcomes.
So today we are going to build an application.
Piece together a bunch of different stuff. And we are going to build an
Application this will tell us when we are not using inclusive language.
So of course this being build you might think the promise is
Entirely grander graph, and i'm going to come sell you this
Amazing solution that is entirely 100 graph powered.
In fact we do make a lot of promises with graph, and we do
Have a ton of data and intelligence in graph. But the reality is that it is
Missing some things. So we promise all these things
About all your data is accessible. Today we will access data from exchange.
We promise things are for corporate and consumer users.
And they are. We promise you only is to use
One api key. One sdk.
One set of documentation. And do you.
But still things are missing. So we have gaps in graph and
Graph is not really 100 of the picture.
But this is okay. Because this is where you guys
Come in and where you can fill in that missing piece and add
Value by pairing graph in its data and intelligence together
With other sets of data and intelligence. And so, we are going to
Supplement graph to make one whole puzzle by pairing the data
From microsoft graph with cognitive services. Again in your real life
Scenario, it may not be cognitive services that you turn to.
You may turn to data or your own intelligence services or someone
Else's intelligence services. We are just showing you how they
Might work together. A look at the overallic big
Picture of what we will build? about ten minutes here and we do
This by laying out a series of different icons here.
If this is jim. Jim is fictional.
He doesn't bear any redisem luns hopefully.
So he draftes this e-mail. Sends it out.
It doesn't matter how the e-mail is sent.
It could be sent through outlook for ios mail client.
Through the web app. It doesn't really matter how it gets sent.
Graph will notice that e-mail has been sent.
And it will allow you to take appropriate actions on it.
One of the things can you do with graph is register red hook
Subscription so upon certain events like the sending the
E-mail graph will reach out to your notification and tell you
Something has happened so you can take action.
In our case graph will trigger a web hook.
That azure function will take up that notification. So specifically it will receive
The id of the e-mail sent. It will turn around and go and
Ask microsoft graph for the bod ea of that e-mail and take the
Body of the e-mail and send it up to cognitive services for
Evaluation. So cognitive services has bunch
Of services available inside of it. One of the service says the
Content moderator service. And content moderator service
Can be configured with custom term lists. So specifically setting up a
Custom term list that will look for some noninclusive language.
It is pretty trivial in our case. But you can imagine how you
Might build this out more or use different service like lewis or
Something like that to get richer intelligence.
Once cognitive service evaluates the text, if it is inclusive, awesome.
Like if it is a good outcome, good job, jim.
If it is not inclusive, they we will turn around and send a
Separate e-mail back it jim. I want to point out this is a
Closed loop. Goes from jim to 1kwreu78.
Ton jim's manager. Not available to the ept prize
In any way shape or form. Tional scenario.
This is a closed-loop e-mail. Hopefully jim is able to learn
Something and use more inclusive language next time around.
Which, again, will result in an awesome outcome.
This is overall picture of what it is that we will build.
Now we will jump into live dem yoas all the way through.
I will use my phone to make sure we use the right steps.
Pria here will walk us through things.
Step one is to register in application with microsoft
Graph. When you register an application
With microsoft graph there are a bunch of things they will ask you for.
Bare minimum is a nim. If pria clicks on the app she
Has to supply name. Then she has to click create of that point.
When you create application for this particular scenario, we
Need to request certain sets of permissions.
Specifically request mail rewrite and mail send so we can
Read that e-mail and send another e-mail in response.
We are going to request those as application permissions as
Opposed to delegate a permission.
I will zoom in a little bit. Zoom in a lot.
I'm not going to zoom in. I'm just going to let you
Control it. We request these as application
Permissions because the function of sending and receiving e-mail
Is running without a user logged in. It is republicanning as an
Application. So we had to request application permission.
This makes the scenario sploo slightly more complicated.
Onsent to the application. Since there is a user logged in,
An administrator has to consent to the application.
We will skip that step because it is complicated and ugly and
Administrator generally know how to do that sort of thing anyway.
But it is a good thing to look up afterwards.
Well share fairly detailed instructions of how to step
Through all wait through it and we will make sure that's in
There. But we have configured a local
Host url for this to call back to.
Not really used. Important for admin consent.
We have set up application permissions pch once we have our
Application configured the next thing we need to did is register
Cognitive services. And we will hopefully not have a
Time-out here. You can actually sign up for a
Trial subscription for the content moderator service
Specifically. This will allow you to kick the tires.
If you're building a production app you want to sign up for real
Subscription. Services vary.
And they are free to run for a while.
And some have initial cost. Be sure to look at pricing.
What we are using here is free to tryout.
In cognitive services there is a couple different things to give it.
You have to give it a name. Tell it where you are using it.
You want proximity to be close to where you actually are.
In our case we don't care about that stuff.
We filled in dummy values. We just will go in and grab
Values we will need later in the process.
Specific lit end point url for cognitive service.
That will be used to configure the list and we will also need
The subscription key which we will use to both configure the
List as well as invoke the evaluation of our text.
So next we need to set up the list management api.
We will jump over it post man. We have a total of three api
Calls here that will always be calls, all thrie will be posts.
They will all go -- oh, boy. Oh, good, perfect.
They are all going to that url that we saw.
The first one creating the list itself.
So step number one is create a list. Step number two is add terms to
The list. Step three is update the index.
So step number one we need to supply nim to the list.
So we have a post here that has application jason.
Can you see we supplied name for the list.
When this htp call is sent we will get back to one created and
We get an id for the list. In a real scenario you need to
Use this id for subsequent calls.
We will just use the same list we have plugged into our thing.
But you would need this list for subs quint api calls.
So the second call goes out it create terms for noninclusive
Language. In this case we call the bulk
Update api. There are other ways to create
Terms in the content moderator. We will pass a bunch of terms at
Once. In this case using guys and
Girls. Guys as reasonably obvious.
Unless you use boys and girls is not an appropriate term to use.
So when we send this bulk update again we get a positive response
And successful response and now our list has terms in it.
And in the last thing we need do is go out and update that
Subscription. Or sorry, update the complex.
So once we have executed these three calls we can move on to
The next step which is creating azure function app.
For the sake of time i will assume most people here have
Created an azure app before. One way is to use visual studio
To create an app. If you have it, you can download
For azure functions. This gives you the ability to
Debug locally and do testing locally before you push it up to
Azure. And as handy dandy publish and
Push it up to azure. First thing, if you haven't
Published before, you can publish to a new function app
And not require to you go into the azure portal which is pretty nice.
We have published before. We have a published target
Configured. And so we just have a couple of
Nugget dependencies we were using and we push up from
Studio. If times allows we will jump
Back to key parts of the code in a second here.
So once we have the azure function app configured, we do
Need to plug in some special stuff to settings.
Client id. Client secret we got when we
Created the application. Subscription key.
And again, you want to protect your settings, secure settings
Bet are than put them in configure file somewhere.
Probably azure key vault or something along those lines is a bet are solution.
Then we go ahead and publish that azure function.
We have done that in this particular case.
One thing do when we publish the azure function, is grab the
Function url once it is published. Do you have to jump into the
Azure portal for. She has loaded up the azure
Function here. Clicking on get function url or
Whatever it says there. And she is going to grab that
Function you rl. So again, like here are pieces
We have. There is a list and subscription
Key. A graph application with client
Id and client secret. Now a url.
We will create the loop and web hook subscription.
So now that we've got our azure function we are going to create
The web hook subscription. We will abuse graphics floor a
Little bit for this. You have probably heard about
It. If you vpt, give it a try on
Your mobile device. This is like a streamline issuing request against
Microsoft graph. If you log into the tool went he
We have logged in from a fictional demain tenant.
You can do write requests. I will advise you these are
Really write requests. This is actually happening
Behind the scenes. We will create a subscription.
But if we create new mail here, it will create new mail.
It is a great way to fid eanl try things in microsoft graph.
A couple things. We will post to the
Subscriptions urr. You cannot set this up to post
Unless you are logged in. The body has a couple things in
It. Change for us is created.
Url called back is that azure function url that we use.
The resource is everything in her sent items folder.
If something is created in megan's items sent folder we
Want the web hook to be triggered.
And expiration time needs to be within the next three days.
So 72 hours from now. Okay, so when we create this we
Get a successful response back. And now we are fully up and running.
We have our content moderator configured with its list.
Azure function running and listening.
Web hook created so it will end is out notification as soon as
We send an e-mail. Let's send an e-mail.
Now we send into outlook.Com. Logged in as megan bowen again.
Because that's when the e-mail is configured around. And it is going to her friend, patty.
-Mail body. It will fire the web hook.
We will look that at the azure function log and make sure the
Web hook is being called. Web function calls out it
Microsoft graph. Get the body in the e-mail.
Send the body of the e-mail up to cognitive services and evaluate it.
It is not using inclusive langth with in this particular case and
Megan will get a reply that says hey here are some inclusivity
Tips that might work with you next time.
So with that we completed our full demo arc.
We can look quickly in code here. We are in deck.
For the first time the web hook is created, it is important to
Have azure function running before you try to register the
Web hook subscription. The first thing that happens
When you issue that request is graph will send you a test web
Hook. It will have a particular token
To grab and send back to graph with a 200 response as plain text response.
So you grab the validation token and round trip that back to graph.
So that is one thing to be aware of.
From there, then resumefully any other indication is a real
E-mail that is getting sent. So we will just spool off into
Code that will grab this e-mail and send it up to cognitive services.
Again we will post this code. You will see the link to get to
It in a second here. So next steps for you guys,
Number one, definitely go try graph explorer right away again.
It works on your mobile didevice and computers.
Didn't matter where you are. You don't have to be logged in
To use it. But you can be logged in with
Your consumer account. What you do takes, so be
Careful. Next, you can stop by the
Microsoft graph booth. It is in this direction.
Either tonight or tomorrow. We have people there at all
Points in time and they can talk to you about any of the tm
Apis about microsoft graph. Idea then steal ours.
Go build awesome apps and profit, hopefully.
There are other exceptions you should be aware of.
Tomorrow there are two more breakout sessions on microsoft graph.
They are noted here. A bunch of theater sessions
Still to come tomorrow on microsoft graph.
And of course we love connecting with customers.
Connect are on twitter.
Own github. With organization microsoft graph.
And you can contribute to microsoft graph if you want to.
And tag your questions with microsoft graph.
With that, i thank you for your time. I will give you a whole whopping
Two minutes and change back and if you have questions for me or
Pria, please feel free to come up.