Skip to content

Commit c394bda

Browse files
committed
code first updates
1 parent 055cca6 commit c394bda

File tree

2 files changed

+145
-10
lines changed

2 files changed

+145
-10
lines changed
Lines changed: 130 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,130 @@
1+
---
2+
title: Overview of the Azure AI Generative SDK packages
3+
titleSuffix: Azure AI Studio
4+
description: This article provides overview of the Azure AI Generative SDK packages.
5+
author: eric-urban
6+
manager: nitinme
7+
ms.service: azure-ai-studio
8+
ms.topic: overview
9+
ms.date: 12/15/2023
10+
ms.author: eur
11+
---
12+
13+
# Overview of the Azure AI Generative SDK packages
14+
15+
[!INCLUDE [Azure AI Studio preview](../includes/preview-ai-studio.md)]
16+
17+
The Azure AI Generative package is part of the Azure AI SDK for Python and contains functionality for building, evaluating and deploying Generative AI applications that use Azure AI services. The default installation of the package contains capabilities for cloud-connected scenarios, and by installing extras you can also run operations locally (such as building indexes and calculating metrics).
18+
19+
[Source code](https://github.com/Azure/azure-sdk-for-python/tree/main/sdk/ai/azure-ai-generative) | [Package (PyPI)](https://pypi.org/project/azure-ai-generative/) | [API reference documentation](/python/api/overview/azure/ai-generative-readme)
20+
21+
This package is tested with Python 3.7, 3.8, 3.9 and 3.10.
22+
23+
For a more complete set of Azure libraries, see [https://aka.ms/azsdk/python/all](https://aka.ms/azsdk/python/all).
24+
25+
## Getting started
26+
27+
### Prerequisites
28+
29+
- Python 3.7 or later is required to use this package.
30+
- You must have an [Azure subscription](https://portal.azure.com).
31+
- An [Azure AI project](./create-projects.md) in your Azure subscription.
32+
33+
34+
### Install the package
35+
36+
Install the Azure AI generative package for Python with pip:
37+
38+
```bash
39+
pip install azure-ai-generative[index,evaluate,promptflow]
40+
pip install azure-identity
41+
```
42+
43+
## Key concepts
44+
45+
The `[index,evaluate,promptflow]` syntax specifies extra packages that you can optionally remove if you don't need the functionality:
46+
47+
- `[index]` adds the ability to build indexes on your local development environment.
48+
- `[evaluate]` adds the ability to run evaluation and calculate metrics in your local development environment.
49+
- `[promptflow]` adds the ability to develop with prompt flow connected to your Azure AI project.
50+
51+
52+
## Usage
53+
54+
55+
### Connecting to Projects
56+
The generative package includes the [azure-ai-resources](https://pypi.org/project/azure-ai-resources) package and uses the `AIClient` for connecting to your project.
57+
58+
First, create an `AI Client`:
59+
60+
```python
61+
from azure.ai.resources.client import AIClient
62+
from azure.identity import DefaultAzureCredential
63+
64+
ai_client = AIClient(
65+
credential=DefaultAzureCredential(),
66+
subscription_id='subscription_id',
67+
resource_group_name='resource_group',
68+
project_name='project_name'
69+
)
70+
```
71+
72+
### Using the generative package
73+
74+
Azure AI Generative Python SDK offers the following key capabilities.
75+
76+
To build an index locally, import the `build_index` function:
77+
78+
```python
79+
from azure.ai.generative.index import build_index
80+
```
81+
82+
To run a local evaluation, import the `evaluate` function:
83+
```python
84+
from azure.ai.generative.evaluate import evaluate
85+
```
86+
87+
To deploy chat functions and prompt flows, import the `deploy` function:
88+
```python
89+
from azure.ai.resources.entities.deployment import Deployment
90+
```
91+
92+
93+
## Examples
94+
95+
See our [samples repository](https://github.com/Azure-Samples/azureai-samples) for examples of how to use the Azure AI Generative Python SDK.
96+
97+
## Logs and telemetry
98+
99+
### General
100+
101+
Azure AI clients raise exceptions defined in Azure Core.
102+
103+
```python
104+
from azure.core.exceptions import HttpResponseError
105+
106+
try:
107+
ai_client.compute.get("cpu-cluster")
108+
except HttpResponseError as error:
109+
print("Request failed: {}".format(error.message))
110+
```
111+
112+
### Logging
113+
114+
This library uses the standard logging library for logging. Basic information about HTTP sessions (URLs, headers, etc.) is logged at INFO level.
115+
116+
Detailed `DEBUG` level logging, including request/response bodies and unredacted headers, can be enabled on a client with the `logging_enable` argument.
117+
118+
119+
### Telemetry
120+
121+
The Azure AI Generative Python SDK includes a telemetry feature that collects usage and failure data about the SDK and sends it to Microsoft when you use the SDK in a Jupyter Notebook only. Telemetry won't be collected for any use of the Python SDK outside of a Jupyter Notebook.
122+
123+
Telemetry data helps the SDK team understand how the SDK is used so it can be improved and the information about failures helps the team resolve problems and fix bugs. The SDK telemetry feature is enabled by default for Jupyter Notebook usage and can't be enabled for non-Jupyter scenarios. To opt out of the telemetry feature in a Jupyter scenario, set the environment variable `"AZURE_AI_GENERATIVE_ENABLE_LOGGING"` to `"False"`.
124+
125+
126+
## Next steps
127+
128+
- [Get started building a sample copilot application](https://github.com/azure/aistudio-copilot-sample)
129+
- [Get started with the Azure AI SDK](./sdk-install.md)
130+
- [Azure SDK for Python reference documentation](/python/api/overview/azure/ai)

articles/ai-studio/toc.yml

Lines changed: 15 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -39,6 +39,18 @@
3939
href: how-to/model-catalog.md
4040
- name: Azure AI capabilities
4141
href: how-to/models-foundation-azure-ai.md
42+
- name: SDK and CLI
43+
items:
44+
- name: Azure AI Generative SDK
45+
items:
46+
- name: Overview
47+
href: how-to/sdk-generative-overview.md
48+
- name: Get started with the Azure AI SDK
49+
href: how-to/sdk-install.md
50+
- name: Get started with the Azure AI CLI
51+
href: how-to/cli-install.md
52+
- name: Get started with projects in VS Code (Web)
53+
href: how-to/vscode-web.md
4254
- name: Create Azure AI projects and resources
4355
items:
4456
- name: Azure AI resources overview
@@ -47,6 +59,8 @@
4759
href: how-to/create-azure-ai-resource.md
4860
- name: Create an Azure AI project
4961
href: how-to/create-projects.md
62+
- name: Create and manage compute
63+
href: how-to/create-manage-compute.md
5064
- name: Data and connections
5165
items:
5266
- name: Connections
@@ -151,16 +165,6 @@
151165
href: how-to/monitor-quality-safety.md
152166
- name: Troubleshoot deployments and monitoring
153167
href: how-to/troubleshoot-deploy-and-monitor.md
154-
- name: Set up your development environment
155-
items:
156-
- name: Get started with the Azure AI SDK
157-
href: how-to/sdk-install.md
158-
- name: Get started with the Azure AI CLI
159-
href: how-to/cli-install.md
160-
- name: Get started with projects in VS Code (Web)
161-
href: how-to/vscode-web.md
162-
- name: Create and manage compute
163-
href: how-to/create-manage-compute.md
164168
- name: Costs and quotas
165169
items:
166170
- name: Plan and manage costs
@@ -205,6 +209,7 @@
205209
items:
206210
- name: Azure AI SDK for Python
207211
href: /python/api/overview/azure/ai
212+
displayName: reference
208213
- name: Azure Policy built-ins
209214
displayName: samples, policies, definitions
210215
href: ../ai-services/policy-reference.md?context=/azure/ai-studio/context/context

0 commit comments

Comments
 (0)