From 776de169d39a158b76aa6dc0a6246260ec438810 Mon Sep 17 00:00:00 2001 From: darwintree <17946284+darwintree@users.noreply.github.com> Date: Thu, 21 Nov 2024 09:54:59 +0800 Subject: [PATCH] fix: error if openai baseURL is not provided --- packages/core/src/generation.ts | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/packages/core/src/generation.ts b/packages/core/src/generation.ts index 9582b268fb..ba879ce1a2 100644 --- a/packages/core/src/generation.ts +++ b/packages/core/src/generation.ts @@ -1035,7 +1035,8 @@ async function handleOpenAI({ mode, modelOptions, }: ProviderOptions): Promise> { - const openai = createOpenAI({ apiKey, baseURL: models.openai.endpoint }); + const baseURL = models.openai.endpoint || undefined + const openai = createOpenAI({ apiKey, baseURL }); return await aiGenerateObject({ model: openai.languageModel(model), schema,