@ai-sdk/openai-compatible 1.0.0-beta.1 → 1.0.0-beta.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +16 -0
- package/dist/index.d.mts +9 -86
- package/dist/index.d.ts +9 -86
- package/dist/index.js +100 -100
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +9 -9
- package/dist/index.mjs.map +1 -1
- package/dist/internal/index.d.mts +2 -2
- package/dist/internal/index.d.ts +2 -2
- package/package.json +2 -2
package/CHANGELOG.md
CHANGED
@@ -1,5 +1,21 @@
|
|
1
1
|
# @ai-sdk/openai-compatible
|
2
2
|
|
3
|
+
## 1.0.0-beta.3
|
4
|
+
|
5
|
+
### Patch Changes
|
6
|
+
|
7
|
+
- 7b069ed: allow any string as reasoningEffort
|
8
|
+
|
9
|
+
## 1.0.0-beta.2
|
10
|
+
|
11
|
+
### Patch Changes
|
12
|
+
|
13
|
+
- d1a034f: feature: using Zod 4 for internal stuff
|
14
|
+
- Updated dependencies [0571b98]
|
15
|
+
- Updated dependencies [39a4fab]
|
16
|
+
- Updated dependencies [d1a034f]
|
17
|
+
- @ai-sdk/provider-utils@3.0.0-beta.2
|
18
|
+
|
3
19
|
## 1.0.0-beta.1
|
4
20
|
|
5
21
|
### Patch Changes
|
package/dist/index.d.mts
CHANGED
@@ -1,25 +1,12 @@
|
|
1
1
|
import { SharedV2ProviderMetadata, LanguageModelV2, EmbeddingModelV2, ImageModelV2, ProviderV2 } from '@ai-sdk/provider';
|
2
2
|
import { FetchFunction } from '@ai-sdk/provider-utils';
|
3
|
-
import { z,
|
3
|
+
import { z, ZodType } from 'zod/v4';
|
4
4
|
|
5
5
|
type OpenAICompatibleChatModelId = string;
|
6
6
|
declare const openaiCompatibleProviderOptions: z.ZodObject<{
|
7
|
-
/**
|
8
|
-
* A unique identifier representing your end-user, which can help the provider to
|
9
|
-
* monitor and detect abuse.
|
10
|
-
*/
|
11
7
|
user: z.ZodOptional<z.ZodString>;
|
12
|
-
|
13
|
-
|
14
|
-
*/
|
15
|
-
reasoningEffort: z.ZodOptional<z.ZodEnum<["low", "medium", "high"]>>;
|
16
|
-
}, "strip", z.ZodTypeAny, {
|
17
|
-
user?: string | undefined;
|
18
|
-
reasoningEffort?: "low" | "medium" | "high" | undefined;
|
19
|
-
}, {
|
20
|
-
user?: string | undefined;
|
21
|
-
reasoningEffort?: "low" | "medium" | "high" | undefined;
|
22
|
-
}>;
|
8
|
+
reasoningEffort: z.ZodOptional<z.ZodString>;
|
9
|
+
}, z.core.$strip>;
|
23
10
|
type OpenAICompatibleProviderOptions = z.infer<typeof openaiCompatibleProviderOptions>;
|
24
11
|
|
25
12
|
declare const openaiCompatibleErrorDataSchema: z.ZodObject<{
|
@@ -27,36 +14,12 @@ declare const openaiCompatibleErrorDataSchema: z.ZodObject<{
|
|
27
14
|
message: z.ZodString;
|
28
15
|
type: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
29
16
|
param: z.ZodOptional<z.ZodNullable<z.ZodAny>>;
|
30
|
-
code: z.ZodOptional<z.ZodNullable<z.ZodUnion<[z.ZodString, z.ZodNumber]>>>;
|
31
|
-
},
|
32
|
-
|
33
|
-
type?: string | null | undefined;
|
34
|
-
code?: string | number | null | undefined;
|
35
|
-
param?: any;
|
36
|
-
}, {
|
37
|
-
message: string;
|
38
|
-
type?: string | null | undefined;
|
39
|
-
code?: string | number | null | undefined;
|
40
|
-
param?: any;
|
41
|
-
}>;
|
42
|
-
}, "strip", z.ZodTypeAny, {
|
43
|
-
error: {
|
44
|
-
message: string;
|
45
|
-
type?: string | null | undefined;
|
46
|
-
code?: string | number | null | undefined;
|
47
|
-
param?: any;
|
48
|
-
};
|
49
|
-
}, {
|
50
|
-
error: {
|
51
|
-
message: string;
|
52
|
-
type?: string | null | undefined;
|
53
|
-
code?: string | number | null | undefined;
|
54
|
-
param?: any;
|
55
|
-
};
|
56
|
-
}>;
|
17
|
+
code: z.ZodOptional<z.ZodNullable<z.ZodUnion<readonly [z.ZodString, z.ZodNumber]>>>;
|
18
|
+
}, z.core.$strip>;
|
19
|
+
}, z.core.$strip>;
|
57
20
|
type OpenAICompatibleErrorData = z.infer<typeof openaiCompatibleErrorDataSchema>;
|
58
21
|
type ProviderErrorStructure<T> = {
|
59
|
-
errorSchema:
|
22
|
+
errorSchema: ZodType<T>;
|
60
23
|
errorToMessage: (error: T) => string;
|
61
24
|
isRetryable?: (response: Response, error?: T) => boolean;
|
62
25
|
};
|
@@ -142,37 +105,11 @@ declare class OpenAICompatibleChatLanguageModel implements LanguageModelV2 {
|
|
142
105
|
|
143
106
|
type OpenAICompatibleCompletionModelId = string;
|
144
107
|
declare const openaiCompatibleCompletionProviderOptions: z.ZodObject<{
|
145
|
-
/**
|
146
|
-
* Echo back the prompt in addition to the completion.
|
147
|
-
*/
|
148
108
|
echo: z.ZodOptional<z.ZodBoolean>;
|
149
|
-
/**
|
150
|
-
* Modify the likelihood of specified tokens appearing in the completion.
|
151
|
-
*
|
152
|
-
* Accepts a JSON object that maps tokens (specified by their token ID in
|
153
|
-
* the GPT tokenizer) to an associated bias value from -100 to 100.
|
154
|
-
*/
|
155
109
|
logitBias: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodNumber>>;
|
156
|
-
/**
|
157
|
-
* The suffix that comes after a completion of inserted text.
|
158
|
-
*/
|
159
110
|
suffix: z.ZodOptional<z.ZodString>;
|
160
|
-
/**
|
161
|
-
* A unique identifier representing your end-user, which can help providers to
|
162
|
-
* monitor and detect abuse.
|
163
|
-
*/
|
164
111
|
user: z.ZodOptional<z.ZodString>;
|
165
|
-
},
|
166
|
-
user?: string | undefined;
|
167
|
-
echo?: boolean | undefined;
|
168
|
-
logitBias?: Record<string, number> | undefined;
|
169
|
-
suffix?: string | undefined;
|
170
|
-
}, {
|
171
|
-
user?: string | undefined;
|
172
|
-
echo?: boolean | undefined;
|
173
|
-
logitBias?: Record<string, number> | undefined;
|
174
|
-
suffix?: string | undefined;
|
175
|
-
}>;
|
112
|
+
}, z.core.$strip>;
|
176
113
|
type OpenAICompatibleCompletionProviderOptions = z.infer<typeof openaiCompatibleCompletionProviderOptions>;
|
177
114
|
|
178
115
|
type OpenAICompatibleCompletionConfig = {
|
@@ -207,23 +144,9 @@ declare class OpenAICompatibleCompletionLanguageModel implements LanguageModelV2
|
|
207
144
|
|
208
145
|
type OpenAICompatibleEmbeddingModelId = string;
|
209
146
|
declare const openaiCompatibleEmbeddingProviderOptions: z.ZodObject<{
|
210
|
-
/**
|
211
|
-
* The number of dimensions the resulting output embeddings should have.
|
212
|
-
* Only supported in text-embedding-3 and later models.
|
213
|
-
*/
|
214
147
|
dimensions: z.ZodOptional<z.ZodNumber>;
|
215
|
-
/**
|
216
|
-
* A unique identifier representing your end-user, which can help providers to
|
217
|
-
* monitor and detect abuse.
|
218
|
-
*/
|
219
148
|
user: z.ZodOptional<z.ZodString>;
|
220
|
-
},
|
221
|
-
user?: string | undefined;
|
222
|
-
dimensions?: number | undefined;
|
223
|
-
}, {
|
224
|
-
user?: string | undefined;
|
225
|
-
dimensions?: number | undefined;
|
226
|
-
}>;
|
149
|
+
}, z.core.$strip>;
|
227
150
|
type OpenAICompatibleEmbeddingProviderOptions = z.infer<typeof openaiCompatibleEmbeddingProviderOptions>;
|
228
151
|
|
229
152
|
type OpenAICompatibleEmbeddingConfig = {
|
package/dist/index.d.ts
CHANGED
@@ -1,25 +1,12 @@
|
|
1
1
|
import { SharedV2ProviderMetadata, LanguageModelV2, EmbeddingModelV2, ImageModelV2, ProviderV2 } from '@ai-sdk/provider';
|
2
2
|
import { FetchFunction } from '@ai-sdk/provider-utils';
|
3
|
-
import { z,
|
3
|
+
import { z, ZodType } from 'zod/v4';
|
4
4
|
|
5
5
|
type OpenAICompatibleChatModelId = string;
|
6
6
|
declare const openaiCompatibleProviderOptions: z.ZodObject<{
|
7
|
-
/**
|
8
|
-
* A unique identifier representing your end-user, which can help the provider to
|
9
|
-
* monitor and detect abuse.
|
10
|
-
*/
|
11
7
|
user: z.ZodOptional<z.ZodString>;
|
12
|
-
|
13
|
-
|
14
|
-
*/
|
15
|
-
reasoningEffort: z.ZodOptional<z.ZodEnum<["low", "medium", "high"]>>;
|
16
|
-
}, "strip", z.ZodTypeAny, {
|
17
|
-
user?: string | undefined;
|
18
|
-
reasoningEffort?: "low" | "medium" | "high" | undefined;
|
19
|
-
}, {
|
20
|
-
user?: string | undefined;
|
21
|
-
reasoningEffort?: "low" | "medium" | "high" | undefined;
|
22
|
-
}>;
|
8
|
+
reasoningEffort: z.ZodOptional<z.ZodString>;
|
9
|
+
}, z.core.$strip>;
|
23
10
|
type OpenAICompatibleProviderOptions = z.infer<typeof openaiCompatibleProviderOptions>;
|
24
11
|
|
25
12
|
declare const openaiCompatibleErrorDataSchema: z.ZodObject<{
|
@@ -27,36 +14,12 @@ declare const openaiCompatibleErrorDataSchema: z.ZodObject<{
|
|
27
14
|
message: z.ZodString;
|
28
15
|
type: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
29
16
|
param: z.ZodOptional<z.ZodNullable<z.ZodAny>>;
|
30
|
-
code: z.ZodOptional<z.ZodNullable<z.ZodUnion<[z.ZodString, z.ZodNumber]>>>;
|
31
|
-
},
|
32
|
-
|
33
|
-
type?: string | null | undefined;
|
34
|
-
code?: string | number | null | undefined;
|
35
|
-
param?: any;
|
36
|
-
}, {
|
37
|
-
message: string;
|
38
|
-
type?: string | null | undefined;
|
39
|
-
code?: string | number | null | undefined;
|
40
|
-
param?: any;
|
41
|
-
}>;
|
42
|
-
}, "strip", z.ZodTypeAny, {
|
43
|
-
error: {
|
44
|
-
message: string;
|
45
|
-
type?: string | null | undefined;
|
46
|
-
code?: string | number | null | undefined;
|
47
|
-
param?: any;
|
48
|
-
};
|
49
|
-
}, {
|
50
|
-
error: {
|
51
|
-
message: string;
|
52
|
-
type?: string | null | undefined;
|
53
|
-
code?: string | number | null | undefined;
|
54
|
-
param?: any;
|
55
|
-
};
|
56
|
-
}>;
|
17
|
+
code: z.ZodOptional<z.ZodNullable<z.ZodUnion<readonly [z.ZodString, z.ZodNumber]>>>;
|
18
|
+
}, z.core.$strip>;
|
19
|
+
}, z.core.$strip>;
|
57
20
|
type OpenAICompatibleErrorData = z.infer<typeof openaiCompatibleErrorDataSchema>;
|
58
21
|
type ProviderErrorStructure<T> = {
|
59
|
-
errorSchema:
|
22
|
+
errorSchema: ZodType<T>;
|
60
23
|
errorToMessage: (error: T) => string;
|
61
24
|
isRetryable?: (response: Response, error?: T) => boolean;
|
62
25
|
};
|
@@ -142,37 +105,11 @@ declare class OpenAICompatibleChatLanguageModel implements LanguageModelV2 {
|
|
142
105
|
|
143
106
|
type OpenAICompatibleCompletionModelId = string;
|
144
107
|
declare const openaiCompatibleCompletionProviderOptions: z.ZodObject<{
|
145
|
-
/**
|
146
|
-
* Echo back the prompt in addition to the completion.
|
147
|
-
*/
|
148
108
|
echo: z.ZodOptional<z.ZodBoolean>;
|
149
|
-
/**
|
150
|
-
* Modify the likelihood of specified tokens appearing in the completion.
|
151
|
-
*
|
152
|
-
* Accepts a JSON object that maps tokens (specified by their token ID in
|
153
|
-
* the GPT tokenizer) to an associated bias value from -100 to 100.
|
154
|
-
*/
|
155
109
|
logitBias: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodNumber>>;
|
156
|
-
/**
|
157
|
-
* The suffix that comes after a completion of inserted text.
|
158
|
-
*/
|
159
110
|
suffix: z.ZodOptional<z.ZodString>;
|
160
|
-
/**
|
161
|
-
* A unique identifier representing your end-user, which can help providers to
|
162
|
-
* monitor and detect abuse.
|
163
|
-
*/
|
164
111
|
user: z.ZodOptional<z.ZodString>;
|
165
|
-
},
|
166
|
-
user?: string | undefined;
|
167
|
-
echo?: boolean | undefined;
|
168
|
-
logitBias?: Record<string, number> | undefined;
|
169
|
-
suffix?: string | undefined;
|
170
|
-
}, {
|
171
|
-
user?: string | undefined;
|
172
|
-
echo?: boolean | undefined;
|
173
|
-
logitBias?: Record<string, number> | undefined;
|
174
|
-
suffix?: string | undefined;
|
175
|
-
}>;
|
112
|
+
}, z.core.$strip>;
|
176
113
|
type OpenAICompatibleCompletionProviderOptions = z.infer<typeof openaiCompatibleCompletionProviderOptions>;
|
177
114
|
|
178
115
|
type OpenAICompatibleCompletionConfig = {
|
@@ -207,23 +144,9 @@ declare class OpenAICompatibleCompletionLanguageModel implements LanguageModelV2
|
|
207
144
|
|
208
145
|
type OpenAICompatibleEmbeddingModelId = string;
|
209
146
|
declare const openaiCompatibleEmbeddingProviderOptions: z.ZodObject<{
|
210
|
-
/**
|
211
|
-
* The number of dimensions the resulting output embeddings should have.
|
212
|
-
* Only supported in text-embedding-3 and later models.
|
213
|
-
*/
|
214
147
|
dimensions: z.ZodOptional<z.ZodNumber>;
|
215
|
-
/**
|
216
|
-
* A unique identifier representing your end-user, which can help providers to
|
217
|
-
* monitor and detect abuse.
|
218
|
-
*/
|
219
148
|
user: z.ZodOptional<z.ZodString>;
|
220
|
-
},
|
221
|
-
user?: string | undefined;
|
222
|
-
dimensions?: number | undefined;
|
223
|
-
}, {
|
224
|
-
user?: string | undefined;
|
225
|
-
dimensions?: number | undefined;
|
226
|
-
}>;
|
149
|
+
}, z.core.$strip>;
|
227
150
|
type OpenAICompatibleEmbeddingProviderOptions = z.infer<typeof openaiCompatibleEmbeddingProviderOptions>;
|
228
151
|
|
229
152
|
type OpenAICompatibleEmbeddingConfig = {
|
package/dist/index.js
CHANGED
@@ -31,7 +31,7 @@ module.exports = __toCommonJS(src_exports);
|
|
31
31
|
// src/openai-compatible-chat-language-model.ts
|
32
32
|
var import_provider3 = require("@ai-sdk/provider");
|
33
33
|
var import_provider_utils = require("@ai-sdk/provider-utils");
|
34
|
-
var
|
34
|
+
var import_v43 = require("zod/v4");
|
35
35
|
|
36
36
|
// src/convert-to-openai-compatible-chat-messages.ts
|
37
37
|
var import_provider = require("@ai-sdk/provider");
|
@@ -184,30 +184,30 @@ function mapOpenAICompatibleFinishReason(finishReason) {
|
|
184
184
|
}
|
185
185
|
|
186
186
|
// src/openai-compatible-chat-options.ts
|
187
|
-
var
|
188
|
-
var openaiCompatibleProviderOptions =
|
187
|
+
var import_v4 = require("zod/v4");
|
188
|
+
var openaiCompatibleProviderOptions = import_v4.z.object({
|
189
189
|
/**
|
190
190
|
* A unique identifier representing your end-user, which can help the provider to
|
191
191
|
* monitor and detect abuse.
|
192
192
|
*/
|
193
|
-
user:
|
193
|
+
user: import_v4.z.string().optional(),
|
194
194
|
/**
|
195
195
|
* Reasoning effort for reasoning models. Defaults to `medium`.
|
196
196
|
*/
|
197
|
-
reasoningEffort:
|
197
|
+
reasoningEffort: import_v4.z.string().optional()
|
198
198
|
});
|
199
199
|
|
200
200
|
// src/openai-compatible-error.ts
|
201
|
-
var
|
202
|
-
var openaiCompatibleErrorDataSchema =
|
203
|
-
error:
|
204
|
-
message:
|
201
|
+
var import_v42 = require("zod/v4");
|
202
|
+
var openaiCompatibleErrorDataSchema = import_v42.z.object({
|
203
|
+
error: import_v42.z.object({
|
204
|
+
message: import_v42.z.string(),
|
205
205
|
// The additional information below is handled loosely to support
|
206
206
|
// OpenAI-compatible providers that have slightly different error
|
207
207
|
// responses:
|
208
|
-
type:
|
209
|
-
param:
|
210
|
-
code:
|
208
|
+
type: import_v42.z.string().nullish(),
|
209
|
+
param: import_v42.z.any().nullish(),
|
210
|
+
code: import_v42.z.union([import_v42.z.string(), import_v42.z.number()]).nullish()
|
211
211
|
})
|
212
212
|
});
|
213
213
|
var defaultOpenAICompatibleErrorStructure = {
|
@@ -711,69 +711,69 @@ var OpenAICompatibleChatLanguageModel = class {
|
|
711
711
|
};
|
712
712
|
}
|
713
713
|
};
|
714
|
-
var openaiCompatibleTokenUsageSchema =
|
715
|
-
prompt_tokens:
|
716
|
-
completion_tokens:
|
717
|
-
total_tokens:
|
718
|
-
prompt_tokens_details:
|
719
|
-
cached_tokens:
|
714
|
+
var openaiCompatibleTokenUsageSchema = import_v43.z.object({
|
715
|
+
prompt_tokens: import_v43.z.number().nullish(),
|
716
|
+
completion_tokens: import_v43.z.number().nullish(),
|
717
|
+
total_tokens: import_v43.z.number().nullish(),
|
718
|
+
prompt_tokens_details: import_v43.z.object({
|
719
|
+
cached_tokens: import_v43.z.number().nullish()
|
720
720
|
}).nullish(),
|
721
|
-
completion_tokens_details:
|
722
|
-
reasoning_tokens:
|
723
|
-
accepted_prediction_tokens:
|
724
|
-
rejected_prediction_tokens:
|
721
|
+
completion_tokens_details: import_v43.z.object({
|
722
|
+
reasoning_tokens: import_v43.z.number().nullish(),
|
723
|
+
accepted_prediction_tokens: import_v43.z.number().nullish(),
|
724
|
+
rejected_prediction_tokens: import_v43.z.number().nullish()
|
725
725
|
}).nullish()
|
726
726
|
}).nullish();
|
727
|
-
var OpenAICompatibleChatResponseSchema =
|
728
|
-
id:
|
729
|
-
created:
|
730
|
-
model:
|
731
|
-
choices:
|
732
|
-
|
733
|
-
message:
|
734
|
-
role:
|
735
|
-
content:
|
736
|
-
reasoning_content:
|
737
|
-
tool_calls:
|
738
|
-
|
739
|
-
id:
|
740
|
-
type:
|
741
|
-
function:
|
742
|
-
name:
|
743
|
-
arguments:
|
727
|
+
var OpenAICompatibleChatResponseSchema = import_v43.z.object({
|
728
|
+
id: import_v43.z.string().nullish(),
|
729
|
+
created: import_v43.z.number().nullish(),
|
730
|
+
model: import_v43.z.string().nullish(),
|
731
|
+
choices: import_v43.z.array(
|
732
|
+
import_v43.z.object({
|
733
|
+
message: import_v43.z.object({
|
734
|
+
role: import_v43.z.literal("assistant").nullish(),
|
735
|
+
content: import_v43.z.string().nullish(),
|
736
|
+
reasoning_content: import_v43.z.string().nullish(),
|
737
|
+
tool_calls: import_v43.z.array(
|
738
|
+
import_v43.z.object({
|
739
|
+
id: import_v43.z.string().nullish(),
|
740
|
+
type: import_v43.z.literal("function"),
|
741
|
+
function: import_v43.z.object({
|
742
|
+
name: import_v43.z.string(),
|
743
|
+
arguments: import_v43.z.string()
|
744
744
|
})
|
745
745
|
})
|
746
746
|
).nullish()
|
747
747
|
}),
|
748
|
-
finish_reason:
|
748
|
+
finish_reason: import_v43.z.string().nullish()
|
749
749
|
})
|
750
750
|
),
|
751
751
|
usage: openaiCompatibleTokenUsageSchema
|
752
752
|
});
|
753
|
-
var createOpenAICompatibleChatChunkSchema = (errorSchema) =>
|
754
|
-
|
755
|
-
id:
|
756
|
-
created:
|
757
|
-
model:
|
758
|
-
choices:
|
759
|
-
|
760
|
-
delta:
|
761
|
-
role:
|
762
|
-
content:
|
763
|
-
reasoning_content:
|
764
|
-
tool_calls:
|
765
|
-
|
766
|
-
index:
|
767
|
-
id:
|
768
|
-
type:
|
769
|
-
function:
|
770
|
-
name:
|
771
|
-
arguments:
|
753
|
+
var createOpenAICompatibleChatChunkSchema = (errorSchema) => import_v43.z.union([
|
754
|
+
import_v43.z.object({
|
755
|
+
id: import_v43.z.string().nullish(),
|
756
|
+
created: import_v43.z.number().nullish(),
|
757
|
+
model: import_v43.z.string().nullish(),
|
758
|
+
choices: import_v43.z.array(
|
759
|
+
import_v43.z.object({
|
760
|
+
delta: import_v43.z.object({
|
761
|
+
role: import_v43.z.enum(["assistant"]).nullish(),
|
762
|
+
content: import_v43.z.string().nullish(),
|
763
|
+
reasoning_content: import_v43.z.string().nullish(),
|
764
|
+
tool_calls: import_v43.z.array(
|
765
|
+
import_v43.z.object({
|
766
|
+
index: import_v43.z.number(),
|
767
|
+
id: import_v43.z.string().nullish(),
|
768
|
+
type: import_v43.z.literal("function").nullish(),
|
769
|
+
function: import_v43.z.object({
|
770
|
+
name: import_v43.z.string().nullish(),
|
771
|
+
arguments: import_v43.z.string().nullish()
|
772
772
|
})
|
773
773
|
})
|
774
774
|
).nullish()
|
775
775
|
}).nullish(),
|
776
|
-
finish_reason:
|
776
|
+
finish_reason: import_v43.z.string().nullish()
|
777
777
|
})
|
778
778
|
),
|
779
779
|
usage: openaiCompatibleTokenUsageSchema
|
@@ -783,7 +783,7 @@ var createOpenAICompatibleChatChunkSchema = (errorSchema) => import_zod3.z.union
|
|
783
783
|
|
784
784
|
// src/openai-compatible-completion-language-model.ts
|
785
785
|
var import_provider_utils2 = require("@ai-sdk/provider-utils");
|
786
|
-
var
|
786
|
+
var import_v45 = require("zod/v4");
|
787
787
|
|
788
788
|
// src/convert-to-openai-compatible-completion-prompt.ts
|
789
789
|
var import_provider4 = require("@ai-sdk/provider");
|
@@ -861,28 +861,28 @@ ${user}:`]
|
|
861
861
|
}
|
862
862
|
|
863
863
|
// src/openai-compatible-completion-options.ts
|
864
|
-
var
|
865
|
-
var openaiCompatibleCompletionProviderOptions =
|
864
|
+
var import_v44 = require("zod/v4");
|
865
|
+
var openaiCompatibleCompletionProviderOptions = import_v44.z.object({
|
866
866
|
/**
|
867
867
|
* Echo back the prompt in addition to the completion.
|
868
868
|
*/
|
869
|
-
echo:
|
869
|
+
echo: import_v44.z.boolean().optional(),
|
870
870
|
/**
|
871
871
|
* Modify the likelihood of specified tokens appearing in the completion.
|
872
872
|
*
|
873
873
|
* Accepts a JSON object that maps tokens (specified by their token ID in
|
874
874
|
* the GPT tokenizer) to an associated bias value from -100 to 100.
|
875
875
|
*/
|
876
|
-
logitBias:
|
876
|
+
logitBias: import_v44.z.record(import_v44.z.string(), import_v44.z.number()).optional(),
|
877
877
|
/**
|
878
878
|
* The suffix that comes after a completion of inserted text.
|
879
879
|
*/
|
880
|
-
suffix:
|
880
|
+
suffix: import_v44.z.string().optional(),
|
881
881
|
/**
|
882
882
|
* A unique identifier representing your end-user, which can help providers to
|
883
883
|
* monitor and detect abuse.
|
884
884
|
*/
|
885
|
-
user:
|
885
|
+
user: import_v44.z.string().optional()
|
886
886
|
});
|
887
887
|
|
888
888
|
// src/openai-compatible-completion-language-model.ts
|
@@ -1115,33 +1115,33 @@ var OpenAICompatibleCompletionLanguageModel = class {
|
|
1115
1115
|
};
|
1116
1116
|
}
|
1117
1117
|
};
|
1118
|
-
var usageSchema =
|
1119
|
-
prompt_tokens:
|
1120
|
-
completion_tokens:
|
1121
|
-
total_tokens:
|
1118
|
+
var usageSchema = import_v45.z.object({
|
1119
|
+
prompt_tokens: import_v45.z.number(),
|
1120
|
+
completion_tokens: import_v45.z.number(),
|
1121
|
+
total_tokens: import_v45.z.number()
|
1122
1122
|
});
|
1123
|
-
var openaiCompatibleCompletionResponseSchema =
|
1124
|
-
id:
|
1125
|
-
created:
|
1126
|
-
model:
|
1127
|
-
choices:
|
1128
|
-
|
1129
|
-
text:
|
1130
|
-
finish_reason:
|
1123
|
+
var openaiCompatibleCompletionResponseSchema = import_v45.z.object({
|
1124
|
+
id: import_v45.z.string().nullish(),
|
1125
|
+
created: import_v45.z.number().nullish(),
|
1126
|
+
model: import_v45.z.string().nullish(),
|
1127
|
+
choices: import_v45.z.array(
|
1128
|
+
import_v45.z.object({
|
1129
|
+
text: import_v45.z.string(),
|
1130
|
+
finish_reason: import_v45.z.string()
|
1131
1131
|
})
|
1132
1132
|
),
|
1133
1133
|
usage: usageSchema.nullish()
|
1134
1134
|
});
|
1135
|
-
var createOpenAICompatibleCompletionChunkSchema = (errorSchema) =>
|
1136
|
-
|
1137
|
-
id:
|
1138
|
-
created:
|
1139
|
-
model:
|
1140
|
-
choices:
|
1141
|
-
|
1142
|
-
text:
|
1143
|
-
finish_reason:
|
1144
|
-
index:
|
1135
|
+
var createOpenAICompatibleCompletionChunkSchema = (errorSchema) => import_v45.z.union([
|
1136
|
+
import_v45.z.object({
|
1137
|
+
id: import_v45.z.string().nullish(),
|
1138
|
+
created: import_v45.z.number().nullish(),
|
1139
|
+
model: import_v45.z.string().nullish(),
|
1140
|
+
choices: import_v45.z.array(
|
1141
|
+
import_v45.z.object({
|
1142
|
+
text: import_v45.z.string(),
|
1143
|
+
finish_reason: import_v45.z.string().nullish(),
|
1144
|
+
index: import_v45.z.number()
|
1145
1145
|
})
|
1146
1146
|
),
|
1147
1147
|
usage: usageSchema.nullish()
|
@@ -1152,21 +1152,21 @@ var createOpenAICompatibleCompletionChunkSchema = (errorSchema) => import_zod5.z
|
|
1152
1152
|
// src/openai-compatible-embedding-model.ts
|
1153
1153
|
var import_provider5 = require("@ai-sdk/provider");
|
1154
1154
|
var import_provider_utils3 = require("@ai-sdk/provider-utils");
|
1155
|
-
var
|
1155
|
+
var import_v47 = require("zod/v4");
|
1156
1156
|
|
1157
1157
|
// src/openai-compatible-embedding-options.ts
|
1158
|
-
var
|
1159
|
-
var openaiCompatibleEmbeddingProviderOptions =
|
1158
|
+
var import_v46 = require("zod/v4");
|
1159
|
+
var openaiCompatibleEmbeddingProviderOptions = import_v46.z.object({
|
1160
1160
|
/**
|
1161
1161
|
* The number of dimensions the resulting output embeddings should have.
|
1162
1162
|
* Only supported in text-embedding-3 and later models.
|
1163
1163
|
*/
|
1164
|
-
dimensions:
|
1164
|
+
dimensions: import_v46.z.number().optional(),
|
1165
1165
|
/**
|
1166
1166
|
* A unique identifier representing your end-user, which can help providers to
|
1167
1167
|
* monitor and detect abuse.
|
1168
1168
|
*/
|
1169
|
-
user:
|
1169
|
+
user: import_v46.z.string().optional()
|
1170
1170
|
});
|
1171
1171
|
|
1172
1172
|
// src/openai-compatible-embedding-model.ts
|
@@ -1250,14 +1250,14 @@ var OpenAICompatibleEmbeddingModel = class {
|
|
1250
1250
|
};
|
1251
1251
|
}
|
1252
1252
|
};
|
1253
|
-
var openaiTextEmbeddingResponseSchema =
|
1254
|
-
data:
|
1255
|
-
usage:
|
1253
|
+
var openaiTextEmbeddingResponseSchema = import_v47.z.object({
|
1254
|
+
data: import_v47.z.array(import_v47.z.object({ embedding: import_v47.z.array(import_v47.z.number()) })),
|
1255
|
+
usage: import_v47.z.object({ prompt_tokens: import_v47.z.number() }).nullish()
|
1256
1256
|
});
|
1257
1257
|
|
1258
1258
|
// src/openai-compatible-image-model.ts
|
1259
1259
|
var import_provider_utils4 = require("@ai-sdk/provider-utils");
|
1260
|
-
var
|
1260
|
+
var import_v48 = require("zod/v4");
|
1261
1261
|
var OpenAICompatibleImageModel = class {
|
1262
1262
|
constructor(modelId, config) {
|
1263
1263
|
this.modelId = modelId;
|
@@ -1325,8 +1325,8 @@ var OpenAICompatibleImageModel = class {
|
|
1325
1325
|
};
|
1326
1326
|
}
|
1327
1327
|
};
|
1328
|
-
var openaiCompatibleImageResponseSchema =
|
1329
|
-
data:
|
1328
|
+
var openaiCompatibleImageResponseSchema = import_v48.z.object({
|
1329
|
+
data: import_v48.z.array(import_v48.z.object({ b64_json: import_v48.z.string() }))
|
1330
1330
|
});
|
1331
1331
|
|
1332
1332
|
// src/openai-compatible-provider.ts
|