Skip to content

An AI-powered search engine with a generative UI

fix: Add Azure OpenAI env check in getModel function

Yoshiki Miurad8f5bdaf8626
diff --git a/lib/utils/index.ts b/lib/utils/index.ts
index 4ab9023d..a76bab99 100644
--- a/lib/utils/index.ts
+++ b/lib/utils/index.ts
@@ -2,7 +2,7 @@ import { type ClassValue, clsx } from 'clsx'
import { twMerge } from 'tailwind-merge'
import { createOllama } from 'ollama-ai-provider'
import { createOpenAI } from '@ai-sdk/openai'
-import { createAzure } from '@ai-sdk/azure';
+import { createAzure } from '@ai-sdk/azure'
import { google } from '@ai-sdk/google'
import { anthropic } from '@ai-sdk/anthropic'
import { CoreMessage } from 'ai'
@@ -28,7 +28,8 @@ export function getModel(useSubModel = false) {
!(ollamaBaseUrl && ollamaModel) &&
!openaiApiKey &&
!googleApiKey &&
- !anthropicApiKey
+ !anthropicApiKey &&
+ !(azureApiKey && azureResourceName)
) {
throw new Error(
'Missing environment variables for Ollama, OpenAI, Azure OpenAI, Google or Anthropic'