Skip to content

Commit 64a17db

Browse files
waleedlatif1claude
andcommitted
fix(knowledge): default Azure deployment name to embedding model name
Restore the prior fallback so existing Azure deployments — which conventionally name the deployment after the model — continue to route through Azure when KB_OPENAI_MODEL_NAME is unset. Before this fix, those deployments silently fell through to direct OpenAI. Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
1 parent b73c218 commit 64a17db

1 file changed

Lines changed: 9 additions & 6 deletions

File tree

apps/sim/lib/knowledge/embeddings.ts

Lines changed: 9 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -199,22 +199,25 @@ async function resolveProvider(
199199
const azureApiKey = env.AZURE_OPENAI_API_KEY
200200
const azureEndpoint = env.AZURE_OPENAI_ENDPOINT
201201
const azureApiVersion = env.AZURE_OPENAI_API_VERSION
202-
const azureDeploymentName = env.KB_OPENAI_MODEL_NAME
203202
const isOpenAIModel = SUPPORTED_EMBEDDING_MODELS[embeddingModel]?.provider === 'openai'
204-
const useAzure = Boolean(
205-
isOpenAIModel && azureApiKey && azureEndpoint && azureApiVersion && azureDeploymentName
206-
)
203+
/**
204+
* Azure deployment names default to the embedding model name when
205+
* `KB_OPENAI_MODEL_NAME` is unset — this matches the pre-existing
206+
* convention where deployments are named after the model they host.
207+
*/
208+
const azureDeploymentName = env.KB_OPENAI_MODEL_NAME || embeddingModel
209+
const useAzure = Boolean(isOpenAIModel && azureApiKey && azureEndpoint && azureApiVersion)
207210

208211
const info = getEmbeddingModelInfo(embeddingModel)
209212

210213
if (useAzure) {
211214
return {
212-
modelName: azureDeploymentName!,
215+
modelName: azureDeploymentName,
213216
pricingId: info.pricingId,
214217
isBYOK: false,
215218
tokenizerProvider: info.tokenizerProvider,
216219
buildRequest: buildAzureOpenAIProvider(
217-
azureDeploymentName!,
220+
azureDeploymentName,
218221
azureApiKey!,
219222
azureEndpoint!,
220223
azureApiVersion!

0 commit comments

Comments
 (0)