You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
@@ -100,16 +107,18 @@ For more on using the Azure OpenAI client library, including how to use it direc
100
107
101
108
## Azure AI model inference service
102
109
103
-
The [Azure AI model inference service](https://learn.microsoft.com/en-us/azure/ai-studio/ai-services/model-inference) offers access to powerful models from leading providers like OpenAI, Microsoft, Meta, and more. These models support tasks such as content generation, summarization, and code generation.
110
+
The [Azure AI model inference service](/azure/ai-studio/ai-services/model-inference) offers access to powerful models from leading providers like OpenAI, Microsoft, Meta, and more. These models support tasks such as content generation, summarization, and code generation.
104
111
105
112
To use the model inference service, first ensure that your project has an AI Services connection (in the management center).
106
113
107
114
Install the ```azure-ai-inferencing``` client library:
115
+
108
116
```
109
117
pip install azure-ai-inference
110
118
```
111
119
112
120
You can use the project client to get a configured and authenticated ```ChatCompletionsClient``` or ```EmbeddingsClient```:
121
+
113
122
```Python
114
123
# get an chat inferencing client using the project's default model inferencing endpoint
You can change the model name to any model that you have deployed to the inference service or Azure OpenAI service.
130
139
131
-
To learn more about using the Azure AI inferencing client, check out the [Azure AI model inferencing reference](https://learn.microsoft.com/en-us/azure/ai-studio/reference/reference-model-inference-api?tabs=python).
140
+
To learn more about using the Azure AI inferencing client, check out the [Azure AI model inferencing reference](/azure/ai-studio/reference/reference-model-inference-api).
132
141
133
142
## Prompt Templates
134
143
135
144
The inferencing client supports for creating prompt messages from templates, this allows you to dynamically generate prompts using inputs that are available at runtime.
136
145
137
-
To use prompt templates, install the ```azure-ai-inferencing``` package:
146
+
To use prompt templates, install the `azure-ai-inferencing` package:
147
+
138
148
```
139
149
pip install azure-ai-inference
140
150
```
141
151
142
152
You can render a prompt template from an inline string:
153
+
143
154
```Python
144
155
from azure.ai.inference.prompts import PromptTemplate
This will output messages that you can then pass to a chat completions call:
161
-
```
173
+
174
+
```text
162
175
[
163
176
{'role': 'system', 'content': "You are a helpful writing assistant.\nThe user's first name is Jane and their last name is Doe."}
164
177
{'role': 'user', 'content': 'Write me a poem about flowers'}
165
178
]
166
179
```
180
+
167
181
NOTE: leading whitespace is automatically trimmed from input strings.
168
182
169
-
You can also load prompts from a [Prompty](https://prompty.ai) file, enabling you to also load the model name and parameters from the ```.prompty``` file:
183
+
You can also load prompts from a [Prompty](https://prompty.ai) file, enabling you to also load the model name and parameters from the `.prompty` file:
184
+
170
185
```Python
171
186
from azure.ai.inference.prompts import PromptTemplate
172
187
@@ -185,11 +200,13 @@ response = chat.complete(
185
200
If you have an Azure AI Search resource connected to your project, you can also use the project client to create an Azure AI Search client using the project connection.
186
201
187
202
Install the Azure AI Search client library:
203
+
188
204
```
189
205
pip install azure-search-documents
190
206
```
191
207
192
208
Instantiate the search and/or search index client as desired:
209
+
193
210
```Python
194
211
from azure.core.credentials import AzureKeyCredential
195
212
from azure.ai.projects.models import ConnectionType
@@ -215,7 +232,7 @@ search_client = SearchClient(
215
232
)
216
233
```
217
234
218
-
To learn more about using Azure AI Search, check out [Azure AI Search documentation](https://learn.microsoft.com/azure/search/).
235
+
To learn more about using Azure AI Search, check out [Azure AI Search documentation](/azure/search/).
219
236
220
237
## Azure AI agents runtime
221
238
@@ -258,33 +275,35 @@ if application_insights_connection_string:
0 commit comments