You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: articles/postgresql/flexible-server/how-to-integrate-azure-ai.md
+4-19Lines changed: 4 additions & 19 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -52,12 +52,6 @@ To retrieve the database connection details:
52
52
export PGPASSWORD="{your-password}"
53
53
```
54
54
55
-
Add one extra environment variable to require an SSL connection to the database.
56
-
57
-
```bash
58
-
export PGSSLMODE=require
59
-
```
60
-
61
55
Connect to your database using the [psql command-line utility](https://www.postgresguide.com/utilities/psql/) by entering the following at the prompt.
62
56
63
57
```bash
@@ -100,12 +94,11 @@ The meta-command output shows that the `azure_ai` extension creates three schema
100
94
|`azure_openai`| Contains the UDFs that enable calling an Azure OpenAI endpoint. |
101
95
|`azure_cognitive`| Provides UDFs and composite types related to integrating the database with Azure Cognitive Services. |
102
96
103
-
The functions and types are all associated with one of the schemas. To review the functions defined in the `azure_ai` schema, use the `\df` meta-command, specifying the schema whose functions should be displayed. The `\x` commands before and after the `\df`command toggle the expanded display on and off to make the output from the command easier to view in the Azure Cloud Shell.
97
+
The functions and types are all associated with one of the schemas. To review the functions defined in the `azure_ai` schema, use the `\df` meta-command, specifying the schema whose functions should be displayed. The `\x auto` commands before the `\df`command toggle the expanded display on and off automatically to make the output from the command easier to view in the Azure Cloud Shell.
104
98
105
99
```sql
106
-
\x
100
+
\x auto
107
101
\df+ azure_ai.*
108
-
\x
109
102
```
110
103
111
104
The `azure_ai.set_setting()`functionlets you set the endpoint and critical values for Azure AI services. It accepts a **key** and the **value** to assign it. The `azure_ai.get_setting()`functionprovides a way to retrieve the values you set with the `set_setting()` function. It accepts the **key** of the setting you want to view. For both methods, the key must be one of the following:
@@ -196,9 +189,7 @@ The `bill_summaries` table is now ready to store embeddings. Using the `azure_op
196
189
Before using the `create_embeddings()` function, run the following command to inspect it and review the required arguments:
197
190
198
191
```sql
199
-
\x
200
192
\df+ azure_openai.*
201
-
\x
202
193
```
203
194
204
195
The `Argument data types` property in the output of the `\df+ azure_openai.*` command reveals the list of arguments the function expects.
@@ -275,9 +266,7 @@ To demonstrate some of the capabilities of the `azure_cognitive` functions of th
275
266
To use the Azure AI Language service's ability to generate new, original content, you use the `summarize_abstractive` function to create a summary of text input. Use the `\df` meta-command from `psql` again, this time to look specifically at the `azure_cognitive.summarize_abstractive` function.
276
267
277
268
```sql
278
-
\x
279
269
\df azure_cognitive.summarize_abstractive
280
-
\x
281
270
```
282
271
283
272
The `Argument data types` property in the output of the `\df azure_cognitive.summarize_abstractive` command reveals the list of arguments the function expects.
@@ -291,11 +280,7 @@ The `Argument data types` property in the output of the `\df azure_cognitive.sum
291
280
| sentence_count | `integer` | 3 | The maximum number of sentences to include in the generated summary. |
292
281
| disable_service_logs | `boolean` | false | The Language service logs your input text for 48 hours solely to allow for troubleshooting issues. Setting this property to `true` disables input logging and might limit our ability to investigate issues that occur. For more information, see Cognitive Services Compliance and Privacy notes at <https://aka.ms/cs-compliance> and Microsoft Responsible AI principles at <https://www.microsoft.com/ai/responsible-ai>. |
293
282
294
-
The `summarize_abstractive` function, including its required arguments, looks like the following:
295
-
296
-
```sql
297
-
azure_cognitive.summarize_abstractive(text TEXT, language TEXT)
298
-
```
283
+
The `summarize_abstractive` functionfunction requires the following arguments: `azure_cognitive.summarize_abstractive(text TEXT, language TEXT)`.
299
284
300
285
The following query against the `bill_summaries` table uses the `summarize_abstractive` function to generate a new one-sentence summary for the text of a bill, allowing you to incorporate the power of generative AI directly into your queries.
301
286
@@ -311,7 +296,7 @@ The function can also be used to write data into your database tables. Modify th
311
296
312
297
```sql
313
298
ALTER TABLE bill_summaries
314
-
ADD COLUMN one_sentence_summary text;
299
+
ADD COLUMN one_sentence_summary TEXT;
315
300
```
316
301
317
302
Next, update the table with the summaries. The `summarize_abstractive` function returns an array of text (`text[]`). The `array_to_string` function converts the return value to its string representation. In the query below, the `throw_on_error` argument has been set to `false`. This setting allows the summarization process to continue if an error occurs.
0 commit comments