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
Copy file name to clipboardExpand all lines: articles/ai-studio/how-to/develop/sdk-overview.md
+20-8Lines changed: 20 additions & 8 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -83,13 +83,14 @@ Be sure to check out the [reference](https://aka.ms/aifoundrysdk/reference) and
83
83
84
84
## Azure OpenAI Service
85
85
86
-
If you have existing code that uses the OpenAI SDK, you can use the project client to create an ```AzureOpenAI``` client that uses your project's Azure OpenAI connection.
86
+
The [Azure OpenAI Service](../../../ai-services/openai/overview.md) allows you to access OpenAI models the same day they launch. It integrates with the rest of Azure and provides enterprise scale and controls.
87
+
88
+
If you have code that uses the OpenAI SDK, you can easily target your code to use the Azure OpenAI service. First, install the OpenAI SDK:
87
89
```
88
90
pip install openai
89
91
```
90
92
91
-
Now use the project client to return an ```AzureOpenAI``` client with the desired API version and make a chat completions call.
92
-
93
+
If you have existing code that uses the OpenAI SDK, you can use the project client to create an ```AzureOpenAI``` client that uses your project's Azure OpenAI connection:
If you’re already using the [Azure OpenAI SDK](../../../ai-services/openai/chatgpt-quickstart.md) directly against the Azure OpenAI Service, the project provides a convenient way to use Azure OpenAI Service capabilities alongside the rest of the AI Foundry capabilities.
105
107
106
-
For more on using the Azure OpenAI client library, including how to use it directly against with the Azure OpenAI Service, check out [Azure OpenAI chat quickstart](../../../ai-services/openai/chatgpt-quickstart.md).
NOTE: leading whitespace is automatically trimmed from input strings.
171
173
172
174
This code outputs messages that you can then pass to a chat completions call:
173
175
@@ -178,8 +180,6 @@ This code outputs messages that you can then pass to a chat completions call:
178
180
]
179
181
```
180
182
181
-
NOTE: leading whitespace is automatically trimmed from input strings.
182
-
183
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
184
185
185
```Python
@@ -243,8 +243,11 @@ To get access to agents, [sign-up for the private preview](https://nam.dcv.ms/nz
243
243
## Evaluation
244
244
245
245
You can use the project client to easily connect to the Azure AI evaluation service, and models needed for running your evaluators.
246
+
```
247
+
pip install azure-ai-evaluation
248
+
```
246
249
247
-
Using the ```project.scope``` parameter, we can easily instantiate a ```ViolenceEvaluator```:
250
+
Using the ```project.scope``` parameter, we can instantiate a ```ViolenceEvaluator```:
violence_score = violence_eval(query="what's the capital of france", response="Paris")
259
262
print(violence_score)
260
263
```
264
+
NOTE: to run violence evaluators your project needs to be in East US 2, Sweden Central, US North Central, France Central.
261
265
262
266
To learn more, check out [Evaluation using the SDK](evaluate-sdk.md).
263
267
264
268
## Tracing
265
269
266
270
To enable tracing, first ensure your project has an attached Application Insights resource. Go to the **Tracing** page of your project and follow instructions to create or attach Application Insights.
267
271
272
+
Install the Azure Monitor OpenTelemetry package:
273
+
```
274
+
pip install azure-monitor-opentelemetry
275
+
```
276
+
277
+
Use the following code to enable instrumentation of the Azure AI Inference SDK and logging to your AI project:
268
278
```Python
269
279
# Enable instrumentation of AI packages (inference, agents, openai, langchain)
270
280
project.telemetry.enable()
@@ -286,7 +296,7 @@ Client libraries:
286
296
*[Azure AI services SDKs](../../../ai-services/reference/sdk-package-resources.md?context=/azure/ai-studio/context/context)
287
297
*[Azure AI services REST APIs](../../../ai-services/reference/rest-api-resources.md?context=/azure/ai-studio/context/context)
288
298
289
-
Azure AI services
299
+
Management libraries:
290
300
*[Azure AI Services Python Management Library](/python/api/overview/azure/mgmt-cognitiveservices-readme)
291
301
*[Azure AI Search Python Management Library](/python/api/azure-mgmt-search/azure.mgmt.search)
0 commit comments