AI Inference API
Call the Azion.AI.run binding inside a function to invoke an AI Inference model, and look up its parameters and return value.
Azion.AI.run is the binding a function calls to invoke a model on AI Inference. It is a global of Azion Runtime, so a function reaches it with no import line and no credential. The binding carries the model id and the request body. The fields that body accepts, and the object the model returns, are the same over the HTTP endpoint and are documented in Model invocation.
Parameters
Azion.AI.run takes two parameters, and the call is asynchronous: a function awaits it and reads the model response from the resolved value.
| Parameter | Type | Description |
|---|---|---|
| Model id | string | The id of the model to invoke, in the form its model page states. |
| Request body | object | The request fields for the operation. The model id is not repeated inside it. |
Model ids differ in form between models, so copy the id from the model’s own page in AI models rather than deriving it from the model name.
Call a model
A call to a chat model inside a function:
Return value
The resolved value is the object the model returns: a chat.completion object from a chat model, a list of embeddings from an embedding model, and the ranked results from a reranking model. The generated text of a chat model sits at modelResponse?.choices?.[0]?.message?.content, which is the content of the first entry in choices. Every field of the three shapes is listed in Model invocation.