From 961816a2505fb667ee674426e44e4ea9d2fa818c Mon Sep 17 00:00:00 2001 From: darwintree <17946284+darwintree@users.noreply.github.com> Date: Wed, 20 Nov 2024 18:16:46 +0800 Subject: [PATCH 1/2] fix: ignored modelEndpointOverride in generation --- packages/core/src/generation.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/packages/core/src/generation.ts b/packages/core/src/generation.ts index b48c98817d..9582b268fb 100644 --- a/packages/core/src/generation.ts +++ b/packages/core/src/generation.ts @@ -1035,7 +1035,7 @@ async function handleOpenAI({ mode, modelOptions, }: ProviderOptions): Promise> { - const openai = createOpenAI({ apiKey }); + const openai = createOpenAI({ apiKey, baseURL: models.openai.endpoint }); return await aiGenerateObject({ model: openai.languageModel(model), schema, 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 2/2] 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,