-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathsecrets.env.example
More file actions
217 lines (174 loc) · 7.92 KB
/
Copy pathsecrets.env.example
File metadata and controls
217 lines (174 loc) · 7.92 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
# Exemple de configuration locale (POC)
# Copiez en secrets.env puis adaptez si besoin.
#
# IMPORTANT: ne committez jamais secrets.env. Le fichier est déjà dans .gitignore.
#
# Ce fichier contient TOUTES les variables utilisées par l'application.
# Les variables marquées (REQUIRED) doivent être définies.
# Les variables avec valeurs par défaut sont optionnelles.
# =============================================================================
# AZURE CORE RESOURCES (REQUIRED)
# =============================================================================
# --- Managed Identity ---
# User-assigned managed identity client ID (from Terraform: APP_ID_CLIENT_ID)
AZURE_CLIENT_ID=3ae24af5-97c6-437f-a4d2-521fbd5524d4
# --- Service Bus ---
AZURE_SERVICE_BUS_FQDN=classymail-sbus.servicebus.windows.net
AZURE_SERVICE_BUS_QUEUE=pdf-processing-queue
# --- Blob Storage ---
AZURE_STORAGE_ACCOUNT_URL=https://classymailst.blob.core.windows.net/
AZURE_STORAGE_CONTAINER=pdf-inputs
# --- Cosmos DB ---
AZURE_COSMOS_ENDPOINT=https://classymail-cosmos.documents.azure.com:443/
AZURE_COSMOS_DB=emailsdb
AZURE_COSMOS_CONTAINER=emails
# RAG/Chat containers (optional, defaults provided)
AZURE_COSMOS_CHAT_CONTAINER=chat_history
AZURE_COSMOS_CACHE_CONTAINER=vector_cache
# Cosmos key (uniquement si RBAC data-plane est désactivé - NOT RECOMMENDED)
# AZURE_COSMOS_KEY=<cosmos-primary-key>
# =============================================================================
# MICROSOFT AI FOUNDRY / MODEL ENDPOINTS (REQUIRED)
# =============================================================================
# --- Main AI Endpoint (Microsoft AI Foundry) ---
# Terraform output: AI_ENDPOINT
AZURE_AI_ENDPOINT=https://classymail-aifoundry.cognitiveservices.azure.com/
# --- API Configuration ---
AI_API_VERSION=2024-08-01-preview
AI_SCOPE=https://cognitiveservices.azure.com/.default
# AI_API_KEY= # Optional: for key-based auth (NOT RECOMMENDED - use Managed Identity)
# --- Mistral OCR Model ---
MISTRAL_ENDPOINT=${AZURE_AI_ENDPOINT}
MISTRAL_DEPLOYMENT=mistral-document-ai-2512
MISTRAL_MODE=maas
MISTRAL_API_VERSION=2024-05-01-preview
# --- Phi-4 Classification Model (Primary) ---
PHI_ENDPOINT=${AZURE_AI_ENDPOINT}
PHI_DEPLOYMENT=phi-4
# --- Fallback Model (for long documents >8K tokens) ---
PHI_FALLBACK_ENDPOINT=${AZURE_AI_ENDPOINT}
PHI_FALLBACK_DEPLOYMENT=gpt-4.1-mini
# =============================================================================
# RAG & EMBEDDINGS (OPTIONAL - required if chatbot/RAG enabled)
# =============================================================================
# --- Embedding Model (Vector Search) ---
EMBEDDING_ENDPOINT=${AZURE_AI_ENDPOINT}
EMBEDDING_DEPLOYMENT=text-embedding-3-small
EMBEDDING_API_VERSION=2024-08-01-preview
# --- Chat Model (RAG Chatbot) ---
CHAT_ENDPOINT=${AZURE_AI_ENDPOINT}
CHAT_DEPLOYMENT=gpt-5.1
CHAT_API_VERSION=preview
# Opt-in token-by-token streaming for the chat assistant (SSE). Default off.
CHAT_STREAMING=false
# --- Vision Model (Image Description) ---
VISION_ENDPOINT=${AZURE_AI_ENDPOINT}
VISION_DEPLOYMENT=gpt-4.1-mini
VISION_API_VERSION=2024-08-01-preview
# =============================================================================
# PII DETECTION & ANONYMIZATION (OPTIONAL)
# =============================================================================
# --- Azure AI Language Service (Native PII Detection) ---
# Optional: Requires terraform var deploy_language_service=true
# AZURE_LANGUAGE_ENDPOINT=https://classymail-language.cognitiveservices.azure.com/
# AZURE_LANGUAGE_KEY= # Optional: for key-based auth
# --- Azure Document Intelligence (OCR Fallback) ---
# Activates when Mistral OCR fails or circuit breaker is open.
# RECOMMENDED: deploy a standalone resource (deploy_document_intelligence=true in Terraform)
# and use the dedicated endpoint below. The AI Foundry generic endpoint does NOT
# reliably serve the /documentintelligence/ REST path.
#
# Standalone (recommended — after terraform apply):
AZURE_DOCUMENT_INTELLIGENCE_ENDPOINT=https://${PREFIX}-doc-intel.cognitiveservices.azure.com/
# Foundry fallback (NOT recommended — may return 400):
# AZURE_DOCUMENT_INTELLIGENCE_ENDPOINT=${AZURE_AI_ENDPOINT}
# DOC_INTELLIGENCE_API_VERSION=2024-11-30
# --- Anonymization Model (Fine-Tuning Export) ---
ANONYMIZER_ENDPOINT=${AZURE_AI_ENDPOINT}
ANONYMIZER_DEPLOYMENT=gpt-4.1-mini
ANONYMIZER_API_VERSION=2024-08-01-preview
ANONYMIZER_PROMPT_VERSION=v1
ANONYMIZER_MAX_TOKENS=6000
# =============================================================================
# TELEMETRY & OBSERVABILITY (REQUIRED for production)
# =============================================================================
# --- Application Insights ---
# From Terraform output: azurerm_application_insights.appi.connection_string
APPLICATIONINSIGHTS_CONNECTION_STRING=InstrumentationKey=...;IngestionEndpoint=https://...
# --- Log Analytics ---
# From Terraform output: azurerm_log_analytics_workspace.log.workspace_id
# Format: xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx
LOG_ANALYTICS_WORKSPACE_ID=
# --- OpenTelemetry Configuration ---
OTEL_SERVICE_NAME=classymail-api
OTEL_RESOURCE_ATTRIBUTES=service.namespace=classymail
AZURE_MONITOR_ENABLE_GENAI_TRACES=true
# Optional: Custom OTLP endpoint (e.g., local Jaeger)
# OTEL_EXPORTER_OTLP_ENDPOINT=http://localhost:4318/v1/traces
# =============================================================================
# CONFIGURATION & TUNING (OPTIONAL - defaults provided)
# =============================================================================
# --- Data Residency & Region ---
AZURE_REGION=swedencentral
AZURE_PREFERRED_DATA_ZONE=eu-central
# --- Cosmos DB Query Limits ---
COSMOS_QUERY_MAX_LIMIT=100
# --- Model Context Windows ---
PHI_PRIMARY_MAX_INPUT_TOKENS=8000
PHI_FALLBACK_MAX_INPUT_TOKENS=120000
PHI_RESERVED_OUTPUT_TOKENS=1000
# --- Cost Tracking (UI) ---
PHI4_COST_PER_1K_INPUT=0.000107
PHI4_COST_PER_1K_OUTPUT=0.00043
MISTRAL_OCR_COST_PER_1K_PAGES=1.0
FALLBACK_COST_PER_1K_INPUT=0.00015
FALLBACK_COST_PER_1K_OUTPUT=0.0006
# --- OCR Configuration ---
MISTRAL_OCR_MAX_ATTEMPTS=2
REVIEW_CONFIDENCE_THRESHOLD=0.85
# =============================================================================
# WORKER CONFIGURATION (OPTIONAL - defaults provided)
# =============================================================================
# --- Worker Behavior ---
WORKER_CONCURRENCY=30
WORKER_LOCK_RENEWAL_DURATION=3600
# --- Rate Limits (RPM/TPM per model) ---
MISTRAL_RPM=30
MISTRAL_TPM=60000
PHI_RPM=60
PHI_TPM=80000
CHAT_RPM=60
CHAT_TPM=80000
# =============================================================================
# UI CONFIGURATION (OPTIONAL)
# =============================================================================
UI_SHOW_INFO_MODAL=true
UI_SHOW_DEVELOPER_TAB=true
ORGANIZATION_NAME=ClassyMail
MAX_UPLOAD_SIZE=10
UPLOAD_MAX_BYTES=10485760
# =============================================================================
# ENVIRONMENT & DEPLOYMENT (OPTIONAL)
# =============================================================================
AZURE_ENV=development
PORT=8000
# APP_VERSION=1.0.0 # Auto-populated by CI/CD
# AZURE_SUBSCRIPTION_ID= # Informational only
# AZURE_TENANT_ID= # Informational only
# AZURE_RESOURCE_GROUP= # Informational only
# --- Worker Mode (Local Development) ---
# Set to "true" to run worker in same process as API (dev only)
# ENABLE_WORKER=false
# =============================================================================
# TESTING & DEVELOPMENT (LOCAL ONLY)
# =============================================================================
# --- Azure OpenAI (for scripts/generate_dummy_pdfs.py --use-aoai) ---
AZURE_OPENAI_ENDPOINT=${AZURE_AI_ENDPOINT}
AZURE_OPENAI_DEPLOYMENT=gpt-4.1-mini
AZURE_OPENAI_API_VERSION=2024-10-01-preview
AZURE_OPENAI_SCOPE=https://cognitiveservices.azure.com/.default
# AZURE_OPENAI_API_KEY= # Optional: if Managed Identity not available locally
AZURE_OPENAI_TIMEOUT=30
# --- API Base URL (for E2E tests) ---
# API_BASE_URL=http://localhost:8000
# BASE_URL=http://localhost:8000