[ad_1]
Microsoft is consistently evolving and enhancing its AI companies, and the Azure OpenAI might be one of many quickest companies to evolve. There may be now assist for GPT-4 Turbo with Imaginative and prescient, DALL-E3, enhanced content material filtering and it retains on enhancing. Azure OpenAI Capabilities is one thing that varied AI apps are using – and no marvel, as a result of it’s a improbable function and offers AI apps intelligence. In December 2023, Microsoft made modifications to this functionality API, deprecating the previous capabilities API that was in use between summer season and December 2023. As an alternative, it has been changed within the newest API model ( 2023-12-01-preview) with new Instruments-definitions, which have introduced modifications to the JSON schema. Whereas the potential continues to work as earlier than, builders might want to make just a few modifications to their code to adapt to those updates. On this weblog put up, we’ll discover these modifications and supply steerage on find out how to replace your code to make sure a easy transition to the brand new Instruments-definitions.
Be aware: whereas Capabilities in API are already deprecated, the previous code nonetheless works. You will need to replace to new Instruments API, as a result of the previous Capabilities API is not going to be there sooner or later.
If you’re utilizing API model that sooner than 2023-12-01-preview, ensure to replace your code to make use of the newest one. Earlier ones will probably be retried on 2nd of April 2024.

What are Azure OpenAI Capabilities / Instruments? What modified to Azure OpenAI Service API 2023-12-01-preview? The brand new tools-schema examples Instrument response Conclusion
Azure OpenAI capabilities are a approach to combine the highly effective language fashions of Azure OpenAI Service with different programs and instruments. They let you outline customized instruments that the fashions can name based mostly on the context of the immediate. Because of this the AI can perceive what your intent is, based mostly in your immediate and dialog.
Some examples of Azure OpenAI capabilities are:
Retrieving climate of a talked about metropolis. Simply use town title, that’s extracted from the immediate by functions-feature and create the logic to retrieve climate info – for instance from Bing Climate. With this your chatbot can reply weather-related questions.
Making a ticket. You could have a bot that may assist you to troubleshoot finish person issues. Embedding a operate that understands {that a} service ticket must be created, can automate the method – and make it very easy for the person.
Fetching info. Maybe you could entry some real-time information from the manufacturing facility, inventory exchanges, you title it. Making the bot to know this with capabilities could make the dialog and usefulness rock.
What this implies, is that the AI is rather more smarter and it’s simpler to create clever purposes that perceive what the person is aspiring to do.
What modified to Azure OpenAI Service API 2023-12-01-preview?
In brief: capabilities and function_call parameters have been deprecated within the newest model of API. The performance hasn’t modified, solely the schema. The brand new phrases are instruments (was capabilities) and tool_choice (was function_call) parameters.

The brand new title is sensible. You introduce instruments for AI, that can be utilized when a necessity arises (person intent from the immediate).
Be aware: on this weblog put up I solely speak about modifications in API relating to Capabilities à Instruments change. There was different modifications as nicely, for the total listing take a look at the API 2023-12-01-preview definition and likewise What’s new web page. One of many coolest additions has been the assist for GPT-4 Turbo with Imaginative and prescient, however that could be a matter for an additional weblog put up.
Once I began to replace my function-examples I didn’t discover any easy instance that might present in JSON how instruments and tool_choices work. It took me some trial-and-error to search out out. In the long run the answer was easier than I believed at first. However I feel this could actually assist you if you’re beginning to work with these.
The climate retrieval of a specified metropolis. That is the instruments a part of the JSON API name that’s despatched to the Azure OpenAI endpoint. The highest stage array is instruments, and capabilities are launched one per merchandise.

That isn’t the total API name – simply the place you outline instruments/capabilities. What’s fascinating is the device kind definition. It’s clearly giving room so as to add different kinds of instruments to the schema later.
Right here is the total API name instance. I’ve a behavior of including instruments to the tip of name.

Keep in mind: instruments / capabilities should be included on each name to AOAI (Azure OpenAI) API.
When the decision returns from AOAI, you could be aware that the JSON is barely completely different than it was with capabilities in earlier API model. Reply to that question is now:

From that JSON we have an interest within the choices-array, however as you may see additionally the accountable AI / content material filtering result’s returned in the identical JSON. Now, let’s deal with finish_reason. When finish_reason is tool_calls and that tells us, we have to get device info from the JSON and do the magic of that device. On this case the magic is to retrieve the climate of given metropolis. All related info is discovered within the tool_calls array.

This merchandise offers us details about which device to make use of and with what parameters. Each device name has an id, which is required within the reply. From that we all know we have to get the climate of Turku, Finland.
As soon as we have now the climate info, we have to inform it again to AI. That is one other format that has modified on this functions->instruments improve.

We’re including requests to name instruments and solutions from the device to the dialog, in messages block. You will need to inform that are from the person, AI (assistant) or from the device. Name ID must be included as nicely.
Now that we have now this info, we’re calling AI once more with device response with the instance above. Then AI will reformat the reply from the operate get_weather with content material to pure language. This time we’re getting reply like this:

Now the finish_reason is cease, which suggests there is no such thing as a have to name different instruments. In case you’ve one other device, it will imply including these JSON messages ( assistant telling to name the device, device replying to the person) for the JSON. Sure, the JSON is getting longer on a regular basis. And bear in mind to maintain all tools-definitions within the name.
Conclusion
Once I began to experiment with these capabilities, it wasn’t that clear how the dialog (message alternate) with the AI wanted to be formatted. I had been utilizing capabilities since July and had already found out the dialog circulation. The circulation itself didn’t change, however how device calls and returns are outlined in JSON did.
The message circulation for one device/operate name is
System immediate introduction (system)
Person immediate (person)
Instrument response from AI. (assistant)
Name the backend to retrieve information and add response to AI (device)
Pure language response from AI (assistant)
With a number of device calls, the circulation can appear like this
System immediate introduction (system)
Person immediate (person)
Instrument response from AI. (assistant)
Name the backend to retrieve information and add response to AI (device)
Instrument response from AI. (assistant)
Name the backend to retrieve information and add response to AI (device)
(repeat these instruments response & device’s responses till the finish_reason is cease)
Pure language response from AI (assistant)
If you wish to see instruments (capabilities) in motion and speak with about these reside, be a part of me at my session at Cloud Know-how Townhall Tallinn 2024 on 1st of February. And no, this isn’t the one AI supercharging Groups I’ll present there.

Revealed by
I work, weblog and discuss Metaverse, AI, Microsoft Mesh, Digital & Blended Actuality, The Way forward for Work, Digital Twins, and different companies & platforms within the cloud connecting digital and bodily worlds and folks collectively.
I’m extraordinarily captivated with Metaverse, AI, pure language understanding, Blended & Digital Actuality and the way these applied sciences, with Microsoft Groups and Microsoft Azure & Cloud, allow to vary how folks work collectively. Azure OpenAI Companies – sure, I construct AI options utilizing these and different Azure AI companies.
I’ve 30 years of expertise in IT enterprise on a number of industries, domains, and roles.
View all posts by Vesa Nopanen “Mr. Metaverse”
[ad_2]
Source link


