Skip to content

Commit 0c88bbe

Browse files
Add supportsStructuredOutputs option to OpenAI-compatible provider
- Introduce a new optional boolean property `supportsStructuredOutputs` to the provider options, allowing specification of whether the provider supports structured outputs (JSON schema). - Apply this option to completion models in the factory function. - Chat model support is commented out, indicating partial implementation for future extension.
1 parent b5fda10 commit 0c88bbe

File tree

1 file changed

+6
-0
lines changed

1 file changed

+6
-0
lines changed

packages/openai-compatible/src/openai-compatible-provider.ts

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -68,6 +68,11 @@ or to provide a custom fetch implementation for e.g. testing.
6868
Include usage information in streaming responses.
6969
*/
7070
includeUsage?: boolean;
71+
72+
/**
73+
Whether the provider supports structured outputs (JSON schema).
74+
*/
75+
supportsStructuredOutputs?: boolean;
7176
}
7277

7378
/**
@@ -121,6 +126,7 @@ export function createOpenAICompatible<
121126
new OpenAICompatibleChatLanguageModel(modelId, {
122127
...getCommonModelConfig('chat'),
123128
includeUsage: options.includeUsage,
129+
supportsStructuredOutputs: options.supportsStructuredOutputs,
124130
});
125131

126132
const createCompletionModel = (modelId: COMPLETION_MODEL_IDS) =>

0 commit comments

Comments
 (0)