> ## Documentation Index
> Fetch the complete documentation index at: https://dokulabs.mintlify.site/llms.txt
> Use this file to discover all available pages before exploring further.

# Azure OpenAI Integration

DokuMetry SDKs (`dokumetry`) empowers you to effortlessly track and monitor Azure OpenAI usage data and metrics from your Python/NodeJS code.

## Get Started

The integration is compatible with

* OpenAI Python SDK client `>=1.13.0`
* OpenAI JS/TS SDK client `>=4.28.0`

**Python**

```shell
pip install dokumetry==0.1.1
```

```python
from openai import AzureOpenAI
import dokumetry

client = AzureOpenAI(
  api_key = "YOUR_AZURE_OPENAI_API_KEY",  
  api_version = "2024-02-01",
  azure_endpoint = "YOUR_AZURE_OPENAI_API_ENDPOINT"
)

dokumetry.init(llm = client, doku_url = "YOUR_DOKU_INGESTER_URL", api_key = "YOUR_DOKU_TOKEN")
```

**Javascript**

```shell
npm install dokumetry@0.1.1
```

```javascript
import OpenAI from "openai";
import DokuMetry from 'dokumetry';

const client = new OpenAI({
  apiKey: "YOUR_AZURE_OPENAI_API_KEY",
  baseURL: `https://YOUR_AZURE_OPENAI_RESOURCE.openai.azure.com/openai/deployments/YOUR_AZURE_OPENAI_DEPLOYMENT`,
  defaultQuery: { 'api-version': "2024-02-01" },
  defaultHeaders: { 'api-key': "YOUR_AZURE_OPENAI_API_KEY" },
});

DokuMetry.init({llm: client, dokuUrl: "YOUR_DOKU_INGESTER_URL", apiKey: "YOUR_DOKU_TOKEN"})
```

## Supported Endpoints

The following Azure OpenAI Endpoints are supported for monitoring with DokuMetry

* [Chat completions](https://dokulabs.mintlify.site/latest/integrations/azure-openai/examples/chat.md)
* [Image Create](https://dokulabs.mintlify.site/latest/integrations/azure-openai/examples/image.md#create-image)
* [Embeddings](https://dokulabs.mintlify.site/latest/integrations/azure-openai/examples/embeddings.md)
* [Completions](https://dokulabs.mintlify.site/latest/integrations/azure-openai/examples/completions.md)

## Parameters

**Python**

| Parameter | Description | Required |
| - | - | - |
| llm | Azure OpenAI Object to track | Yes |
| doku\_url | URL of your Doku Ingester | Yes |
| api\_key | Your Doku API key | Yes |
| environment | Custom environment tag to include in your metrics | Optional |
| application\_name | Custom application name tag for your metrics | Optional |
| skip\_resp | Skip response from the Doku Ingester for faster execution | Optional |

**NodeJS**

| Parameter | Description | Required |
| - | - | - |
| llm | Azure OpenAI Object to track | Yes |
| dokuUrl | URL of your Doku Ingester | Yes |
| apiKey | Your Doku API key | Yes |
| environment | Custom environment tag to include in your metrics | Optional |
| applicationName | Custom application name tag for your metrics | Optional |
| skipResp | Skip response from the Doku Ingester for faster execution | Optional |

## Advanced Usage

When using DokuMetry in Production environments, It is recommened to set Skip response parameter to `true` for faster porcessing.

To filter your LLM Usage according application or the environment, set the Application name and Environment paramaters with the actual values.

***

> **[Connections](https://dokulabs.mintlify.site/latest/connections/intro.md)**
>
> Connect to your existing Observablity Platform

> **[API Reference](https://dokulabs.mintlify.site/latest/api-reference/introduction.md)**
>
> OpenAPI specification for API Endpoints in Doku


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.