Configure Cognee with Azure OpenAI for enterprise-grade AI memory with enhanced security and compliance
Azure Subscription
Create Azure OpenAI Resource
# Using Azure CLI az cognitiveservices account create \ --name "your-openai-resource" \ --resource-group "your-resource-group" \ --location "eastus" \ --kind "OpenAI" \ --sku "S0"
Deploy Models
# Deploy GPT-4 model az cognitiveservices account deployment create \ --name "your-openai-resource" \ --resource-group "your-resource-group" \ --deployment-name "gpt-4-deployment" \ --model-name "gpt-4" \ --model-version "0613" \ --model-format "OpenAI" \ --scale-type "Standard"
import os import cognee # Configure Azure OpenAI os.environ["LLM_PROVIDER"] = "azure_openai" os.environ["LLM_API_KEY"] = "your-azure-openai-api-key" os.environ["AZURE_OPENAI_ENDPOINT"] = "https://your-resource.openai.azure.com/" os.environ["LLM_MODEL"] = "azure/gpt-4" os.environ["AZURE_OPENAI_API_VERSION"] = "2024-02-15-preview" # Test the configuration print("Azure OpenAI configured successfully!")
import os import cognee # Comprehensive Azure OpenAI setup os.environ["LLM_PROVIDER"] = "azure_openai" os.environ["LLM_API_KEY"] = "your-azure-openai-api-key" os.environ["AZURE_OPENAI_ENDPOINT"] = "https://your-resource.openai.azure.com/" os.environ["LLM_MODEL"] = "azure/gpt-4" os.environ["AZURE_OPENAI_API_VERSION"] = "2024-02-15-preview" # Model parameters os.environ["LLM_TEMPERATURE"] = "0.1" os.environ["LLM_MAX_TOKENS"] = "4000" os.environ["LLM_TOP_P"] = "0.95" # Embedding configuration os.environ["EMBEDDING_PROVIDER"] = "azure_openai" os.environ["EMBEDDING_MODEL"] = "azure/text-embedding-ada-002" os.environ["AZURE_EMBEDDING_DEPLOYMENT"] = "your-embedding-deployment" print("Advanced Azure OpenAI configuration complete!")
import os # Use API key from Azure portal os.environ["LLM_API_KEY"] = "your-32-character-api-key" os.environ["AZURE_OPENAI_ENDPOINT"] = "https://your-resource.openai.azure.com/"
Private Networking
# Private endpoint configuration os.environ["AZURE_OPENAI_ENDPOINT"] = "https://your-private-endpoint.cognitiveservices.azure.com/" os.environ["AZURE_USE_PRIVATE_ENDPOINT"] = "true" # Ensure your Cognee deployment can reach the private endpoint
Monitoring & Logging
# Enable detailed logging os.environ["AZURE_MONITOR_ENABLED"] = "true" os.environ["AZURE_LOG_ANALYTICS_WORKSPACE"] = "your-workspace-id" # Cognee will send metrics to Azure Monitor
Content Filtering