|
1 | | -# Azure AI Integration |
2 | | - |
3 | | -The repository includes functions specifically designed for **Azure AI**, supporting both **Azure OpenAI** models and general **Azure AI** services. |
4 | | - |
5 | | -🔗 [Learn More About Azure AI](https://own.dev/azure-microsoft-com-en-us-solutions-ai) |
6 | | - |
7 | | - |
8 | | -## Pipeline |
9 | | -- 🧩 [Azure AI Foundry Pipeline](https://own.dev/github-owndev-open-webui-functions-azure-ai-foundry) |
10 | | - |
11 | | - |
12 | | -### Features: |
13 | | - |
14 | | -- **Azure OpenAI API Support** |
15 | | - Access models like **GPT-4o, o3**, and **other fine-tuned AI models** via Azure. |
16 | | - |
17 | | -- **Azure AI Model Deployment** |
18 | | - Connect to **custom models** hosted on Azure AI. |
19 | | - |
20 | | -- **Secure API Requests** |
21 | | - Supports API key authentication and environment variable configurations. |
22 | | - |
23 | | - |
24 | | -### Environment Variables: |
25 | | - |
26 | | -Configure the following environment variables to enable Azure AI support: |
27 | | - |
28 | | -```bash |
29 | | -# API key or token for Azure AI |
30 | | -AZURE_AI_API_KEY="your-api-key" |
31 | | - |
32 | | -# Azure AI endpoint |
33 | | -# Examples: |
34 | | -# - For general Azure AI: "https://<your-endpoint>/chat/completions?api-version=2024-05-01-preview" |
35 | | -# - For Azure OpenAI: "https://<your-endpoint>/openai/deployments/<model-name>/chat/completions?api-version=2024-08-01-preview" |
36 | | -AZURE_AI_ENDPOINT="https://<your project>.services.ai.azure.com/models/chat/completions?api-version=2024-05-01-preview" |
37 | | - |
38 | | -# Optional: model names (if not embedded in the URL) |
39 | | -# Supports semicolon or comma separated values: "gpt-4o;gpt-4o-mini" or "gpt-4o,gpt-4o-mini" |
40 | | -AZURE_AI_MODEL="gpt-4o;gpt-4o-mini" |
41 | | - |
42 | | -# If true, the model name will be included in the request body |
43 | | -AZURE_AI_MODEL_IN_BODY=true |
44 | | - |
45 | | -# Whether to use a predefined list of Azure AI models |
46 | | -USE_PREDEFINED_AZURE_AI_MODELS=false |
47 | | - |
48 | | -# If true, use "Authorization: Bearer" instead of "api-key" header |
49 | | -AZURE_AI_USE_AUTHORIZATION_HEADER=false |
50 | | -``` |
51 | | - |
52 | | -> [!TIP] |
53 | | -> 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` |
| 1 | +# Azure AI Integration |
| 2 | + |
| 3 | +The repository includes functions specifically designed for **Azure AI**, supporting both **Azure OpenAI** models and general **Azure AI** services. |
| 4 | + |
| 5 | +🔗 [Learn More About Azure AI](https://azure.microsoft.com/en-us/solutions/ai) |
| 6 | + |
| 7 | +## Pipeline |
| 8 | + |
| 9 | +- 🧩 [Azure AI Foundry Pipeline](../pipelines/azure/azure_ai_foundry.py) |
| 10 | + |
| 11 | +### Features |
| 12 | + |
| 13 | +- **Azure OpenAI API Support** |
| 14 | + Access models like **GPT-4o, o3**, and **other fine-tuned AI models** via Azure. |
| 15 | + |
| 16 | +- **Azure AI Model Deployment** |
| 17 | + Connect to **custom models** hosted on Azure AI. |
| 18 | + |
| 19 | +- **Secure API Requests** |
| 20 | + Supports API key authentication and environment variable configurations. |
| 21 | + |
| 22 | +### Environment Variables |
| 23 | + |
| 24 | +Configure the following environment variables to enable Azure AI support: |
| 25 | + |
| 26 | +```bash |
| 27 | +# API key or token for Azure AI |
| 28 | +AZURE_AI_API_KEY="your-api-key" |
| 29 | + |
| 30 | +# Azure AI endpoint |
| 31 | +# Examples: |
| 32 | +# - For general Azure AI: "https://<your-endpoint>/chat/completions?api-version=2024-05-01-preview" |
| 33 | +# - For Azure OpenAI: "https://<your-endpoint>/openai/deployments/<model-name>/chat/completions?api-version=2024-08-01-preview" |
| 34 | +AZURE_AI_ENDPOINT="https://<your project>.services.ai.azure.com/models/chat/completions?api-version=2024-05-01-preview" |
| 35 | + |
| 36 | +# Optional: model names (if not embedded in the URL) |
| 37 | +# Supports semicolon or comma separated values: "gpt-4o;gpt-4o-mini" or "gpt-4o,gpt-4o-mini" |
| 38 | +AZURE_AI_MODEL="gpt-4o;gpt-4o-mini" |
| 39 | + |
| 40 | +# If true, the model name will be included in the request body |
| 41 | +AZURE_AI_MODEL_IN_BODY=true |
| 42 | + |
| 43 | +# Whether to use a predefined list of Azure AI models |
| 44 | +USE_PREDEFINED_AZURE_AI_MODELS=false |
| 45 | + |
| 46 | +# If true, use "Authorization: Bearer" instead of "api-key" header |
| 47 | +AZURE_AI_USE_AUTHORIZATION_HEADER=false |
| 48 | + |
| 49 | +# Azure Search / RAG Configuration (optional) |
| 50 | +# Azure Search endpoint for document retrieval |
| 51 | +AZURE_SEARCH_ENDPOINT="https://your-search-service.search.windows.net" |
| 52 | + |
| 53 | +# Azure Search index name containing the documents |
| 54 | +AZURE_SEARCH_INDEX_NAME="your-index-name" |
| 55 | + |
| 56 | +# Azure Search project resource ID (optional) |
| 57 | +AZURE_SEARCH_PROJECT_RESOURCE_ID="your-project-resource-id" |
| 58 | + |
| 59 | +# Azure Search API key (if using api_key authentication) |
| 60 | +AZURE_SEARCH_KEY="your-search-api-key" |
| 61 | + |
| 62 | +# Authentication type for Azure Search |
| 63 | +AZURE_SEARCH_AUTHENTICATION_TYPE="system_assigned_managed_identity" |
| 64 | + |
| 65 | +# Semantic configuration name for Azure Search |
| 66 | +AZURE_SEARCH_SEMANTIC_CONFIGURATION="azureml-default" |
| 67 | + |
| 68 | +# Azure Search embedding endpoint (optional) |
| 69 | +AZURE_SEARCH_EMBEDDING_ENDPOINT="your-embedding-endpoint" |
| 70 | + |
| 71 | +# Azure Search embedding API key (optional) |
| 72 | +AZURE_SEARCH_EMBEDDING_KEY="your-embedding-key" |
| 73 | + |
| 74 | +# Query type for Azure Search |
| 75 | +AZURE_SEARCH_QUERY_TYPE="vectorSimpleHybrid" |
| 76 | + |
| 77 | +# Whether to limit search to indexed documents only |
| 78 | +AZURE_SEARCH_IN_SCOPE=false |
| 79 | + |
| 80 | +# Role information for Azure Search responses |
| 81 | +AZURE_SEARCH_ROLE_INFORMATION="You are an AI assistant." |
| 82 | + |
| 83 | +# Azure Search strictness level (1-5) |
| 84 | +AZURE_SEARCH_STRICTNESS=5 |
| 85 | + |
| 86 | +# Number of top documents to retrieve |
| 87 | +AZURE_SEARCH_TOP_N_DOCUMENTS=20 |
| 88 | +``` |
| 89 | + |
| 90 | +### Azure Search / RAG Integration |
| 91 | + |
| 92 | +The pipeline now supports **Azure Search** integration for **Retrieval-Augmented Generation (RAG)**. When configured, the pipeline will automatically include a `data_sources` field in requests to Azure AI, enabling document-based AI responses. |
| 93 | + |
| 94 | +#### Configuration |
| 95 | + |
| 96 | +Configure Azure Search by setting the following environment variables: |
| 97 | + |
| 98 | +- **AZURE_SEARCH_ENDPOINT**: Your Azure Search service endpoint |
| 99 | +- **AZURE_SEARCH_INDEX_NAME**: Name of the search index containing your documents |
| 100 | +- **AZURE_SEARCH_AUTHENTICATION_TYPE**: Authentication method (`system_assigned_managed_identity` or `api_key`) |
| 101 | +- **AZURE_SEARCH_KEY**: API key (if using `api_key` authentication) |
| 102 | + |
| 103 | +#### Optional Settings |
| 104 | + |
| 105 | +- **AZURE_SEARCH_PROJECT_RESOURCE_ID**: Project resource ID |
| 106 | +- **AZURE_SEARCH_SEMANTIC_CONFIGURATION**: Semantic configuration name |
| 107 | +- **AZURE_SEARCH_EMBEDDING_ENDPOINT**: Embedding service endpoint |
| 108 | +- **AZURE_SEARCH_EMBEDDING_KEY**: Embedding service API key |
| 109 | +- **AZURE_SEARCH_QUERY_TYPE**: Query type (`vectorSimpleHybrid`, `vector`, `semantic`) |
| 110 | +- **AZURE_SEARCH_IN_SCOPE**: Limit to indexed documents only |
| 111 | +- **AZURE_SEARCH_ROLE_INFORMATION**: Role information for responses |
| 112 | +- **AZURE_SEARCH_STRICTNESS**: Strictness level (1-5) |
| 113 | +- **AZURE_SEARCH_TOP_N_DOCUMENTS**: Number of documents to retrieve |
| 114 | + |
| 115 | +> [!TIP] |
| 116 | +> 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` |
0 commit comments