The repository includes functions specifically designed for Azure AI, supporting both Azure OpenAI models and general Azure AI services.
-
Azure OpenAI API Support
Access models like GPT-4o, o3, and other fine-tuned AI models via Azure. -
Azure AI Model Deployment
Connect to custom models hosted on Azure AI. -
Secure API Requests
Supports API key authentication and environment variable configurations.
Configure the following environment variables to enable Azure AI support:
# Custom prefix for pipeline display name (default: "Azure AI")
# The colon ":" will be added automatically between prefix and model name
# Examples: "Azure AI" → "Azure AI: gpt-4o", "My Azure" → "My Azure: gpt-4o"
AZURE_AI_PIPELINE_PREFIX="Azure AI"
# API key or token for Azure AI
AZURE_AI_API_KEY="your-api-key"
# Azure AI endpoint
# Examples:
# - For general Azure AI: "https://<your-endpoint>/chat/completions?api-version=2024-05-01-preview"
# - For Azure OpenAI: "https://<your-endpoint>/openai/deployments/<model-name>/chat/completions?api-version=2024-08-01-preview"
AZURE_AI_ENDPOINT="https://<your project>.services.ai.azure.com/models/chat/completions?api-version=2024-05-01-preview"
# Optional: model names (if not embedded in the URL)
# Supports semicolon or comma separated values: "gpt-4o;gpt-4o-mini" or "gpt-4o,gpt-4o-mini"
AZURE_AI_MODEL="gpt-4o;gpt-4o-mini"
# If true, the model name will be included in the request body
AZURE_AI_MODEL_IN_BODY=true
# Whether to use a predefined list of Azure AI models
USE_PREDEFINED_AZURE_AI_MODELS=false
# If true, use "Authorization: Bearer" instead of "api-key" header
AZURE_AI_USE_AUTHORIZATION_HEADER=false
# Azure AI Search endpoint for document retrieval (Only for Azure OpenAI)
# IMPORTANT: Azure AI Search only works with Azure OpenAI endpoints in this format:
# https://<deployment>.openai.azure.com/openai/deployments/<model>/chat/completions?api-version=2025-01-01-preview
AZURE_AI_ENDPOINT="https://<deployment>.openai.azure.com/openai/deployments/<model>/chat/completions?api-version=2025-01-01-preview"
# Azure AI Data Sources / RAG Configuration
# Complete JSON configuration for Azure Search - copy exactly and replace placeholder values
AZURE_AI_DATA_SOURCES='[{"type":"azure_search","parameters":{"endpoint":"https://<your-search-service>.search.windows.net","index_name":"<your-index-name>","authentication":{"type":"api_key","key":"<your-search-api-key>"}}}]'
# Enable relevance score extraction from Azure Search (default: true)
# When enabled, automatically adds include_contexts to get original_search_score and rerank_score
AZURE_AI_INCLUDE_SEARCH_SCORES=trueThe pipeline supports Azure AI Search integration for Retrieval-Augmented Generation (RAG). When configured, the pipeline automatically includes a data_sources field in requests to Azure AI, enabling document-based AI responses that can cite and reference your indexed content.
Important
Azure AI Search integration only works with Azure OpenAI endpoints in this specific format:
https://<deployment>.openai.azure.com/openai/deployments/<model>/chat/completions?api-version=2025-01-01-preview
For detailed information about Azure AI Search configuration, please refer to:
- 📚 Azure AI Search with Azure OpenAI - Official Guide
- 🔧 Data Sources API Reference
- 🔍 Azure Search Parameters Reference
Configure Azure AI Search by setting the AZURE_AI_DATA_SOURCES environment variable with your Azure Search configuration.
Simple Example:
AZURE_AI_DATA_SOURCES='[{"type":"azure_search","parameters":{"endpoint":"https://my-search.search.windows.net","index_name":"my-index","authentication":{"type":"api_key","key":"your-search-api-key"}}}]'Tip
Copy the JSON exactly as shown above - this is the complete configuration that goes into the AZURE_AI_DATA_SOURCES field. Just replace:
my-searchwith your Azure Search service namemy-indexwith your search index nameyour-search-api-keywith your actual Azure Search API key
[
{
"type": "azure_search",
"parameters": {
"endpoint": "https://YOUR-SEARCH-SERVICE.search.windows.net",
"index_name": "YOUR-INDEX-NAME",
"authentication": {
"type": "api_key",
"key": "YOUR-SEARCH-API-KEY"
}
}
}
]For advanced use cases, you can include additional parameters:
[
{
"type": "azure_search",
"parameters": {
"endpoint": "https://YOUR-SEARCH-SERVICE.search.windows.net",
"index_name": "YOUR-INDEX-NAME",
"authentication": {
"type": "api_key",
"key": "YOUR-SEARCH-API-KEY"
},
"query_type": "vectorSimpleHybrid",
"semantic_configuration": "default",
"top_n_documents": 20,
"strictness": 3,
"role_information": "You are an AI assistant that helps with questions based on the provided documents."
}
}
]- Create Azure Search Service - Set up an Azure Search service in the Azure portal
- Create and populate index - Upload your documents to a search index
- Get API key - Copy the API key from your Azure Search service
- Configure pipeline - Add the
AZURE_AI_DATA_SOURCESenvironment variable - Use Azure OpenAI endpoint - Ensure you're using the correct Azure OpenAI URL format
- Wrong endpoint format: Make sure you're using Azure OpenAI URLs, not regular Azure AI endpoints
- Invalid JSON: Copy the JSON template exactly and only change the placeholder values
- Missing API key: Ensure your Azure Search API key has proper permissions
- Index not found: Verify your index name matches exactly (case-sensitive)
The pipeline automatically provides native OpenWebUI citation support for Azure AI Search responses. When Azure AI Search is configured, the pipeline:
- Emits citation events via
__event_emitter__for the OpenWebUI frontend to display interactive citation cards - Converts
[docX]references to clickable markdown links that link directly to document URLs - Extracts relevance scores when
AZURE_AI_INCLUDE_SEARCH_SCORES=true - Filters citations to only show documents actually referenced in the response
Example: Clickable Document Links
# Original Azure AI response
**Docker container actions** are a type of GitHub Actions [doc1]...
# Enhanced response (with clickable links)
**Docker container actions** are a type of GitHub Actions [[doc1]](https://example.com/README.md)...Citation Card Features:
- Source information with
[docX]prefix for easy identification - Relevance percentage displayed on citation cards (requires
AZURE_AI_INCLUDE_SEARCH_SCORES=true) - Document preview with content snippets
- Clickable links to source documents when URLs are available
- Streaming support with links converted inline as content streams
Relevance Score Selection:
The pipeline uses the filter_reason field from Azure Search to select the appropriate score:
filter_reason="rerank"→ usesrerank_scorefilter_reason="score"or not present → usesoriginal_search_score
For more details, see the Azure AI Citations Documentation.
Tip
To use Azure OpenAI and other Azure AI models simultaneously, you can use the following URL: https://<your project>.services.ai.azure.com/models/chat/completions?api-version=2024-05-01-preview