Skip to content

kimtth/rag-minimum-azure-ai-search

Repository files navigation

A minimal approach to RAG using Azure AI Search

๐Ÿ”๐Ÿค–๐Ÿ’ฌ A minimal RAG (Retrieval-Augmented Generation) implementation that indexes FAQ data into Azure AI Search with vector embeddings and provides a chat terminal using Azure OpenAI for answering questions based on the retrieved content.

Setup

  1. Copy .env.example โ†’ .env and add your Azure endpoints & keys
  2. poetry install

Ingest FAQ

  • To use Vector Search in Azure AI Search, a vectorizer can connect the Azure OpenAI Embedding model to turn your text into a numerical embedding. If you prefer, without using a vectorizer, you can also create the embedding yourself and provide it directly to Azure AI Search for Vector Search.
  • Options 1 and 3 demonstrate how to provide the embedding directly without using a vectorizer. - chat_app.py uses VectorizedQuery.
  • Options 2 and 4 demonstrate the use of a vectorizer along with semantic search. - chat_app_v2.py uses VectorizableTextQuery.
  1. ๐Ÿ“คPush - upload local data
    python push_aisearch_index.py 
  2. ๐Ÿ“คPush - upload local data w/ Vectorizer and Semantic Search
    python push_aisearch_index_v2.py 
  3. ๐Ÿ“ฅPull - using Azure AI Search Indexer
    python pull_aisearch_index.py 
  4. ๐Ÿ“ฅPull - using Azure AI Search Indexer w/ Vectorizer and Semantic Search
    python pull_aisearch_index_v2.py 

Chat

  • To utilize an embedding directly with VectorizedQuery
    python chat_app.py 
  • To utilize text with a vectorizer, use the VectorizableTextQuery method.
    python chat_app_v2.py 
  • Type your question or exit to quit.

Azure AI Foundry

To connect Azure AI Search with Azure AI Foundry, you need to add both a vectorizer and semantic search to the index. Use an existing AI Search index with the Azure AI Search tool

๐Ÿ“š Learn more: csv indexer

About

Azure AI Search Index creation for FAQ retrieval. (csv Indexer) ๐Ÿ”๐Ÿค–๐Ÿ’ฌ

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages