@ai-sdk/openai-compatible 1.0.0-alpha.9 → 1.0.0-beta.10
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 +142 -0
- package/dist/index.d.mts +13 -86
- package/dist/index.d.ts +13 -86
- package/dist/index.js +205 -145
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +116 -56
- 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 +5 -5
package/CHANGELOG.md
CHANGED
@@ -1,5 +1,147 @@
|
|
1
1
|
# @ai-sdk/openai-compatible
|
2
2
|
|
3
|
+
## 1.0.0-beta.10
|
4
|
+
|
5
|
+
### Patch Changes
|
6
|
+
|
7
|
+
- Updated dependencies [e7fcc86]
|
8
|
+
- @ai-sdk/provider-utils@3.0.0-beta.7
|
9
|
+
|
10
|
+
## 1.0.0-beta.9
|
11
|
+
|
12
|
+
### Patch Changes
|
13
|
+
|
14
|
+
- 737f1e2: Add (optional) includeUsage option to createOpenAICompatible
|
15
|
+
- Updated dependencies [ac34802]
|
16
|
+
- @ai-sdk/provider-utils@3.0.0-beta.6
|
17
|
+
|
18
|
+
## 1.0.0-beta.8
|
19
|
+
|
20
|
+
### Patch Changes
|
21
|
+
|
22
|
+
- Updated dependencies [57edfcb]
|
23
|
+
- Updated dependencies [383cbfa]
|
24
|
+
- @ai-sdk/provider-utils@3.0.0-beta.5
|
25
|
+
|
26
|
+
## 1.0.0-beta.7
|
27
|
+
|
28
|
+
### Patch Changes
|
29
|
+
|
30
|
+
- 205077b: fix: improve Zod compatibility
|
31
|
+
- Updated dependencies [205077b]
|
32
|
+
- @ai-sdk/provider-utils@3.0.0-beta.4
|
33
|
+
|
34
|
+
## 1.0.0-beta.6
|
35
|
+
|
36
|
+
### Patch Changes
|
37
|
+
|
38
|
+
- 281bb1c: fix (provider/openai-incompatible): support empty tool calls
|
39
|
+
|
40
|
+
## 1.0.0-beta.5
|
41
|
+
|
42
|
+
### Patch Changes
|
43
|
+
|
44
|
+
- Updated dependencies [05d2819]
|
45
|
+
- @ai-sdk/provider-utils@3.0.0-beta.3
|
46
|
+
|
47
|
+
## 1.0.0-beta.4
|
48
|
+
|
49
|
+
### Patch Changes
|
50
|
+
|
51
|
+
- 1b101e1: feat (provider/openai-compatible): allow providers that do not specify function type
|
52
|
+
|
53
|
+
## 1.0.0-beta.3
|
54
|
+
|
55
|
+
### Patch Changes
|
56
|
+
|
57
|
+
- 7b069ed: allow any string as reasoningEffort
|
58
|
+
|
59
|
+
## 1.0.0-beta.2
|
60
|
+
|
61
|
+
### Patch Changes
|
62
|
+
|
63
|
+
- d1a034f: feature: using Zod 4 for internal stuff
|
64
|
+
- Updated dependencies [0571b98]
|
65
|
+
- Updated dependencies [39a4fab]
|
66
|
+
- Updated dependencies [d1a034f]
|
67
|
+
- @ai-sdk/provider-utils@3.0.0-beta.2
|
68
|
+
|
69
|
+
## 1.0.0-beta.1
|
70
|
+
|
71
|
+
### Patch Changes
|
72
|
+
|
73
|
+
- Updated dependencies [742b7be]
|
74
|
+
- Updated dependencies [7cddb72]
|
75
|
+
- Updated dependencies [ccce59b]
|
76
|
+
- Updated dependencies [e2b9e4b]
|
77
|
+
- Updated dependencies [45c1ea2]
|
78
|
+
- Updated dependencies [e025824]
|
79
|
+
- Updated dependencies [0d06df6]
|
80
|
+
- Updated dependencies [472524a]
|
81
|
+
- Updated dependencies [dd3ff01]
|
82
|
+
- Updated dependencies [7435eb5]
|
83
|
+
- Updated dependencies [cb68df0]
|
84
|
+
- Updated dependencies [bfdca8d]
|
85
|
+
- Updated dependencies [44f4aba]
|
86
|
+
- Updated dependencies [023ba40]
|
87
|
+
- Updated dependencies [5e57fae]
|
88
|
+
- Updated dependencies [71f938d]
|
89
|
+
- Updated dependencies [28a5ed5]
|
90
|
+
- @ai-sdk/provider@2.0.0-beta.1
|
91
|
+
- @ai-sdk/provider-utils@3.0.0-beta.1
|
92
|
+
|
93
|
+
## 1.0.0-alpha.15
|
94
|
+
|
95
|
+
### Patch Changes
|
96
|
+
|
97
|
+
- Updated dependencies [48d257a]
|
98
|
+
- Updated dependencies [8ba77a7]
|
99
|
+
- @ai-sdk/provider@2.0.0-alpha.15
|
100
|
+
- @ai-sdk/provider-utils@3.0.0-alpha.15
|
101
|
+
|
102
|
+
## 1.0.0-alpha.14
|
103
|
+
|
104
|
+
### Patch Changes
|
105
|
+
|
106
|
+
- Updated dependencies [b5da06a]
|
107
|
+
- Updated dependencies [63f9e9b]
|
108
|
+
- Updated dependencies [2e13791]
|
109
|
+
- @ai-sdk/provider@2.0.0-alpha.14
|
110
|
+
- @ai-sdk/provider-utils@3.0.0-alpha.14
|
111
|
+
|
112
|
+
## 1.0.0-alpha.13
|
113
|
+
|
114
|
+
### Patch Changes
|
115
|
+
|
116
|
+
- Updated dependencies [68ecf2f]
|
117
|
+
- @ai-sdk/provider@2.0.0-alpha.13
|
118
|
+
- @ai-sdk/provider-utils@3.0.0-alpha.13
|
119
|
+
|
120
|
+
## 1.0.0-alpha.12
|
121
|
+
|
122
|
+
### Patch Changes
|
123
|
+
|
124
|
+
- e2aceaf: feat: add raw chunk support
|
125
|
+
- Updated dependencies [e2aceaf]
|
126
|
+
- @ai-sdk/provider@2.0.0-alpha.12
|
127
|
+
- @ai-sdk/provider-utils@3.0.0-alpha.12
|
128
|
+
|
129
|
+
## 1.0.0-alpha.11
|
130
|
+
|
131
|
+
### Patch Changes
|
132
|
+
|
133
|
+
- Updated dependencies [c1e6647]
|
134
|
+
- @ai-sdk/provider@2.0.0-alpha.11
|
135
|
+
- @ai-sdk/provider-utils@3.0.0-alpha.11
|
136
|
+
|
137
|
+
## 1.0.0-alpha.10
|
138
|
+
|
139
|
+
### Patch Changes
|
140
|
+
|
141
|
+
- Updated dependencies [c4df419]
|
142
|
+
- @ai-sdk/provider@2.0.0-alpha.10
|
143
|
+
- @ai-sdk/provider-utils@3.0.0-alpha.10
|
144
|
+
|
3
145
|
## 1.0.0-alpha.9
|
4
146
|
|
5
147
|
### 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 = {
|
@@ -318,6 +241,10 @@ interface OpenAICompatibleProviderSettings {
|
|
318
241
|
or to provide a custom fetch implementation for e.g. testing.
|
319
242
|
*/
|
320
243
|
fetch?: FetchFunction;
|
244
|
+
/**
|
245
|
+
Include usage information in streaming responses.
|
246
|
+
*/
|
247
|
+
includeUsage?: boolean;
|
321
248
|
}
|
322
249
|
/**
|
323
250
|
Create an OpenAICompatible provider instance.
|
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 = {
|
@@ -318,6 +241,10 @@ interface OpenAICompatibleProviderSettings {
|
|
318
241
|
or to provide a custom fetch implementation for e.g. testing.
|
319
242
|
*/
|
320
243
|
fetch?: FetchFunction;
|
244
|
+
/**
|
245
|
+
Include usage information in streaming responses.
|
246
|
+
*/
|
247
|
+
includeUsage?: boolean;
|
321
248
|
}
|
322
249
|
/**
|
323
250
|
Create an OpenAICompatible provider instance.
|