@ai-sdk/openai-compatible 1.0.0-canary.6 → 1.0.0-canary.7
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 +23 -0
- package/dist/index.d.mts +69 -56
- package/dist/index.d.ts +69 -56
- package/dist/index.js +222 -130
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +225 -130
- package/dist/index.mjs.map +1 -1
- package/dist/internal/index.d.mts +3 -3
- package/dist/internal/index.d.ts +3 -3
- package/dist/internal/index.js.map +1 -1
- package/dist/internal/index.mjs.map +1 -1
- package/package.json +3 -3
package/CHANGELOG.md
CHANGED
@@ -1,5 +1,28 @@
|
|
1
1
|
# @ai-sdk/openai-compatible
|
2
2
|
|
3
|
+
## 1.0.0-canary.7
|
4
|
+
|
5
|
+
### Patch Changes
|
6
|
+
|
7
|
+
- fa49207: feat(providers/openai-compatible): convert to providerOptions
|
8
|
+
- 26735b5: chore(embedding-model): add v2 interface
|
9
|
+
- 443d8ec: feat(embedding-model-v2): add response body field
|
10
|
+
- fd65bc6: chore(embedding-model-v2): rename rawResponse to response
|
11
|
+
- Updated dependencies [26735b5]
|
12
|
+
- Updated dependencies [443d8ec]
|
13
|
+
- Updated dependencies [14c9410]
|
14
|
+
- Updated dependencies [d9c98f4]
|
15
|
+
- Updated dependencies [c4a2fec]
|
16
|
+
- Updated dependencies [0054544]
|
17
|
+
- Updated dependencies [9e9c809]
|
18
|
+
- Updated dependencies [32831c6]
|
19
|
+
- Updated dependencies [d0f9495]
|
20
|
+
- Updated dependencies [fd65bc6]
|
21
|
+
- Updated dependencies [393138b]
|
22
|
+
- Updated dependencies [7182d14]
|
23
|
+
- @ai-sdk/provider@2.0.0-canary.6
|
24
|
+
- @ai-sdk/provider-utils@3.0.0-canary.7
|
25
|
+
|
3
26
|
## 1.0.0-canary.6
|
4
27
|
|
5
28
|
### Patch Changes
|
package/dist/index.d.mts
CHANGED
@@ -1,15 +1,20 @@
|
|
1
|
-
import {
|
1
|
+
import { SharedV2ProviderMetadata, LanguageModelV2, LanguageModelV2ObjectGenerationMode, EmbeddingModelV2, ImageModelV1, ProviderV2 } from '@ai-sdk/provider';
|
2
2
|
import { FetchFunction } from '@ai-sdk/provider-utils';
|
3
3
|
import { z, ZodSchema } from 'zod';
|
4
4
|
|
5
5
|
type OpenAICompatibleChatModelId = string;
|
6
|
-
|
6
|
+
declare const openaiCompatibleProviderOptions: z.ZodObject<{
|
7
7
|
/**
|
8
|
-
|
9
|
-
|
10
|
-
|
11
|
-
user
|
12
|
-
}
|
8
|
+
* A unique identifier representing your end-user, which can help the provider to
|
9
|
+
* monitor and detect abuse.
|
10
|
+
*/
|
11
|
+
user: z.ZodOptional<z.ZodString>;
|
12
|
+
}, "strip", z.ZodTypeAny, {
|
13
|
+
user?: string | undefined;
|
14
|
+
}, {
|
15
|
+
user?: string | undefined;
|
16
|
+
}>;
|
17
|
+
type OpenAICompatibleProviderOptions = z.infer<typeof openaiCompatibleProviderOptions>;
|
13
18
|
|
14
19
|
declare const openaiCompatibleErrorDataSchema: z.ZodObject<{
|
15
20
|
error: z.ZodObject<{
|
@@ -66,7 +71,7 @@ type MetadataExtractor = {
|
|
66
71
|
*/
|
67
72
|
extractMetadata: ({ parsedBody, }: {
|
68
73
|
parsedBody: unknown;
|
69
|
-
}) =>
|
74
|
+
}) => SharedV2ProviderMetadata | undefined;
|
70
75
|
/**
|
71
76
|
* Creates an extractor for handling streaming responses. The returned object provides
|
72
77
|
* methods to process individual chunks and build the final metadata from the accumulated
|
@@ -89,7 +94,7 @@ type MetadataExtractor = {
|
|
89
94
|
* @returns Provider-specific metadata or undefined if no metadata is available.
|
90
95
|
* The metadata should be under a key indicating the provider id.
|
91
96
|
*/
|
92
|
-
buildMetadata():
|
97
|
+
buildMetadata(): SharedV2ProviderMetadata | undefined;
|
93
98
|
};
|
94
99
|
};
|
95
100
|
|
@@ -118,11 +123,10 @@ declare class OpenAICompatibleChatLanguageModel implements LanguageModelV2 {
|
|
118
123
|
readonly specificationVersion = "v2";
|
119
124
|
readonly supportsStructuredOutputs: boolean;
|
120
125
|
readonly modelId: OpenAICompatibleChatModelId;
|
121
|
-
readonly settings: OpenAICompatibleChatSettings;
|
122
126
|
private readonly config;
|
123
127
|
private readonly failedResponseHandler;
|
124
128
|
private readonly chunkSchema;
|
125
|
-
constructor(modelId: OpenAICompatibleChatModelId,
|
129
|
+
constructor(modelId: OpenAICompatibleChatModelId, config: OpenAICompatibleChatConfig);
|
126
130
|
get defaultObjectGenerationMode(): 'json' | 'tool' | undefined;
|
127
131
|
get provider(): string;
|
128
132
|
private get providerOptionsName();
|
@@ -132,36 +136,39 @@ declare class OpenAICompatibleChatLanguageModel implements LanguageModelV2 {
|
|
132
136
|
}
|
133
137
|
|
134
138
|
type OpenAICompatibleCompletionModelId = string;
|
135
|
-
|
139
|
+
declare const openaiCompatibleCompletionProviderOptions: z.ZodObject<{
|
136
140
|
/**
|
137
|
-
|
141
|
+
* Echo back the prompt in addition to the completion.
|
138
142
|
*/
|
139
|
-
echo
|
143
|
+
echo: z.ZodOptional<z.ZodBoolean>;
|
140
144
|
/**
|
141
|
-
|
142
|
-
|
143
|
-
|
144
|
-
|
145
|
-
can use this tokenizer tool to convert text to token IDs. Mathematically,
|
146
|
-
the bias is added to the logits generated by the model prior to sampling.
|
147
|
-
The exact effect will vary per model, but values between -1 and 1 should
|
148
|
-
decrease or increase likelihood of selection; values like -100 or 100
|
149
|
-
should result in a ban or exclusive selection of the relevant token.
|
150
|
-
|
151
|
-
As an example, you can pass {"50256": -100} to prevent the <|endoftext|>
|
152
|
-
token from being generated.
|
145
|
+
* Modify the likelihood of specified tokens appearing in the completion.
|
146
|
+
*
|
147
|
+
* Accepts a JSON object that maps tokens (specified by their token ID in
|
148
|
+
* the GPT tokenizer) to an associated bias value from -100 to 100.
|
153
149
|
*/
|
154
|
-
logitBias
|
150
|
+
logitBias: z.ZodOptional<z.ZodRecord<z.ZodNumber, z.ZodNumber>>;
|
155
151
|
/**
|
156
|
-
|
152
|
+
* The suffix that comes after a completion of inserted text.
|
157
153
|
*/
|
158
|
-
suffix
|
154
|
+
suffix: z.ZodOptional<z.ZodString>;
|
159
155
|
/**
|
160
|
-
|
161
|
-
|
156
|
+
* A unique identifier representing your end-user, which can help providers to
|
157
|
+
* monitor and detect abuse.
|
162
158
|
*/
|
163
|
-
user
|
164
|
-
}
|
159
|
+
user: z.ZodOptional<z.ZodString>;
|
160
|
+
}, "strip", z.ZodTypeAny, {
|
161
|
+
user?: string | undefined;
|
162
|
+
echo?: boolean | undefined;
|
163
|
+
logitBias?: Record<number, number> | undefined;
|
164
|
+
suffix?: string | undefined;
|
165
|
+
}, {
|
166
|
+
user?: string | undefined;
|
167
|
+
echo?: boolean | undefined;
|
168
|
+
logitBias?: Record<number, number> | undefined;
|
169
|
+
suffix?: string | undefined;
|
170
|
+
}>;
|
171
|
+
type OpenAICompatibleCompletionProviderOptions = z.infer<typeof openaiCompatibleCompletionProviderOptions>;
|
165
172
|
|
166
173
|
type OpenAICompatibleCompletionConfig = {
|
167
174
|
provider: string;
|
@@ -177,11 +184,10 @@ declare class OpenAICompatibleCompletionLanguageModel implements LanguageModelV2
|
|
177
184
|
readonly specificationVersion = "v2";
|
178
185
|
readonly defaultObjectGenerationMode: undefined;
|
179
186
|
readonly modelId: OpenAICompatibleCompletionModelId;
|
180
|
-
readonly settings: OpenAICompatibleCompletionSettings;
|
181
187
|
private readonly config;
|
182
188
|
private readonly failedResponseHandler;
|
183
189
|
private readonly chunkSchema;
|
184
|
-
constructor(modelId: OpenAICompatibleCompletionModelId,
|
190
|
+
constructor(modelId: OpenAICompatibleCompletionModelId, config: OpenAICompatibleCompletionConfig);
|
185
191
|
get provider(): string;
|
186
192
|
private get providerOptionsName();
|
187
193
|
private getArgs;
|
@@ -190,18 +196,25 @@ declare class OpenAICompatibleCompletionLanguageModel implements LanguageModelV2
|
|
190
196
|
}
|
191
197
|
|
192
198
|
type OpenAICompatibleEmbeddingModelId = string;
|
193
|
-
|
199
|
+
declare const openaiCompatibleEmbeddingProviderOptions: z.ZodObject<{
|
194
200
|
/**
|
195
|
-
|
196
|
-
|
201
|
+
* The number of dimensions the resulting output embeddings should have.
|
202
|
+
* Only supported in text-embedding-3 and later models.
|
197
203
|
*/
|
198
|
-
dimensions
|
204
|
+
dimensions: z.ZodOptional<z.ZodNumber>;
|
199
205
|
/**
|
200
|
-
|
201
|
-
|
202
|
-
|
203
|
-
user
|
204
|
-
}
|
206
|
+
* A unique identifier representing your end-user, which can help providers to
|
207
|
+
* monitor and detect abuse.
|
208
|
+
*/
|
209
|
+
user: z.ZodOptional<z.ZodString>;
|
210
|
+
}, "strip", z.ZodTypeAny, {
|
211
|
+
user?: string | undefined;
|
212
|
+
dimensions?: number | undefined;
|
213
|
+
}, {
|
214
|
+
user?: string | undefined;
|
215
|
+
dimensions?: number | undefined;
|
216
|
+
}>;
|
217
|
+
type OpenAICompatibleEmbeddingProviderOptions = z.infer<typeof openaiCompatibleEmbeddingProviderOptions>;
|
205
218
|
|
206
219
|
type OpenAICompatibleEmbeddingConfig = {
|
207
220
|
/**
|
@@ -221,16 +234,16 @@ type OpenAICompatibleEmbeddingConfig = {
|
|
221
234
|
fetch?: FetchFunction;
|
222
235
|
errorStructure?: ProviderErrorStructure<any>;
|
223
236
|
};
|
224
|
-
declare class OpenAICompatibleEmbeddingModel implements
|
225
|
-
readonly specificationVersion = "
|
237
|
+
declare class OpenAICompatibleEmbeddingModel implements EmbeddingModelV2<string> {
|
238
|
+
readonly specificationVersion = "v2";
|
226
239
|
readonly modelId: OpenAICompatibleEmbeddingModelId;
|
227
240
|
private readonly config;
|
228
|
-
private readonly settings;
|
229
241
|
get provider(): string;
|
230
242
|
get maxEmbeddingsPerCall(): number;
|
231
243
|
get supportsParallelCalls(): boolean;
|
232
|
-
constructor(modelId: OpenAICompatibleEmbeddingModelId,
|
233
|
-
|
244
|
+
constructor(modelId: OpenAICompatibleEmbeddingModelId, config: OpenAICompatibleEmbeddingConfig);
|
245
|
+
private get providerOptionsName();
|
246
|
+
doEmbed({ values, headers, abortSignal, providerOptions, }: Parameters<EmbeddingModelV2<string>['doEmbed']>[0]): Promise<Awaited<ReturnType<EmbeddingModelV2<string>['doEmbed']>>>;
|
234
247
|
}
|
235
248
|
|
236
249
|
type OpenAICompatibleImageModelId = string;
|
@@ -271,12 +284,12 @@ declare class OpenAICompatibleImageModel implements ImageModelV1 {
|
|
271
284
|
}
|
272
285
|
|
273
286
|
interface OpenAICompatibleProvider<CHAT_MODEL_IDS extends string = string, COMPLETION_MODEL_IDS extends string = string, EMBEDDING_MODEL_IDS extends string = string, IMAGE_MODEL_IDS extends string = string> extends Omit<ProviderV2, 'imageModel'> {
|
274
|
-
(modelId: CHAT_MODEL_IDS
|
275
|
-
languageModel(modelId: CHAT_MODEL_IDS
|
276
|
-
chatModel(modelId: CHAT_MODEL_IDS
|
277
|
-
completionModel(modelId: COMPLETION_MODEL_IDS
|
278
|
-
textEmbeddingModel(modelId: EMBEDDING_MODEL_IDS
|
279
|
-
imageModel(modelId: IMAGE_MODEL_IDS
|
287
|
+
(modelId: CHAT_MODEL_IDS): LanguageModelV2;
|
288
|
+
languageModel(modelId: CHAT_MODEL_IDS): LanguageModelV2;
|
289
|
+
chatModel(modelId: CHAT_MODEL_IDS): LanguageModelV2;
|
290
|
+
completionModel(modelId: COMPLETION_MODEL_IDS): LanguageModelV2;
|
291
|
+
textEmbeddingModel(modelId: EMBEDDING_MODEL_IDS): EmbeddingModelV2<string>;
|
292
|
+
imageModel(modelId: IMAGE_MODEL_IDS): ImageModelV1;
|
280
293
|
}
|
281
294
|
interface OpenAICompatibleProviderSettings {
|
282
295
|
/**
|
@@ -313,4 +326,4 @@ Create an OpenAICompatible provider instance.
|
|
313
326
|
*/
|
314
327
|
declare function createOpenAICompatible<CHAT_MODEL_IDS extends string, COMPLETION_MODEL_IDS extends string, EMBEDDING_MODEL_IDS extends string, IMAGE_MODEL_IDS extends string>(options: OpenAICompatibleProviderSettings): OpenAICompatibleProvider<CHAT_MODEL_IDS, COMPLETION_MODEL_IDS, EMBEDDING_MODEL_IDS, IMAGE_MODEL_IDS>;
|
315
328
|
|
316
|
-
export { type MetadataExtractor, OpenAICompatibleChatLanguageModel, type
|
329
|
+
export { type MetadataExtractor, OpenAICompatibleChatLanguageModel, type OpenAICompatibleChatModelId, OpenAICompatibleCompletionLanguageModel, type OpenAICompatibleCompletionModelId, type OpenAICompatibleCompletionProviderOptions, OpenAICompatibleEmbeddingModel, type OpenAICompatibleEmbeddingModelId, type OpenAICompatibleEmbeddingProviderOptions, type OpenAICompatibleErrorData, OpenAICompatibleImageModel, type OpenAICompatibleImageSettings, type OpenAICompatibleProvider, type OpenAICompatibleProviderOptions, type OpenAICompatibleProviderSettings, type ProviderErrorStructure, createOpenAICompatible };
|
package/dist/index.d.ts
CHANGED
@@ -1,15 +1,20 @@
|
|
1
|
-
import {
|
1
|
+
import { SharedV2ProviderMetadata, LanguageModelV2, LanguageModelV2ObjectGenerationMode, EmbeddingModelV2, ImageModelV1, ProviderV2 } from '@ai-sdk/provider';
|
2
2
|
import { FetchFunction } from '@ai-sdk/provider-utils';
|
3
3
|
import { z, ZodSchema } from 'zod';
|
4
4
|
|
5
5
|
type OpenAICompatibleChatModelId = string;
|
6
|
-
|
6
|
+
declare const openaiCompatibleProviderOptions: z.ZodObject<{
|
7
7
|
/**
|
8
|
-
|
9
|
-
|
10
|
-
|
11
|
-
user
|
12
|
-
}
|
8
|
+
* A unique identifier representing your end-user, which can help the provider to
|
9
|
+
* monitor and detect abuse.
|
10
|
+
*/
|
11
|
+
user: z.ZodOptional<z.ZodString>;
|
12
|
+
}, "strip", z.ZodTypeAny, {
|
13
|
+
user?: string | undefined;
|
14
|
+
}, {
|
15
|
+
user?: string | undefined;
|
16
|
+
}>;
|
17
|
+
type OpenAICompatibleProviderOptions = z.infer<typeof openaiCompatibleProviderOptions>;
|
13
18
|
|
14
19
|
declare const openaiCompatibleErrorDataSchema: z.ZodObject<{
|
15
20
|
error: z.ZodObject<{
|
@@ -66,7 +71,7 @@ type MetadataExtractor = {
|
|
66
71
|
*/
|
67
72
|
extractMetadata: ({ parsedBody, }: {
|
68
73
|
parsedBody: unknown;
|
69
|
-
}) =>
|
74
|
+
}) => SharedV2ProviderMetadata | undefined;
|
70
75
|
/**
|
71
76
|
* Creates an extractor for handling streaming responses. The returned object provides
|
72
77
|
* methods to process individual chunks and build the final metadata from the accumulated
|
@@ -89,7 +94,7 @@ type MetadataExtractor = {
|
|
89
94
|
* @returns Provider-specific metadata or undefined if no metadata is available.
|
90
95
|
* The metadata should be under a key indicating the provider id.
|
91
96
|
*/
|
92
|
-
buildMetadata():
|
97
|
+
buildMetadata(): SharedV2ProviderMetadata | undefined;
|
93
98
|
};
|
94
99
|
};
|
95
100
|
|
@@ -118,11 +123,10 @@ declare class OpenAICompatibleChatLanguageModel implements LanguageModelV2 {
|
|
118
123
|
readonly specificationVersion = "v2";
|
119
124
|
readonly supportsStructuredOutputs: boolean;
|
120
125
|
readonly modelId: OpenAICompatibleChatModelId;
|
121
|
-
readonly settings: OpenAICompatibleChatSettings;
|
122
126
|
private readonly config;
|
123
127
|
private readonly failedResponseHandler;
|
124
128
|
private readonly chunkSchema;
|
125
|
-
constructor(modelId: OpenAICompatibleChatModelId,
|
129
|
+
constructor(modelId: OpenAICompatibleChatModelId, config: OpenAICompatibleChatConfig);
|
126
130
|
get defaultObjectGenerationMode(): 'json' | 'tool' | undefined;
|
127
131
|
get provider(): string;
|
128
132
|
private get providerOptionsName();
|
@@ -132,36 +136,39 @@ declare class OpenAICompatibleChatLanguageModel implements LanguageModelV2 {
|
|
132
136
|
}
|
133
137
|
|
134
138
|
type OpenAICompatibleCompletionModelId = string;
|
135
|
-
|
139
|
+
declare const openaiCompatibleCompletionProviderOptions: z.ZodObject<{
|
136
140
|
/**
|
137
|
-
|
141
|
+
* Echo back the prompt in addition to the completion.
|
138
142
|
*/
|
139
|
-
echo
|
143
|
+
echo: z.ZodOptional<z.ZodBoolean>;
|
140
144
|
/**
|
141
|
-
|
142
|
-
|
143
|
-
|
144
|
-
|
145
|
-
can use this tokenizer tool to convert text to token IDs. Mathematically,
|
146
|
-
the bias is added to the logits generated by the model prior to sampling.
|
147
|
-
The exact effect will vary per model, but values between -1 and 1 should
|
148
|
-
decrease or increase likelihood of selection; values like -100 or 100
|
149
|
-
should result in a ban or exclusive selection of the relevant token.
|
150
|
-
|
151
|
-
As an example, you can pass {"50256": -100} to prevent the <|endoftext|>
|
152
|
-
token from being generated.
|
145
|
+
* Modify the likelihood of specified tokens appearing in the completion.
|
146
|
+
*
|
147
|
+
* Accepts a JSON object that maps tokens (specified by their token ID in
|
148
|
+
* the GPT tokenizer) to an associated bias value from -100 to 100.
|
153
149
|
*/
|
154
|
-
logitBias
|
150
|
+
logitBias: z.ZodOptional<z.ZodRecord<z.ZodNumber, z.ZodNumber>>;
|
155
151
|
/**
|
156
|
-
|
152
|
+
* The suffix that comes after a completion of inserted text.
|
157
153
|
*/
|
158
|
-
suffix
|
154
|
+
suffix: z.ZodOptional<z.ZodString>;
|
159
155
|
/**
|
160
|
-
|
161
|
-
|
156
|
+
* A unique identifier representing your end-user, which can help providers to
|
157
|
+
* monitor and detect abuse.
|
162
158
|
*/
|
163
|
-
user
|
164
|
-
}
|
159
|
+
user: z.ZodOptional<z.ZodString>;
|
160
|
+
}, "strip", z.ZodTypeAny, {
|
161
|
+
user?: string | undefined;
|
162
|
+
echo?: boolean | undefined;
|
163
|
+
logitBias?: Record<number, number> | undefined;
|
164
|
+
suffix?: string | undefined;
|
165
|
+
}, {
|
166
|
+
user?: string | undefined;
|
167
|
+
echo?: boolean | undefined;
|
168
|
+
logitBias?: Record<number, number> | undefined;
|
169
|
+
suffix?: string | undefined;
|
170
|
+
}>;
|
171
|
+
type OpenAICompatibleCompletionProviderOptions = z.infer<typeof openaiCompatibleCompletionProviderOptions>;
|
165
172
|
|
166
173
|
type OpenAICompatibleCompletionConfig = {
|
167
174
|
provider: string;
|
@@ -177,11 +184,10 @@ declare class OpenAICompatibleCompletionLanguageModel implements LanguageModelV2
|
|
177
184
|
readonly specificationVersion = "v2";
|
178
185
|
readonly defaultObjectGenerationMode: undefined;
|
179
186
|
readonly modelId: OpenAICompatibleCompletionModelId;
|
180
|
-
readonly settings: OpenAICompatibleCompletionSettings;
|
181
187
|
private readonly config;
|
182
188
|
private readonly failedResponseHandler;
|
183
189
|
private readonly chunkSchema;
|
184
|
-
constructor(modelId: OpenAICompatibleCompletionModelId,
|
190
|
+
constructor(modelId: OpenAICompatibleCompletionModelId, config: OpenAICompatibleCompletionConfig);
|
185
191
|
get provider(): string;
|
186
192
|
private get providerOptionsName();
|
187
193
|
private getArgs;
|
@@ -190,18 +196,25 @@ declare class OpenAICompatibleCompletionLanguageModel implements LanguageModelV2
|
|
190
196
|
}
|
191
197
|
|
192
198
|
type OpenAICompatibleEmbeddingModelId = string;
|
193
|
-
|
199
|
+
declare const openaiCompatibleEmbeddingProviderOptions: z.ZodObject<{
|
194
200
|
/**
|
195
|
-
|
196
|
-
|
201
|
+
* The number of dimensions the resulting output embeddings should have.
|
202
|
+
* Only supported in text-embedding-3 and later models.
|
197
203
|
*/
|
198
|
-
dimensions
|
204
|
+
dimensions: z.ZodOptional<z.ZodNumber>;
|
199
205
|
/**
|
200
|
-
|
201
|
-
|
202
|
-
|
203
|
-
user
|
204
|
-
}
|
206
|
+
* A unique identifier representing your end-user, which can help providers to
|
207
|
+
* monitor and detect abuse.
|
208
|
+
*/
|
209
|
+
user: z.ZodOptional<z.ZodString>;
|
210
|
+
}, "strip", z.ZodTypeAny, {
|
211
|
+
user?: string | undefined;
|
212
|
+
dimensions?: number | undefined;
|
213
|
+
}, {
|
214
|
+
user?: string | undefined;
|
215
|
+
dimensions?: number | undefined;
|
216
|
+
}>;
|
217
|
+
type OpenAICompatibleEmbeddingProviderOptions = z.infer<typeof openaiCompatibleEmbeddingProviderOptions>;
|
205
218
|
|
206
219
|
type OpenAICompatibleEmbeddingConfig = {
|
207
220
|
/**
|
@@ -221,16 +234,16 @@ type OpenAICompatibleEmbeddingConfig = {
|
|
221
234
|
fetch?: FetchFunction;
|
222
235
|
errorStructure?: ProviderErrorStructure<any>;
|
223
236
|
};
|
224
|
-
declare class OpenAICompatibleEmbeddingModel implements
|
225
|
-
readonly specificationVersion = "
|
237
|
+
declare class OpenAICompatibleEmbeddingModel implements EmbeddingModelV2<string> {
|
238
|
+
readonly specificationVersion = "v2";
|
226
239
|
readonly modelId: OpenAICompatibleEmbeddingModelId;
|
227
240
|
private readonly config;
|
228
|
-
private readonly settings;
|
229
241
|
get provider(): string;
|
230
242
|
get maxEmbeddingsPerCall(): number;
|
231
243
|
get supportsParallelCalls(): boolean;
|
232
|
-
constructor(modelId: OpenAICompatibleEmbeddingModelId,
|
233
|
-
|
244
|
+
constructor(modelId: OpenAICompatibleEmbeddingModelId, config: OpenAICompatibleEmbeddingConfig);
|
245
|
+
private get providerOptionsName();
|
246
|
+
doEmbed({ values, headers, abortSignal, providerOptions, }: Parameters<EmbeddingModelV2<string>['doEmbed']>[0]): Promise<Awaited<ReturnType<EmbeddingModelV2<string>['doEmbed']>>>;
|
234
247
|
}
|
235
248
|
|
236
249
|
type OpenAICompatibleImageModelId = string;
|
@@ -271,12 +284,12 @@ declare class OpenAICompatibleImageModel implements ImageModelV1 {
|
|
271
284
|
}
|
272
285
|
|
273
286
|
interface OpenAICompatibleProvider<CHAT_MODEL_IDS extends string = string, COMPLETION_MODEL_IDS extends string = string, EMBEDDING_MODEL_IDS extends string = string, IMAGE_MODEL_IDS extends string = string> extends Omit<ProviderV2, 'imageModel'> {
|
274
|
-
(modelId: CHAT_MODEL_IDS
|
275
|
-
languageModel(modelId: CHAT_MODEL_IDS
|
276
|
-
chatModel(modelId: CHAT_MODEL_IDS
|
277
|
-
completionModel(modelId: COMPLETION_MODEL_IDS
|
278
|
-
textEmbeddingModel(modelId: EMBEDDING_MODEL_IDS
|
279
|
-
imageModel(modelId: IMAGE_MODEL_IDS
|
287
|
+
(modelId: CHAT_MODEL_IDS): LanguageModelV2;
|
288
|
+
languageModel(modelId: CHAT_MODEL_IDS): LanguageModelV2;
|
289
|
+
chatModel(modelId: CHAT_MODEL_IDS): LanguageModelV2;
|
290
|
+
completionModel(modelId: COMPLETION_MODEL_IDS): LanguageModelV2;
|
291
|
+
textEmbeddingModel(modelId: EMBEDDING_MODEL_IDS): EmbeddingModelV2<string>;
|
292
|
+
imageModel(modelId: IMAGE_MODEL_IDS): ImageModelV1;
|
280
293
|
}
|
281
294
|
interface OpenAICompatibleProviderSettings {
|
282
295
|
/**
|
@@ -313,4 +326,4 @@ Create an OpenAICompatible provider instance.
|
|
313
326
|
*/
|
314
327
|
declare function createOpenAICompatible<CHAT_MODEL_IDS extends string, COMPLETION_MODEL_IDS extends string, EMBEDDING_MODEL_IDS extends string, IMAGE_MODEL_IDS extends string>(options: OpenAICompatibleProviderSettings): OpenAICompatibleProvider<CHAT_MODEL_IDS, COMPLETION_MODEL_IDS, EMBEDDING_MODEL_IDS, IMAGE_MODEL_IDS>;
|
315
328
|
|
316
|
-
export { type MetadataExtractor, OpenAICompatibleChatLanguageModel, type
|
329
|
+
export { type MetadataExtractor, OpenAICompatibleChatLanguageModel, type OpenAICompatibleChatModelId, OpenAICompatibleCompletionLanguageModel, type OpenAICompatibleCompletionModelId, type OpenAICompatibleCompletionProviderOptions, OpenAICompatibleEmbeddingModel, type OpenAICompatibleEmbeddingModelId, type OpenAICompatibleEmbeddingProviderOptions, type OpenAICompatibleErrorData, OpenAICompatibleImageModel, type OpenAICompatibleImageSettings, type OpenAICompatibleProvider, type OpenAICompatibleProviderOptions, type OpenAICompatibleProviderSettings, type ProviderErrorStructure, createOpenAICompatible };
|