Skip to content

Commit bd2a42b

Browse files
committed
Add support for structured outputs in OpenAI-compatible completion
- Added `supportsStructuredOutputs` option to `OpenAICompatibleCompletionConfig` type - Passed the option to `OpenAICompatibleCompletionLanguageModel` during creation - Enables providers to specify support for structured outputs in completions
1 parent 0c88bbe commit bd2a42b

File tree

2 files changed

+2
-0
lines changed

2 files changed

+2
-0
lines changed

packages/openai-compatible/src/completion/openai-compatible-completion-language-model.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -38,6 +38,7 @@ type OpenAICompatibleCompletionConfig = {
3838
url: (options: { modelId: string; path: string }) => string;
3939
fetch?: FetchFunction;
4040
errorStructure?: ProviderErrorStructure<any>;
41+
supportsStructuredOutputs?: boolean;
4142

4243
/**
4344
* The supported URLs for the model.

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

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -133,6 +133,7 @@ export function createOpenAICompatible<
133133
new OpenAICompatibleCompletionLanguageModel(modelId, {
134134
...getCommonModelConfig('completion'),
135135
includeUsage: options.includeUsage,
136+
supportsStructuredOutputs: options.supportsStructuredOutputs,
136137
});
137138

138139
const createEmbeddingModel = (modelId: EMBEDDING_MODEL_IDS) =>

0 commit comments

Comments
 (0)