Skip to content

Commit a7e662d

Browse files
committed
fixes
1 parent 45bcc44 commit a7e662d

File tree

1 file changed

+42
-23
lines changed

1 file changed

+42
-23
lines changed

articles/ai-studio/how-to/develop/sdk-overview.md

Lines changed: 42 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ ms.service: azure-ai-studio
77
ms.custom:
88
- build-2024
99
ms.topic: overview
10-
ms.date: 8/9/2024
10+
ms.date: 11/07/2024
1111
ms.reviewer: dantaylo
1212
ms.author: sgilley
1313
author: sdgilley
@@ -34,18 +34,21 @@ The best way to get started using the Azure AI Foundry SDK is by using a project
3434
First follow steps to [create an AI Project](../create-projects.md) if you don't have one already.
3535

3636
Login with the Azure CLI using the same account that you use to access your AI Project:
37+
3738
```
3839
az login
3940
```
4041

4142
Install the Azure AI projects client library:
43+
4244
```
4345
pip install azure-ai-projects azure-identity
4446
```
4547

4648
Create a project client in code:
4749

48-
Sync Tab:
50+
#[Sync](tab/sync)
51+
4952
```Python
5053
from azure.identity import DefaultAzureCredential
5154
from azure.ai.projects import AIProjectClient
@@ -57,7 +60,8 @@ project = AIProjectClient.from_connection_string(
5760
credential=DefaultAzureCredential())
5861
```
5962

60-
Async Tab:
63+
#[Async](tab/async)
64+
6165
```Python
6266
from azure.identity.aio import DefaultAzureCredential
6367
from azure.ai.projects.aio import AIProjectClient
@@ -69,7 +73,9 @@ project = await AIProjectClient.from_connection_string(
6973
credential=DefaultAzureCredential())
7074
```
7175

72-
Copy the **Project connection string** from the **Overview** page of the project and update the ```project_connection_string``` variable above.
76+
---
77+
78+
Copy the **Project connection string** from the **Overview** page of the project and update the `project_connection_string` variable above.
7379

7480
Once you have created the project client, you can use the client for the capabilities in the following sections.
7581

@@ -83,6 +89,7 @@ pip install openai
8389
```
8490

8591
Now use the project client to return an ```AzureOpenAI``` client with the desired API version and make a chat completions call.
92+
8693
```Python
8794
openai = project.inference.get_azure_openai_client(api_version="2024-06-01")
8895
response = openai.chat.completions.create(
@@ -100,16 +107,18 @@ For more on using the Azure OpenAI client library, including how to use it direc
100107

101108
## Azure AI model inference service
102109

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.
104111

105112
To use the model inference service, first ensure that your project has an AI Services connection (in the management center).
106113

107114
Install the ```azure-ai-inferencing``` client library:
115+
108116
```
109117
pip install azure-ai-inference
110118
```
111119

112120
You can use the project client to get a configured and authenticated ```ChatCompletionsClient``` or ```EmbeddingsClient```:
121+
113122
```Python
114123
# get an chat inferencing client using the project's default model inferencing endpoint
115124
chat = project.inference.get_chat_completions_client()
@@ -128,18 +137,20 @@ print(response.choices[0].message.content)
128137

129138
You can change the model name to any model that you have deployed to the inference service or Azure OpenAI service.
130139

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).
132141

133142
## Prompt Templates
134143

135144
The inferencing client supports for creating prompt messages from templates, this allows you to dynamically generate prompts using inputs that are available at runtime.
136145

137-
To use prompt templates, install the ```azure-ai-inferencing``` package:
146+
To use prompt templates, install the `azure-ai-inferencing` package:
147+
138148
```
139149
pip install azure-ai-inference
140150
```
141151

142152
You can render a prompt template from an inline string:
153+
143154
```Python
144155
from azure.ai.inference.prompts import PromptTemplate
145156

@@ -157,16 +168,20 @@ prompt_template = PromptTemplate.from_string(prompt_template="""
157168
messages = prompt_template.create_messages(first_name="Jane", last_name="Doe")
158169
print(messages)
159170
```
171+
160172
This will output messages that you can then pass to a chat completions call:
161-
```
173+
174+
```text
162175
[
163176
{'role': 'system', 'content': "You are a helpful writing assistant.\nThe user's first name is Jane and their last name is Doe."}
164177
{'role': 'user', 'content': 'Write me a poem about flowers'}
165178
]
166179
```
180+
167181
NOTE: leading whitespace is automatically trimmed from input strings.
168182

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+
170185
```Python
171186
from azure.ai.inference.prompts import PromptTemplate
172187

@@ -185,11 +200,13 @@ response = chat.complete(
185200
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.
186201

187202
Install the Azure AI Search client library:
203+
188204
```
189205
pip install azure-search-documents
190206
```
191207

192208
Instantiate the search and/or search index client as desired:
209+
193210
```Python
194211
from azure.core.credentials import AzureKeyCredential
195212
from azure.ai.projects.models import ConnectionType
@@ -215,7 +232,7 @@ search_client = SearchClient(
215232
)
216233
```
217234

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/).
219236

220237
## Azure AI agents runtime
221238

@@ -258,33 +275,35 @@ if application_insights_connection_string:
258275
configure_azure_monitor(connection_string=application_insights_connection_string)
259276
```
260277

261-
## Additional AI Services and Frameworks
278+
## Related content
262279

263280
Below are some helpful links to additional services and frameworks that you can use with the Azure AI Foundry SDK.
264281

265282
### Azure AI Services
266283

267284
Client libraries:
268-
* [Azure AI services SDKs](../../../ai-services/reference/sdk-package-resources.md?context=/azure/ai-studio/context/context)
269-
* [Azure AI services REST APIs](../../../ai-services/reference/rest-api-resources.md?context=/azure/ai-studio/context/context)
285+
286+
* [Azure AI services SDKs](../../../ai-services/reference/sdk-package-resources.md?context=/azure/ai-studio/context/context)
287+
* [Azure AI services REST APIs](../../../ai-services/reference/rest-api-resources.md?context=/azure/ai-studio/context/context)
270288

271289
Azure AI services
272-
* [Azure AI Services Python Management Library](/python/api/overview/azure/mgmt-cognitiveservices-readme?view=azure-python)
273-
* [Azure AI Search Python Management Library](/python/api/azure-mgmt-search/azure.mgmt.search?view=azure-python)
290+
* [Azure AI Services Python Management Library](/python/api/overview/azure/mgmt-cognitiveservices-readme?view=azure-python)
291+
* [Azure AI Search Python Management Library](/python/api/azure-mgmt-search/azure.mgmt.search?view=azure-python)
274292

275293
### Frameworks
276294

277295
Azure Machine Learning
278-
* [Azure Machine Learning Python SDK (v2)](/python/api/overview/azure/ai-ml-readme)
279-
* [Azure Machine Learning CLI (v2)](/azure/machine-learning/how-to-configure-cli?view=azureml-api-2&tabs=public)
280-
* [Azure Machine Learning REST API](/rest/api/azureml)
296+
297+
* [Azure Machine Learning Python SDK (v2)](/python/api/overview/azure/ai-ml-readme)
298+
* [Azure Machine Learning CLI (v2)](/azure/machine-learning/how-to-configure-cli?view=azureml-api-2&tabs=public)
299+
* [Azure Machine Learning REST API](/rest/api/azureml)
281300

282301
Prompt flow
283-
* [Prompt flow SDK](https://microsoft.github.io/promptflow/how-to-guides/quick-start.html)
284-
* [pfazure CLI](https://microsoft.github.io/promptflow/reference/pfazure-command-reference.html)
285-
* [pfazure Python library](https://microsoft.github.io/promptflow/reference/python-library-reference/promptflow-azure/promptflow.azure.html)
286302

287-
Agentic frameworks:
288-
* [LlamaIndex](llama-index.md)
303+
* [Prompt flow SDK](https://microsoft.github.io/promptflow/how-to-guides/quick-start.html)
304+
* [pfazure CLI](https://microsoft.github.io/promptflow/reference/pfazure-command-reference.html)
305+
* [pfazure Python library](https://microsoft.github.io/promptflow/reference/python-library-reference/promptflow-azure/promptflow.azure.html)
289306

307+
Agentic frameworks
290308

309+
* [LlamaIndex](llama-index.md)

0 commit comments

Comments
 (0)