Skip to content

Commit 44bc12b

Browse files
authored
fix(ocr-azure): added OCR_AZURE_API_KEY envvar (#1102)
1 parent 2ebfb57 commit 44bc12b

File tree

2 files changed

+4
-3
lines changed

2 files changed

+4
-3
lines changed

apps/sim/lib/documents/document-processor.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -116,7 +116,7 @@ async function parseDocument(
116116
}> {
117117
const isPDF = mimeType === 'application/pdf'
118118
const hasAzureMistralOCR =
119-
env.AZURE_OPENAI_API_KEY && env.OCR_AZURE_ENDPOINT && env.OCR_AZURE_MODEL_NAME
119+
env.OCR_AZURE_API_KEY && env.OCR_AZURE_ENDPOINT && env.OCR_AZURE_MODEL_NAME
120120
const hasMistralOCR = env.MISTRAL_API_KEY
121121

122122
// Check Azure Mistral OCR configuration
@@ -288,7 +288,7 @@ async function makeOCRRequest(endpoint: string, headers: Record<string, string>,
288288

289289
async function parseWithAzureMistralOCR(fileUrl: string, filename: string, mimeType: string) {
290290
validateOCRConfig(
291-
env.AZURE_OPENAI_API_KEY,
291+
env.OCR_AZURE_API_KEY,
292292
env.OCR_AZURE_ENDPOINT,
293293
env.OCR_AZURE_MODEL_NAME,
294294
'Azure Mistral OCR'
@@ -306,7 +306,7 @@ async function parseWithAzureMistralOCR(fileUrl: string, filename: string, mimeT
306306
env.OCR_AZURE_ENDPOINT!,
307307
{
308308
'Content-Type': 'application/json',
309-
Authorization: `Bearer ${env.AZURE_OPENAI_API_KEY}`,
309+
Authorization: `Bearer ${env.OCR_AZURE_API_KEY}`,
310310
},
311311
{
312312
model: env.OCR_AZURE_MODEL_NAME,

apps/sim/lib/env.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -74,6 +74,7 @@ export const env = createEnv({
7474
WAND_OPENAI_MODEL_NAME: z.string().optional(), // Wand generation OpenAI model name (works with both regular OpenAI and Azure OpenAI)
7575
OCR_AZURE_ENDPOINT: z.string().url().optional(), // Azure Mistral OCR service endpoint
7676
OCR_AZURE_MODEL_NAME: z.string().optional(), // Azure Mistral OCR model name for document processing
77+
OCR_AZURE_API_KEY: z.string().min(1).optional(), // Azure Mistral OCR API key
7778

7879
// Monitoring & Analytics
7980
TELEMETRY_ENDPOINT: z.string().url().optional(), // Custom telemetry/analytics endpoint

0 commit comments

Comments
 (0)