Skip to content

Azure-Samples/azure-sql-db-vector-search

Repository files navigation

Native Vector Support in Azure SQL and SQL Server

This repo hosts samples meant to help use the new Native Vector Support in Azure SQL DB feature. We illustrate key technical concepts and demonstrate how you can store and query embeddings in Azure SQL data to enhance your application with AI capabilities.

Important

These functions are in preview and is subject to change. Preview features are not meant for production use and are subject to additional terms of use. Read everything about how to access the Early Adopter Preview here: Early Adopter Preview of Native Vector Support

Prerequisites

To use the provided samples make sure you have the following pre-requisites:

  1. An Azure subscription - Create one for free

  2. Azure SQL Database - Create one for free

  3. Make sure you have an Azure OpenAI resource created in your Azure subscription.

  4. Make sure you have access to the Early Adopter Preview by filling out this form: https://aka.ms/azuresql-vector-eap

  5. Azure Data Studio - Download for free to use the notebooks offline. SQL Server Management Studio is also an option if you don't want to use notebook offline.

Samples

Getting Started

A simple getting started to get familiar with common vector functions is available here: Getting-Started

Embeddings

Learn how to get embeddings from OpenAI directly from Azure SQL using the sample available the Embeddings/T-SQL folder.

Vector Search

The Vector-Search example illustrates the implementation of Vector Similarity Search within an SQL database, highlighting the capabilities of semantic search. By leveraging vector representations of text, the system can identify reviews that share contextual similarities with a given search query, transcending the limitations of keyword exact matches. Additionally, it demonstrates the integration of Keyword Search to guarantee the inclusion of specific terms within the search outcomes.

Hybrid Search

The Python sample in the Hybrid-Search folder shows how to combine Fulltext search in Azure SQL database with BM25 ranking and cosine similarity ranking to do hybrid search.

Retrieval Augmented Generation

The RAG pattern is a powerful way to generate text using a pre-trained language model and a retrieval mechanism. The Retrieval Augmented Generation folder contains a sample that demonstrates how to use the RAG pattern with Azure SQL and Azure OpenAI, using Python notebooks.

Entity Framework Core

If you are using .NET EF Core, you can use the Entity-Framework-Core sample to see how to use the new vector functions in your application.

Resources

Trademarks

This project may contain trademarks or logos for projects, products, or services. Authorized use of Microsoft trademarks or logos is subject to and must follow Microsoft's Trademark & Brand Guidelines. Use of Microsoft trademarks or logos in modified versions of this project must not cause confusion or imply Microsoft sponsorship. Any use of third-party trademarks or logos are subject to those third-party's policies.

About

No description, website, or topics provided.

Resources

License

Code of conduct

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages