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

# Azure OpenAI

> Generate text, structured outputs, and analyze files using Azure OpenAI Service deployments

## Overview

Azure OpenAI tools let you run prompts against your own Azure OpenAI Service deployments. They support plain text generation, structured output validated by a JSON schema, and document/image analysis, all against the deployment, endpoint, and API key you configure.

## Key Features

* `AZURE_OPENAI_INVOKE`
  * Send a prompt (`prompt`) to an Azure OpenAI deployment for text generation
  * Optional structured output with a JSON schema (`json_schema`) — the schema must have `"type": "object"` at the top level
* `AZURE_OPENAI_INVOKE_WITH_FILE`
  * Send files along with a prompt for document and image analysis
  * `file_link` accepts up to 30 file URLs; supported types are PDF, PNG, JPEG/JPG, WEBP, and GIF, up to 100MB per file
  * Also supports structured output via `json_schema` (object-type schemas only)

## Authentication

Azure OpenAI tools are configured per step (or fall back to environment variables):

* `deployment` — the Azure OpenAI deployment name (not the model name). Falls back to `AZURE_OPENAI_MODEL_DEPLOYMENT_NAME` / `AZURE_OPENAI_DEPLOYMENT_NAME`.
* `endpoint` — the resource endpoint, e.g. `https://my-resource.openai.azure.com/`. Falls back to `AZURE_OPENAI_ENDPOINT`. Alternatively, set `resource_name` (the resource subdomain, e.g. `my-resource`); it is derived from the endpoint when omitted.
* `api_key` — the Azure OpenAI API key (stored as a secret). Falls back to `AZURE_OPENAI_API_KEY`.
* `api_version` — the API version. Falls back to `AZURE_OPENAI_API_VERSION`, then `preview`. Use `preview` for the rolling v1 surface, or a dated value such as `2025-04-01-preview`.

Optional settings: `temperature` (0–2, default 0.7), `is_reasoning_model` (see Notes), and `timeout_seconds` (default 300).

**Note**: Treat API keys as sensitive information and never commit them to public repositories.

## Usage Examples

### Example: Structured Output with JSON Schema

```yaml theme={null}
- id: extract_entities
  name: extract_entities
  tool: AZURE_OPENAI_INVOKE
  config:
    - name: deployment
      value: gpt-4o
    - name: endpoint
      value: https://my-resource.openai.azure.com/
    - name: api_key
      value: "{{secrets.AZURE_OPENAI_API_KEY}}"
    - name: temperature
      value: 0.1
  input:
    - name: prompt
      value: |
        Extract the names of people and organizations from the text:

        {{steps.input.result.content}}
    - name: json_schema
      value: |
        {
          "type": "object",
          "properties": {
            "people": {
              "type": "array",
              "items": {"type": "string"}
            },
            "organizations": {
              "type": "array",
              "items": {"type": "string"}
            }
          }
        }
```

### Example: Document Analysis

```yaml theme={null}
- id: analyze_document
  name: analyze_document
  tool: AZURE_OPENAI_INVOKE_WITH_FILE
  config:
    - name: deployment
      value: gpt-4o
    - name: endpoint
      value: https://my-resource.openai.azure.com/
    - name: api_key
      value: "{{secrets.AZURE_OPENAI_API_KEY}}"
  input:
    - name: prompt
      value: |
        Please analyze this document and provide:
        1. A brief summary
        2. Key topics discussed
        3. Any action items or recommendations
    - name: file_link
      value: "{{steps.upload_file.result.url}}"
```

## Notes

* The `json_schema` must have `"type": "object"` at the top level. Wrap arrays in an object property, e.g. `{ "type": "object", "properties": { "items": { "type": "array", "items": { "type": "string" } } } }`. Without `json_schema`, the result is returned as a string.
* Reasoning models (o-series / GPT-5) reject the `temperature` parameter. Since Azure deployment names are user-chosen, this is inferred from the deployment name; set `is_reasoning_model` explicitly to override the heuristic.
* Requests time out after `timeout_seconds` (default 300 seconds / 5 minutes).
* `AZURE_OPENAI_INVOKE_WITH_FILE` accepts at most 30 files per call, 100MB per file. Unsupported file types cause the step to fail with an error.
