Skip to content

Commit 97e4fa4

Browse files
authored
fix: enable structuredOutputs for chat models (#18)
2 parents 2f676a8 + 6c92f29 commit 97e4fa4

File tree

2 files changed

+13
-0
lines changed

2 files changed

+13
-0
lines changed

src/provider.test.ts

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -100,5 +100,17 @@ describe('GitHubModelsProvider', () => {
100100
}),
101101
)
102102
})
103+
104+
it('should enable structured outputs for chat models', () => {
105+
const provider = createGitHubModels()
106+
provider('gpt-4')
107+
108+
expect(OpenAICompatibleChatLanguageModelMock).toHaveBeenCalledWith(
109+
'gpt-4',
110+
expect.objectContaining({
111+
supportsStructuredOutputs: true,
112+
}),
113+
)
114+
})
103115
})
104116
})

src/provider.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -66,6 +66,7 @@ export function createGitHubModels(options: GitHubModelsProviderOptions = {}): G
6666
headers: getHeaders,
6767
fetch: options.fetch,
6868
includeUsage: true,
69+
supportsStructuredOutputs: true,
6970
} satisfies OpenAICompatibleChatConfig
7071

7172
const createModel = (modelId: GitHubModelsChatModelId) => new OpenAICompatibleChatLanguageModel(modelId, baseOptions)

0 commit comments

Comments
 (0)