# Azure OpenAI

> Chat with OpenAI models deployed on your own Azure resource, create embeddings, and list your deployments and the models you can deploy.

App · 4 actions. Web page: https://docs.lodol.com/docs/integrations/azure-openai

## Actions

### Create embeddings

Turn text into embeddings: lists of numbers that place texts with similar meanings close together, for search and matching. Up to 100 texts at once.

**Inputs**

- Texts (`input`, list, required): The text to embed, or a list of up to 100 texts. Each gets its own embedding, in the same order.
- Deployment (`model`, text): The name of an embedding model's deployment, which is often the model's name, such as text-embedding-3-small. Leave empty for the connection's default Deployment.
- Dimensions (`dimensions`, number): How many numbers each embedding has, for text-embedding-3 models, which can make them shorter. Leave empty for the model's full size. At least 1.

**Outputs**

- `count` (number): How many embeddings came back.
- `deployment` (text): The deployment that answered.
- `dimensions` (number): How many numbers each embedding has.
- `embeddings` (list): One embedding per text, in the order given, each a list of numbers.
- `model` (text): The model and version the deployment runs, such as gpt-4o-2024-08-06.
- `usage` (object): The tokens the request used, which Azure bills.

**Example output**

```json
{
  "count": 1,
  "deployment": "text-embedding-3-small",
  "dimensions": 3,
  "embeddings": [
    [
      0.0023064255,
      -0.009327292,
      0.015797347
    ]
  ],
  "model": "text-embedding-3-small",
  "usage": {
    "prompt_tokens": 8,
    "total_tokens": 8
  }
}
```

### List deployments

List the deployments on your Azure OpenAI resource, with the model each one runs. Steps call a deployment by its name.

**Inputs**: None.

**Outputs**

- `count` (number): How many deployments came back.
- `deployments` (list): The resource's deployments.

**Example output**

```json
{
  "count": 2,
  "deployments": [
    {
      "created_at": "2025-03-04T10:15:27Z",
      "id": "gpt-4o-mini",
      "model": "gpt-4o-mini",
      "name": "gpt-4o-mini",
      "scale_type": "standard",
      "status": "succeeded"
    },
    {
      "created_at": "2025-03-04T10:21:51Z",
      "id": "embeddings",
      "model": "text-embedding-3-small",
      "name": "embeddings",
      "scale_type": "standard",
      "status": "succeeded"
    }
  ]
}
```

### List models

List the models your Azure OpenAI resource can use, with what each can do and when Azure retires it.

**Inputs**

- Can do (`capability`, text): Only models that can do this. One of: `any`, `chat_completion` (Chat), `embeddings`, `completion` (Text completion), `inference` (Can be deployed), `fine_tune` (Fine-tuning). Default: `any`.

**Outputs**

- `count` (number): How many models came back.
- `models` (list): The models.

**Example output**

```json
{
  "count": 2,
  "models": [
    {
      "capabilities": [
        "chat_completion",
        "inference"
      ],
      "created_at": "2024-08-06T00:00:00Z",
      "fine_tuning_ends_on": null,
      "id": "gpt-4o-2024-08-06",
      "inference_ends_on": "2026-03-31",
      "lifecycle_status": "generally-available"
    },
    {
      "capabilities": [
        "embeddings",
        "inference"
      ],
      "created_at": "2024-01-25T00:00:00Z",
      "fine_tuning_ends_on": null,
      "id": "text-embedding-3-small",
      "inference_ends_on": "2027-02-01",
      "lifecycle_status": "generally-available"
    }
  ]
}
```

### Send a chat message

Send a prompt to a model deployed on your Azure OpenAI resource and get its reply. Add earlier messages to continue a conversation, or ask for the reply as JSON.

**Inputs**

- Prompt (`prompt`, text, required): The message or question to send.
- Deployment (`model`, text): The name of the deployment to use, which is often the model's name, such as gpt-4o-mini. Leave empty for the connection's default Deployment.
- Instructions (`system`, text): How the model should behave, such as 'Answer in one short paragraph.' Sent before everything else.
- Earlier messages (`messages`, list): The conversation so far, oldest first, to continue it. Each message has a role (user for the person, assistant for the model) and its content. The prompt is sent after them.
- Maximum tokens (`max_tokens`, number): The longest the reply may be, in tokens (a token is about three quarters of a word). For a reasoning model this includes its thinking. Leave empty for the model's own limit. At least 1.
- Temperature (`temperature`, number): How varied the reply is, from 0 (focused) to 2 (most varied). Leave empty for reasoning models such as o4-mini, which refuse it. From 0 to 2.
- Reply as JSON (`json_output`, true/false): Make the reply a JSON object, returned parsed as data. Say in the prompt which fields you want. Default: `false`.

**Outputs**

- `data` (object): The reply parsed as JSON when Reply as JSON is on, else null.
- `deployment` (text): The deployment that answered.
- `finish_reason` (text): Why the reply ended: stop when it was finished, length when it reached Maximum tokens.
- `model` (text): The model and version the deployment runs, such as gpt-4o-2024-08-06.
- `text` (text): The model's reply.
- `usage` (object): The tokens the request used, which Azure bills.

**Example output**

```json
{
  "data": null,
  "deployment": "gpt-4o-mini",
  "finish_reason": "stop",
  "model": "gpt-4o-mini-2024-07-18",
  "text": "Our support team answers within one business day.",
  "usage": {
    "completion_tokens": 11,
    "prompt_tokens": 24,
    "total_tokens": 35
  }
}
```
