azure-ai-generative


Nameazure-ai-generative JSON
Version 1.0.0b8 PyPI version JSON
download
home_pagehttps://github.com/Azure/azure-sdk-for-python
SummaryMicrosoft Azure Machine Learning Client Library for Python
upload_time2024-03-28 20:13:55
maintainerNone
docs_urlNone
authorMicrosoft Corporation
requires_python<4.0,>=3.8
licenseMIT License
keywords azure azuresdk azure sdk
VCS
bugtrack_url
requirements No requirements were recorded.
Travis-CI No Travis.
coveralls test coverage
            # Azure AI Generative Package client library for Python

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

[Source code][source_code]
| [Package (PyPI)][ai_pypi]
| [API reference documentation][ai_ref_docs]
| [Product documentation][product_documentation]
| [Samples][generative_samples]

This package has been tested with Python 3.8, 3.9, 3.10, 3.11 and 3.12.

For a more complete set of Azure libraries, see https://aka.ms/azsdk/python/all.

## Getting started

### Prerequisites

- Python 3.7 or later is required to use this package.
- You must have an [Azure subscription][azure_subscription].
- An [Azure Machine Learning Workspace][workspace].
- An [Azure AI Studio project][ai_project].

### Install the package
Install the Azure AI generative package for Python with pip:

```
pip install azure-ai-generative[index,evaluate,promptflow]
pip install azure-identity
```

## Key concepts

The `[index,evaluate,promptflow]` syntax specifies extra packages that you can optionally remove if you don't need the functionality: 
* `[index]` adds the ability to build indexes on your local development environment
* `[evaluate]` adds the ability to run evaluation and calculate metrics in your local development environment 
* `[promptflow]` adds the ability to develop with prompt flow connected to your Azure AI project

## Usage

### Connecting to Projects
The generative package includes the azure-ai-resources package and uses the `AIClient` for connecting to your project.

First, create an `AI Client`:

```python
from azure.ai.resources.client import AIClient
from azure.identity import DefaultAzureCredential

ai_client = AIClient(
    credential=DefaultAzureCredential(),
    subscription_id='subscription_id',
    resource_group_name='resource_group',
    project_name='project_name'
)
```

### Using the generative package
Azure AI Generative Python SDK offers the following key capabilities.

To build an index locally, import the build_index function:

```python
from azure.ai.generative.index import build_index
```
To run a local evaluation, import the evaluate function:

```python
from azure.ai.generative.evaluate import evaluate
```
To deploy chat functions and prompt flows, import the deploy function:

```python
from azure.ai.resources.entities.deployment import Deployment
```
For sample usage of these, refer to this sample

## Examples

See our [samples repository][generative_samples] for examples of how to use the Azure AI Generative Python SDK.

## Troubleshooting
### General
Azure AI clients raise exceptions defined in Azure Core.

```python
from azure.core.exceptions import HttpResponseError

try:
    ai_client.compute.get("cpu-cluster")
except HttpResponseError as error:
    print("Request failed: {}".format(error.message))
```

### Logging
This library uses the standard logging library for logging. Basic information about HTTP sessions (URLs, headers, etc.) is logged at INFO level.

Detailed DEBUG level logging, including request/response bodies and unredacted headers, can be enabled on a client with the `logging_enable` argument.

See full SDK logging documentation with examples here.

### Telemetry
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. <u>Telemetry will not be collected for any use of the Python SDK outside of a Jupyter Notebook.</u>

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 cannot 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"`.


## Next steps

See our [samples repository][generative_samples] for examples of how to use the Azure AI Generative Python SDK.

## Contributing

If you encounter any bugs or have suggestions, please file an issue in the [Issues](<https://github.com/Azure/azure-sdk-for-python/issues>) section of the project.

![Impressions](https://azure-sdk-impressions.azurewebsites.net/api/impressions/azure-sdk-for-python%2Fsdk%2Ftemplate%2Fazure-template%2FREADME.png)


<!-- LINKS -->

[source_code]: https://github.com/Azure/azure-sdk-for-python/tree/main/sdk/ai/azure-ai-generative
[ai_project]: https://aka.ms/azureaistudio
[ai_pypi]: https://pypi.org/project/azure-ai-generative/
[ai_ref_docs]: https://learn.microsoft.com/python/api/azure-ai-generative/?view=azure-python-preview
[generative_samples]: https://github.com/Azure-Samples/azureai-samples
[product_documentation]: https://docs.microsoft.com/azure/machine-learning/
[azure_subscription]: https://azure.microsoft.com/free/
[workspace]: https://docs.microsoft.com/azure/machine-learning/concept-workspace
[python_logging]: https://docs.python.org/3/library/logging.html
[sdk_logging_docs]: https://docs.microsoft.com/azure/developer/python/azure-sdk-logging
[azure_core_readme]: https://github.com/Azure/azure-sdk-for-python/blob/main/sdk/core/azure-core/README.md
[pip_link]: https://pypi.org/project/pip/
[azure_core_ref_docs]: https://aka.ms/azsdk-python-core-policies
[azure_core]: https://github.com/Azure/azure-sdk-for-python/blob/main/sdk/core/azure-core/README.md
[azure_identity]: https://github.com/Azure/azure-sdk-for-python/tree/main/sdk/identity/azure-identity
[cla]: https://cla.microsoft.com
[code_of_conduct]: https://opensource.microsoft.com/codeofconduct/
[coc_faq]: https://opensource.microsoft.com/codeofconduct/faq/
[coc_contact]: mailto:opencode@microsoft.com

# Release History

## 1.0.0b8 (2024-03-27)

### Other Changes
- Bug fixes

## 1.0.0b7 (2024-02-07)

### Other Changes

- Bug fixes

## 1.0.0b6 (2024-02-06)

### Other Changes

- Recursive Text Splitter is now enabled by default for local index builds which mimics behavior of cloud index builds
- Bug fixes

## 1.0.0b5 (2024-02-02)

### Features Added

- Supports evaluate() on chat

### Bugs Fixed

- Fix promptflow evaluation bugs

### Other Changes

- Duplicate cleanup

## 1.0.0b4 (2024-02-01)

### Features Added

- Support custom metrics for evaluation

### Other Changes

- Switched evaluate() function to run on promptflow engine
- Use openai v1 environment variable

## 1.0.0b3 (2024-01-30)

### Other Changes

- Support for Python 3.12

## 1.0.0b2 (2023-11-30)

### Features Added

- Added new format to export data to in qa generator.

### Other Changes

- Dependency improvements.

## 1.0.0b1 (2023-11-10)

### Features Added

- Try use langchain VectorStore and fallback to vendor.
- Add azure-search-documents 11.4.0b11 and above support.
- Invoke OpenAI with dynamic batch size.
- Fix LangChain importing path
- First preview.

            

Raw data

            {
    "_id": null,
    "home_page": "https://github.com/Azure/azure-sdk-for-python",
    "name": "azure-ai-generative",
    "maintainer": null,
    "docs_url": null,
    "requires_python": "<4.0,>=3.8",
    "maintainer_email": null,
    "keywords": "azure, azuresdk, azure sdk",
    "author": "Microsoft Corporation",
    "author_email": "azuresdkengsysadmins@microsoft.com",
    "download_url": "https://files.pythonhosted.org/packages/77/36/254f03df53249ea3e3d37f08c3255ec596c8b4bf423b79388e743157b37f/azure-ai-generative-1.0.0b8.tar.gz",
    "platform": null,
    "description": "# Azure AI Generative Package client library for Python\n\nThe 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 leverage 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).\n\n[Source code][source_code]\n| [Package (PyPI)][ai_pypi]\n| [API reference documentation][ai_ref_docs]\n| [Product documentation][product_documentation]\n| [Samples][generative_samples]\n\nThis package has been tested with Python 3.8, 3.9, 3.10, 3.11 and 3.12.\n\nFor a more complete set of Azure libraries, see https://aka.ms/azsdk/python/all.\n\n## Getting started\n\n### Prerequisites\n\n- Python 3.7 or later is required to use this package.\n- You must have an [Azure subscription][azure_subscription].\n- An [Azure Machine Learning Workspace][workspace].\n- An [Azure AI Studio project][ai_project].\n\n### Install the package\nInstall the Azure AI generative package for Python with pip:\n\n```\npip install azure-ai-generative[index,evaluate,promptflow]\npip install azure-identity\n```\n\n## Key concepts\n\nThe `[index,evaluate,promptflow]` syntax specifies extra packages that you can optionally remove if you don't need the functionality: \n* `[index]` adds the ability to build indexes on your local development environment\n* `[evaluate]` adds the ability to run evaluation and calculate metrics in your local development environment \n* `[promptflow]` adds the ability to develop with prompt flow connected to your Azure AI project\n\n## Usage\n\n### Connecting to Projects\nThe generative package includes the azure-ai-resources package and uses the `AIClient` for connecting to your project.\n\nFirst, create an `AI Client`:\n\n```python\nfrom azure.ai.resources.client import AIClient\nfrom azure.identity import DefaultAzureCredential\n\nai_client = AIClient(\n    credential=DefaultAzureCredential(),\n    subscription_id='subscription_id',\n    resource_group_name='resource_group',\n    project_name='project_name'\n)\n```\n\n### Using the generative package\nAzure AI Generative Python SDK offers the following key capabilities.\n\nTo build an index locally, import the build_index function:\n\n```python\nfrom azure.ai.generative.index import build_index\n```\nTo run a local evaluation, import the evaluate function:\n\n```python\nfrom azure.ai.generative.evaluate import evaluate\n```\nTo deploy chat functions and prompt flows, import the deploy function:\n\n```python\nfrom azure.ai.resources.entities.deployment import Deployment\n```\nFor sample usage of these, refer to this sample\n\n## Examples\n\nSee our [samples repository][generative_samples] for examples of how to use the Azure AI Generative Python SDK.\n\n## Troubleshooting\n### General\nAzure AI clients raise exceptions defined in Azure Core.\n\n```python\nfrom azure.core.exceptions import HttpResponseError\n\ntry:\n    ai_client.compute.get(\"cpu-cluster\")\nexcept HttpResponseError as error:\n    print(\"Request failed: {}\".format(error.message))\n```\n\n### Logging\nThis library uses the standard logging library for logging. Basic information about HTTP sessions (URLs, headers, etc.) is logged at INFO level.\n\nDetailed DEBUG level logging, including request/response bodies and unredacted headers, can be enabled on a client with the `logging_enable` argument.\n\nSee full SDK logging documentation with examples here.\n\n### Telemetry\nThe 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. <u>Telemetry will not be collected for any use of the Python SDK outside of a Jupyter Notebook.</u>\n\nTelemetry 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 cannot 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\"`.\n\n\n## Next steps\n\nSee our [samples repository][generative_samples] for examples of how to use the Azure AI Generative Python SDK.\n\n## Contributing\n\nIf you encounter any bugs or have suggestions, please file an issue in the [Issues](<https://github.com/Azure/azure-sdk-for-python/issues>) section of the project.\n\n![Impressions](https://azure-sdk-impressions.azurewebsites.net/api/impressions/azure-sdk-for-python%2Fsdk%2Ftemplate%2Fazure-template%2FREADME.png)\n\n\n<!-- LINKS -->\n\n[source_code]: https://github.com/Azure/azure-sdk-for-python/tree/main/sdk/ai/azure-ai-generative\n[ai_project]: https://aka.ms/azureaistudio\n[ai_pypi]: https://pypi.org/project/azure-ai-generative/\n[ai_ref_docs]: https://learn.microsoft.com/python/api/azure-ai-generative/?view=azure-python-preview\n[generative_samples]: https://github.com/Azure-Samples/azureai-samples\n[product_documentation]: https://docs.microsoft.com/azure/machine-learning/\n[azure_subscription]: https://azure.microsoft.com/free/\n[workspace]: https://docs.microsoft.com/azure/machine-learning/concept-workspace\n[python_logging]: https://docs.python.org/3/library/logging.html\n[sdk_logging_docs]: https://docs.microsoft.com/azure/developer/python/azure-sdk-logging\n[azure_core_readme]: https://github.com/Azure/azure-sdk-for-python/blob/main/sdk/core/azure-core/README.md\n[pip_link]: https://pypi.org/project/pip/\n[azure_core_ref_docs]: https://aka.ms/azsdk-python-core-policies\n[azure_core]: https://github.com/Azure/azure-sdk-for-python/blob/main/sdk/core/azure-core/README.md\n[azure_identity]: https://github.com/Azure/azure-sdk-for-python/tree/main/sdk/identity/azure-identity\n[cla]: https://cla.microsoft.com\n[code_of_conduct]: https://opensource.microsoft.com/codeofconduct/\n[coc_faq]: https://opensource.microsoft.com/codeofconduct/faq/\n[coc_contact]: mailto:opencode@microsoft.com\n\n# Release History\n\n## 1.0.0b8 (2024-03-27)\n\n### Other Changes\n- Bug fixes\n\n## 1.0.0b7 (2024-02-07)\n\n### Other Changes\n\n- Bug fixes\n\n## 1.0.0b6 (2024-02-06)\n\n### Other Changes\n\n- Recursive Text Splitter is now enabled by default for local index builds which mimics behavior of cloud index builds\n- Bug fixes\n\n## 1.0.0b5 (2024-02-02)\n\n### Features Added\n\n- Supports evaluate() on chat\n\n### Bugs Fixed\n\n- Fix promptflow evaluation bugs\n\n### Other Changes\n\n- Duplicate cleanup\n\n## 1.0.0b4 (2024-02-01)\n\n### Features Added\n\n- Support custom metrics for evaluation\n\n### Other Changes\n\n- Switched evaluate() function to run on promptflow engine\n- Use openai v1 environment variable\n\n## 1.0.0b3 (2024-01-30)\n\n### Other Changes\n\n- Support for Python 3.12\n\n## 1.0.0b2 (2023-11-30)\n\n### Features Added\n\n- Added new format to export data to in qa generator.\n\n### Other Changes\n\n- Dependency improvements.\n\n## 1.0.0b1 (2023-11-10)\n\n### Features Added\n\n- Try use langchain VectorStore and fallback to vendor.\n- Add azure-search-documents 11.4.0b11 and above support.\n- Invoke OpenAI with dynamic batch size.\n- Fix LangChain importing path\n- First preview.\n",
    "bugtrack_url": null,
    "license": "MIT License",
    "summary": "Microsoft Azure Machine Learning Client Library for Python",
    "version": "1.0.0b8",
    "project_urls": {
        "Bug Reports": "https://github.com/Azure/azure-sdk-for-python/issues",
        "Homepage": "https://github.com/Azure/azure-sdk-for-python",
        "Source": "https://github.com/Azure/azure-sdk-for-python"
    },
    "split_keywords": [
        "azure",
        " azuresdk",
        " azure sdk"
    ],
    "urls": [
        {
            "comment_text": null,
            "digests": {
                "blake2b_256": "a998867c84613990084add7554b74a464a03adf512d3d4e716f8aec4b2791890",
                "md5": "0ea870e736de04349a069f5de2e270d3",
                "sha256": "27185a9c145bf944ebc236daf8849e1607ad7c8ebce712863a8aff0b5016f0fd"
            },
            "downloads": -1,
            "filename": "azure_ai_generative-1.0.0b8-py3-none-any.whl",
            "has_sig": false,
            "md5_digest": "0ea870e736de04349a069f5de2e270d3",
            "packagetype": "bdist_wheel",
            "python_version": "py3",
            "requires_python": "<4.0,>=3.8",
            "size": 1562632,
            "upload_time": "2024-03-28T20:13:59",
            "upload_time_iso_8601": "2024-03-28T20:13:59.356264Z",
            "url": "https://files.pythonhosted.org/packages/a9/98/867c84613990084add7554b74a464a03adf512d3d4e716f8aec4b2791890/azure_ai_generative-1.0.0b8-py3-none-any.whl",
            "yanked": false,
            "yanked_reason": null
        },
        {
            "comment_text": null,
            "digests": {
                "blake2b_256": "7736254f03df53249ea3e3d37f08c3255ec596c8b4bf423b79388e743157b37f",
                "md5": "9099cb91a80b69f82776daec18e76353",
                "sha256": "8a3cb4dd2bf7e854117959dbb19c6312a5cf07fab314b6e2285c067c5ccd2086"
            },
            "downloads": -1,
            "filename": "azure-ai-generative-1.0.0b8.tar.gz",
            "has_sig": false,
            "md5_digest": "9099cb91a80b69f82776daec18e76353",
            "packagetype": "sdist",
            "python_version": "source",
            "requires_python": "<4.0,>=3.8",
            "size": 1512255,
            "upload_time": "2024-03-28T20:13:55",
            "upload_time_iso_8601": "2024-03-28T20:13:55.485176Z",
            "url": "https://files.pythonhosted.org/packages/77/36/254f03df53249ea3e3d37f08c3255ec596c8b4bf423b79388e743157b37f/azure-ai-generative-1.0.0b8.tar.gz",
            "yanked": false,
            "yanked_reason": null
        }
    ],
    "upload_time": "2024-03-28 20:13:55",
    "github": true,
    "gitlab": false,
    "bitbucket": false,
    "codeberg": false,
    "github_user": "Azure",
    "github_project": "azure-sdk-for-python",
    "travis_ci": false,
    "coveralls": true,
    "github_actions": true,
    "lcname": "azure-ai-generative"
}
        
Elapsed time: 0.21665s