From 6c92f29f96615401abd9fffbc32607d6bbb314cb Mon Sep 17 00:00:00 2001 From: Mark Anthony Cianfrani Date: Mon, 6 Oct 2025 15:38:45 -0400 Subject: [PATCH] fix: enable structured outputs for chat models --- src/provider.test.ts | 12 ++++++++++++ src/provider.ts | 1 + 2 files changed, 13 insertions(+) diff --git a/src/provider.test.ts b/src/provider.test.ts index b576f1f..46869d2 100644 --- a/src/provider.test.ts +++ b/src/provider.test.ts @@ -100,5 +100,17 @@ describe('GitHubModelsProvider', () => { }), ) }) + + it('should enable structured outputs for chat models', () => { + const provider = createGitHubModels() + provider('gpt-4') + + expect(OpenAICompatibleChatLanguageModelMock).toHaveBeenCalledWith( + 'gpt-4', + expect.objectContaining({ + supportsStructuredOutputs: true, + }), + ) + }) }) }) diff --git a/src/provider.ts b/src/provider.ts index 2397788..937d17e 100644 --- a/src/provider.ts +++ b/src/provider.ts @@ -66,6 +66,7 @@ export function createGitHubModels(options: GitHubModelsProviderOptions = {}): G headers: getHeaders, fetch: options.fetch, includeUsage: true, + supportsStructuredOutputs: true, } satisfies OpenAICompatibleChatConfig const createModel = (modelId: GitHubModelsChatModelId) => new OpenAICompatibleChatLanguageModel(modelId, baseOptions)