The azure_ai extension to Azure Database for PostgreSQL, definition and demo
Published Feb 27 2024 10:43 AM 3,606 Views
Microsoft

For the first few years few people knew about the pgvector extension to Postgres—and then in 2023, pgvector took the world by storm. Why? Because pgvector gives you ways to store and search vectors in Postgres, enabling all sorts of generative AI capabilities to be built into applications.

 

If you’re building AI applications on top of Azure Database for PostgreSQL – Flexible Server, you can of course use use pgvector on Azure with Flexible Server.

And the big news is that Flexible Server in Azure Database for PostgreSQL is now directly integrated with Azure OpenAI. Yep, last November we rolled out the new azure_ai extension (Preview) to Azure Database for PostgreSQL.

 

This blog post will outline the key things to know about how azure_ai can help you build recommender systems by using semantic search capabilities—along with a demo.

 

In addition to demo’ing semantic search (looking for high protein recipes), the demo also features using azure_ai to do text classification such as sentiment analysis and language detection, as well as info extraction, specifically PII redaction.

 

What is azure_ai?

 

Before you watch the demo below, here are some introductory basics about azure_ai:

 

  • It’s an extension to Azure Database for PostgreSQL: azure_ai is an extension, created by the Postgres team at Microsoft and which you can use with Azure Database for PostgreSQL – Flexible Server.

 

  • Enables you to create vector embeddings from the database layer: With azure_ai you can use Azure OpenAI directly from Azure Database for PostgreSQL. This means you can generate text embeddings[1] by using SQL queries to call into both Azure OpenAI and Azure AI Language services—without needing a separate application layer.

    For those of you for whom SQL is your preferred language, you can now create and query these embeddings natively at the database layer in Azure Database for PostgreSQL.

  • Complimentary to pgvector: When using azure_ai to generate embeddings, you’ll still want to use pgvector to store the embeddings (and do distance computations) in Azure Database for PostgreSQL.

 

Demo of using Azure AI with Azure Database for PostgreSQL and pgvector

 

At the PASS Data Summit 2023 there was a Microsoft keynote led by Shireesh Thota. And I was invited on stage to give a demo of what azure_ai can do. No pressure. :smile: Seriously, this tech made it quite easy to deliver a solid demo.

 

This short 5.5 minute demo of azure_ai on YouTube shows how you can improve the relevance of search results on a recipe website by using azure_ai to deliver semantic search results.

 

Specifically, the demo shows how you can use this new extension to search for high protein recipes on a recipe website even when the recipes don’t contain the term “high protein” anywhere in the recipe—as compared to other Postgres techniques such as using the LIKE clause or using Postgres full text search.

 

In addition, the demo shows how azure_ai integrates Azure Database for PostgreSQL with the Azure AI Language service (for sentiment analysis, language detection, and PII redaction.)

 

Figure 1: Demo of Azure AI & pgvector with Azure Database for PostgreSQL on the Microsoft Developer YouTube channel

 

Where to learn more about azure_ai and Postgres

 

To dive deeper into what azure_ai can do for you in Azure Database for PostgreSQL – Flexible Server, these links give you a good place to start:

 


Footnotes

  1. Text embeddings are vector of numbers that encode the semantic information contained in the text—and can be used to do things like semantic search, a.k.a. similarity search. 
Co-Authors
Version history
Last update:
‎Feb 27 2024 10:35 AM
Updated by: