Skip to content

Commit c1dd415

Browse files
Add new params available for the overloads of create_embeddings UDF
1 parent 4d9950f commit c1dd415

File tree

1 file changed

+18
-6
lines changed

1 file changed

+18
-6
lines changed

articles/postgresql/flexible-server/generative-ai-azure-openai.md

Lines changed: 18 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ title: Generate vector embeddings with Azure OpenAI in Azure Database for Postgr
33
description: Use vector indexes and Azure Open AI embeddings in PostgreSQL for retrieval augmented generation (RAG) patterns.
44
author: mulander
55
ms.author: adamwolk
6-
ms.date: 01/02/2024
6+
ms.date: 04/05/2024
77
ms.service: postgresql
88
ms.subservice: flexible-server
99
ms.custom:
@@ -29,7 +29,7 @@ Invoke [Azure OpenAI embeddings](../../ai-services/openai/reference.md#embedding
2929
In the Azure OpenAI resource, under **Resource Management** > **Keys and Endpoints** you can find the endpoint and the keys for your Azure OpenAI resource. To invoke the model deployment, enable the `azure_ai` extension using the endpoint and one of the keys.
3030

3131
```postgresql
32-
select azure_ai.set_setting('azure_openai.endpoint','https://<endpoint>.openai.azure.com');
32+
select azure_ai.set_setting('azure_openai.endpoint', 'https://<endpoint>.openai.azure.com');
3333
select azure_ai.set_setting('azure_openai.subscription_key', '<API Key>');
3434
```
3535

@@ -38,9 +38,9 @@ select azure_ai.set_setting('azure_openai.subscription_key', '<API Key>');
3838
Invokes the Azure OpenAI API to create embeddings using the provided deployment over the given input.
3939

4040
```postgresql
41-
azure_openai.create_embeddings(deployment_name text, input text, timeout_ms integer DEFAULT 3600000, throw_on_error boolean DEFAULT true)
41+
azure_openai.create_embeddings(deployment_name text, input text, timeout_ms integer DEFAULT 3600000, throw_on_error boolean DEFAULT true, max_attempts integer DEFAULT 1, retry_delay_ms integer DEFAULT 1000)
42+
azure_openai.create_embeddings(deployment_name text, input text[], batch_size integer DEFAULT 100, timeout_ms integer DEFAULT 3600000, throw_on_error boolean DEFAULT true, max_attempts integer DEFAULT 1, retry_delay_ms integer DEFAULT 1000)
4243
```
43-
4444
### Arguments
4545

4646
#### `deployment_name`
@@ -49,7 +49,11 @@ azure_openai.create_embeddings(deployment_name text, input text, timeout_ms inte
4949

5050
#### `input`
5151

52-
`text` input used to create embeddings.
52+
`text` or `text[]` single text or array of texts, depending on the overload of the function used, for which embeddings are created.
53+
54+
#### `batch_size`
55+
56+
`integer DEFAULT 100` number of records to process at a time (only available for the overload of the function for which parameter `input` is of type `text[]`).
5357

5458
#### `timeout_ms`
5559

@@ -59,9 +63,17 @@ azure_openai.create_embeddings(deployment_name text, input text, timeout_ms inte
5963

6064
`boolean DEFAULT true` on error should the function throw an exception resulting in a rollback of wrapping transactions.
6165

66+
#### `max_attempts`
67+
68+
`integer DEFAULT 1` number of times the extension will retry calling the Azure OpenAI endpoint for embedding creation if it fails with any retryable error.
69+
70+
#### `retry_delay_ms`
71+
72+
`integer DEFAULT 1000` amount of time (milliseconds) that the extension will wait, before calling again the Azure OpenAI endpoint for embedding creation, when it fails with any retryable error.
73+
6274
### Return type
6375

64-
`real[]` a vector representation of the input text when processed by the selected deployment.
76+
`real[]` or `TABLE(embedding real[])` a single element or a single-column table, depending on the overload of the function used, with vector representations of the input text, when processed by the selected deployment.
6577

6678
## Use OpenAI to create embeddings and store them in a vector data type
6779

0 commit comments

Comments
 (0)