@ai-sdk/openai-compatible 1.0.0-alpha.9 → 1.0.0-beta.2
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 +86 -0
- package/dist/index.d.mts +13 -86
- package/dist/index.d.ts +13 -86
- package/dist/index.js +179 -125
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +87 -33
- package/dist/index.mjs.map +1 -1
- package/dist/internal/index.d.mts +2 -2
- package/dist/internal/index.d.ts +2 -2
- package/dist/internal/index.js +15 -2
- package/dist/internal/index.js.map +1 -1
- package/dist/internal/index.mjs +15 -2
- package/dist/internal/index.mjs.map +1 -1
- package/package.json +3 -3
package/CHANGELOG.md
CHANGED
@@ -1,5 +1,91 @@
|
|
1
1
|
# @ai-sdk/openai-compatible
|
2
2
|
|
3
|
+
## 1.0.0-beta.2
|
4
|
+
|
5
|
+
### Patch Changes
|
6
|
+
|
7
|
+
- d1a034f: feature: using Zod 4 for internal stuff
|
8
|
+
- Updated dependencies [0571b98]
|
9
|
+
- Updated dependencies [39a4fab]
|
10
|
+
- Updated dependencies [d1a034f]
|
11
|
+
- @ai-sdk/provider-utils@3.0.0-beta.2
|
12
|
+
|
13
|
+
## 1.0.0-beta.1
|
14
|
+
|
15
|
+
### Patch Changes
|
16
|
+
|
17
|
+
- Updated dependencies [742b7be]
|
18
|
+
- Updated dependencies [7cddb72]
|
19
|
+
- Updated dependencies [ccce59b]
|
20
|
+
- Updated dependencies [e2b9e4b]
|
21
|
+
- Updated dependencies [45c1ea2]
|
22
|
+
- Updated dependencies [e025824]
|
23
|
+
- Updated dependencies [0d06df6]
|
24
|
+
- Updated dependencies [472524a]
|
25
|
+
- Updated dependencies [dd3ff01]
|
26
|
+
- Updated dependencies [7435eb5]
|
27
|
+
- Updated dependencies [cb68df0]
|
28
|
+
- Updated dependencies [bfdca8d]
|
29
|
+
- Updated dependencies [44f4aba]
|
30
|
+
- Updated dependencies [023ba40]
|
31
|
+
- Updated dependencies [5e57fae]
|
32
|
+
- Updated dependencies [71f938d]
|
33
|
+
- Updated dependencies [28a5ed5]
|
34
|
+
- @ai-sdk/provider@2.0.0-beta.1
|
35
|
+
- @ai-sdk/provider-utils@3.0.0-beta.1
|
36
|
+
|
37
|
+
## 1.0.0-alpha.15
|
38
|
+
|
39
|
+
### Patch Changes
|
40
|
+
|
41
|
+
- Updated dependencies [48d257a]
|
42
|
+
- Updated dependencies [8ba77a7]
|
43
|
+
- @ai-sdk/provider@2.0.0-alpha.15
|
44
|
+
- @ai-sdk/provider-utils@3.0.0-alpha.15
|
45
|
+
|
46
|
+
## 1.0.0-alpha.14
|
47
|
+
|
48
|
+
### Patch Changes
|
49
|
+
|
50
|
+
- Updated dependencies [b5da06a]
|
51
|
+
- Updated dependencies [63f9e9b]
|
52
|
+
- Updated dependencies [2e13791]
|
53
|
+
- @ai-sdk/provider@2.0.0-alpha.14
|
54
|
+
- @ai-sdk/provider-utils@3.0.0-alpha.14
|
55
|
+
|
56
|
+
## 1.0.0-alpha.13
|
57
|
+
|
58
|
+
### Patch Changes
|
59
|
+
|
60
|
+
- Updated dependencies [68ecf2f]
|
61
|
+
- @ai-sdk/provider@2.0.0-alpha.13
|
62
|
+
- @ai-sdk/provider-utils@3.0.0-alpha.13
|
63
|
+
|
64
|
+
## 1.0.0-alpha.12
|
65
|
+
|
66
|
+
### Patch Changes
|
67
|
+
|
68
|
+
- e2aceaf: feat: add raw chunk support
|
69
|
+
- Updated dependencies [e2aceaf]
|
70
|
+
- @ai-sdk/provider@2.0.0-alpha.12
|
71
|
+
- @ai-sdk/provider-utils@3.0.0-alpha.12
|
72
|
+
|
73
|
+
## 1.0.0-alpha.11
|
74
|
+
|
75
|
+
### Patch Changes
|
76
|
+
|
77
|
+
- Updated dependencies [c1e6647]
|
78
|
+
- @ai-sdk/provider@2.0.0-alpha.11
|
79
|
+
- @ai-sdk/provider-utils@3.0.0-alpha.11
|
80
|
+
|
81
|
+
## 1.0.0-alpha.10
|
82
|
+
|
83
|
+
### Patch Changes
|
84
|
+
|
85
|
+
- Updated dependencies [c4df419]
|
86
|
+
- @ai-sdk/provider@2.0.0-alpha.10
|
87
|
+
- @ai-sdk/provider-utils@3.0.0-alpha.10
|
88
|
+
|
3
89
|
## 1.0.0-alpha.9
|
4
90
|
|
5
91
|
### Patch Changes
|
package/dist/index.d.mts
CHANGED
@@ -1,25 +1,16 @@
|
|
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
|
-
|
16
|
-
}
|
17
|
-
|
18
|
-
reasoningEffort?: "low" | "medium" | "high" | undefined;
|
19
|
-
}, {
|
20
|
-
user?: string | undefined;
|
21
|
-
reasoningEffort?: "low" | "medium" | "high" | undefined;
|
22
|
-
}>;
|
8
|
+
reasoningEffort: z.ZodOptional<z.ZodEnum<{
|
9
|
+
low: "low";
|
10
|
+
medium: "medium";
|
11
|
+
high: "high";
|
12
|
+
}>>;
|
13
|
+
}, z.core.$strip>;
|
23
14
|
type OpenAICompatibleProviderOptions = z.infer<typeof openaiCompatibleProviderOptions>;
|
24
15
|
|
25
16
|
declare const openaiCompatibleErrorDataSchema: z.ZodObject<{
|
@@ -27,36 +18,12 @@ declare const openaiCompatibleErrorDataSchema: z.ZodObject<{
|
|
27
18
|
message: z.ZodString;
|
28
19
|
type: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
29
20
|
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
|
-
}>;
|
21
|
+
code: z.ZodOptional<z.ZodNullable<z.ZodUnion<readonly [z.ZodString, z.ZodNumber]>>>;
|
22
|
+
}, z.core.$strip>;
|
23
|
+
}, z.core.$strip>;
|
57
24
|
type OpenAICompatibleErrorData = z.infer<typeof openaiCompatibleErrorDataSchema>;
|
58
25
|
type ProviderErrorStructure<T> = {
|
59
|
-
errorSchema:
|
26
|
+
errorSchema: ZodType<T>;
|
60
27
|
errorToMessage: (error: T) => string;
|
61
28
|
isRetryable?: (response: Response, error?: T) => boolean;
|
62
29
|
};
|
@@ -142,37 +109,11 @@ declare class OpenAICompatibleChatLanguageModel implements LanguageModelV2 {
|
|
142
109
|
|
143
110
|
type OpenAICompatibleCompletionModelId = string;
|
144
111
|
declare const openaiCompatibleCompletionProviderOptions: z.ZodObject<{
|
145
|
-
/**
|
146
|
-
* Echo back the prompt in addition to the completion.
|
147
|
-
*/
|
148
112
|
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
113
|
logitBias: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodNumber>>;
|
156
|
-
/**
|
157
|
-
* The suffix that comes after a completion of inserted text.
|
158
|
-
*/
|
159
114
|
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
115
|
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
|
-
}>;
|
116
|
+
}, z.core.$strip>;
|
176
117
|
type OpenAICompatibleCompletionProviderOptions = z.infer<typeof openaiCompatibleCompletionProviderOptions>;
|
177
118
|
|
178
119
|
type OpenAICompatibleCompletionConfig = {
|
@@ -207,23 +148,9 @@ declare class OpenAICompatibleCompletionLanguageModel implements LanguageModelV2
|
|
207
148
|
|
208
149
|
type OpenAICompatibleEmbeddingModelId = string;
|
209
150
|
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
151
|
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
152
|
user: z.ZodOptional<z.ZodString>;
|
220
|
-
},
|
221
|
-
user?: string | undefined;
|
222
|
-
dimensions?: number | undefined;
|
223
|
-
}, {
|
224
|
-
user?: string | undefined;
|
225
|
-
dimensions?: number | undefined;
|
226
|
-
}>;
|
153
|
+
}, z.core.$strip>;
|
227
154
|
type OpenAICompatibleEmbeddingProviderOptions = z.infer<typeof openaiCompatibleEmbeddingProviderOptions>;
|
228
155
|
|
229
156
|
type OpenAICompatibleEmbeddingConfig = {
|
package/dist/index.d.ts
CHANGED
@@ -1,25 +1,16 @@
|
|
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
|
-
|
16
|
-
}
|
17
|
-
|
18
|
-
reasoningEffort?: "low" | "medium" | "high" | undefined;
|
19
|
-
}, {
|
20
|
-
user?: string | undefined;
|
21
|
-
reasoningEffort?: "low" | "medium" | "high" | undefined;
|
22
|
-
}>;
|
8
|
+
reasoningEffort: z.ZodOptional<z.ZodEnum<{
|
9
|
+
low: "low";
|
10
|
+
medium: "medium";
|
11
|
+
high: "high";
|
12
|
+
}>>;
|
13
|
+
}, z.core.$strip>;
|
23
14
|
type OpenAICompatibleProviderOptions = z.infer<typeof openaiCompatibleProviderOptions>;
|
24
15
|
|
25
16
|
declare const openaiCompatibleErrorDataSchema: z.ZodObject<{
|
@@ -27,36 +18,12 @@ declare const openaiCompatibleErrorDataSchema: z.ZodObject<{
|
|
27
18
|
message: z.ZodString;
|
28
19
|
type: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
29
20
|
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
|
-
}>;
|
21
|
+
code: z.ZodOptional<z.ZodNullable<z.ZodUnion<readonly [z.ZodString, z.ZodNumber]>>>;
|
22
|
+
}, z.core.$strip>;
|
23
|
+
}, z.core.$strip>;
|
57
24
|
type OpenAICompatibleErrorData = z.infer<typeof openaiCompatibleErrorDataSchema>;
|
58
25
|
type ProviderErrorStructure<T> = {
|
59
|
-
errorSchema:
|
26
|
+
errorSchema: ZodType<T>;
|
60
27
|
errorToMessage: (error: T) => string;
|
61
28
|
isRetryable?: (response: Response, error?: T) => boolean;
|
62
29
|
};
|
@@ -142,37 +109,11 @@ declare class OpenAICompatibleChatLanguageModel implements LanguageModelV2 {
|
|
142
109
|
|
143
110
|
type OpenAICompatibleCompletionModelId = string;
|
144
111
|
declare const openaiCompatibleCompletionProviderOptions: z.ZodObject<{
|
145
|
-
/**
|
146
|
-
* Echo back the prompt in addition to the completion.
|
147
|
-
*/
|
148
112
|
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
113
|
logitBias: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodNumber>>;
|
156
|
-
/**
|
157
|
-
* The suffix that comes after a completion of inserted text.
|
158
|
-
*/
|
159
114
|
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
115
|
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
|
-
}>;
|
116
|
+
}, z.core.$strip>;
|
176
117
|
type OpenAICompatibleCompletionProviderOptions = z.infer<typeof openaiCompatibleCompletionProviderOptions>;
|
177
118
|
|
178
119
|
type OpenAICompatibleCompletionConfig = {
|
@@ -207,23 +148,9 @@ declare class OpenAICompatibleCompletionLanguageModel implements LanguageModelV2
|
|
207
148
|
|
208
149
|
type OpenAICompatibleEmbeddingModelId = string;
|
209
150
|
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
151
|
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
152
|
user: z.ZodOptional<z.ZodString>;
|
220
|
-
},
|
221
|
-
user?: string | undefined;
|
222
|
-
dimensions?: number | undefined;
|
223
|
-
}, {
|
224
|
-
user?: string | undefined;
|
225
|
-
dimensions?: number | undefined;
|
226
|
-
}>;
|
153
|
+
}, z.core.$strip>;
|
227
154
|
type OpenAICompatibleEmbeddingProviderOptions = z.infer<typeof openaiCompatibleEmbeddingProviderOptions>;
|
228
155
|
|
229
156
|
type OpenAICompatibleEmbeddingConfig = {
|