@ai-sdk/openai 2.0.0-canary.11 → 2.0.0-canary.12
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 +14 -0
- package/dist/index.d.mts +8 -38
- package/dist/index.d.ts +8 -38
- package/dist/index.js +246 -201
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +251 -205
- package/dist/index.mjs.map +1 -1
- package/dist/internal/index.d.mts +27 -15
- package/dist/internal/index.d.ts +27 -15
- package/dist/internal/index.js +246 -194
- package/dist/internal/index.js.map +1 -1
- package/dist/internal/index.mjs +249 -198
- package/dist/internal/index.mjs.map +1 -1
- package/internal.d.ts +1 -0
- package/package.json +5 -4
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,19 @@
|
|
|
1
1
|
# @ai-sdk/openai
|
|
2
2
|
|
|
3
|
+
## 2.0.0-canary.12
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- db72adc: chore(providers/openai): update completion model to use providerOptions
|
|
8
|
+
- 66962ed: fix(packages): export node10 compatible types
|
|
9
|
+
- 9301f86: refactor (image-model): rename `ImageModelV1` to `ImageModelV2`
|
|
10
|
+
- 7df7a25: feat (providers/openai): support gpt-image-1 image generation
|
|
11
|
+
- Updated dependencies [66962ed]
|
|
12
|
+
- Updated dependencies [9301f86]
|
|
13
|
+
- Updated dependencies [a3f768e]
|
|
14
|
+
- @ai-sdk/provider-utils@3.0.0-canary.11
|
|
15
|
+
- @ai-sdk/provider@2.0.0-canary.10
|
|
16
|
+
|
|
3
17
|
## 2.0.0-canary.11
|
|
4
18
|
|
|
5
19
|
### Patch Changes
|
package/dist/index.d.mts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { LanguageModelV2, ProviderV2, EmbeddingModelV2,
|
|
1
|
+
import { LanguageModelV2, ProviderV2, EmbeddingModelV2, ImageModelV2, TranscriptionModelV1, SpeechModelV1 } from '@ai-sdk/provider';
|
|
2
2
|
import { FetchFunction } from '@ai-sdk/provider-utils';
|
|
3
3
|
import { z } from 'zod';
|
|
4
4
|
|
|
@@ -13,36 +13,6 @@ interface OpenAIChatSettings {
|
|
|
13
13
|
}
|
|
14
14
|
|
|
15
15
|
type OpenAICompletionModelId = 'gpt-3.5-turbo-instruct' | (string & {});
|
|
16
|
-
interface OpenAICompletionSettings {
|
|
17
|
-
/**
|
|
18
|
-
Echo back the prompt in addition to the completion.
|
|
19
|
-
*/
|
|
20
|
-
echo?: boolean;
|
|
21
|
-
/**
|
|
22
|
-
Modify the likelihood of specified tokens appearing in the completion.
|
|
23
|
-
|
|
24
|
-
Accepts a JSON object that maps tokens (specified by their token ID in
|
|
25
|
-
the GPT tokenizer) to an associated bias value from -100 to 100. You
|
|
26
|
-
can use this tokenizer tool to convert text to token IDs. Mathematically,
|
|
27
|
-
the bias is added to the logits generated by the model prior to sampling.
|
|
28
|
-
The exact effect will vary per model, but values between -1 and 1 should
|
|
29
|
-
decrease or increase likelihood of selection; values like -100 or 100
|
|
30
|
-
should result in a ban or exclusive selection of the relevant token.
|
|
31
|
-
|
|
32
|
-
As an example, you can pass {"50256": -100} to prevent the <|endoftext|>
|
|
33
|
-
token from being generated.
|
|
34
|
-
*/
|
|
35
|
-
logitBias?: Record<number, number>;
|
|
36
|
-
/**
|
|
37
|
-
The suffix that comes after a completion of inserted text.
|
|
38
|
-
*/
|
|
39
|
-
suffix?: string;
|
|
40
|
-
/**
|
|
41
|
-
A unique identifier representing your end-user, which can help OpenAI to
|
|
42
|
-
monitor and detect abuse. Learn more.
|
|
43
|
-
*/
|
|
44
|
-
user?: string;
|
|
45
|
-
}
|
|
46
16
|
|
|
47
17
|
type OpenAICompletionConfig = {
|
|
48
18
|
provider: string;
|
|
@@ -57,9 +27,9 @@ type OpenAICompletionConfig = {
|
|
|
57
27
|
declare class OpenAICompletionLanguageModel implements LanguageModelV2 {
|
|
58
28
|
readonly specificationVersion = "v2";
|
|
59
29
|
readonly modelId: OpenAICompletionModelId;
|
|
60
|
-
readonly settings: OpenAICompletionSettings;
|
|
61
30
|
private readonly config;
|
|
62
|
-
|
|
31
|
+
private get providerOptionsName();
|
|
32
|
+
constructor(modelId: OpenAICompletionModelId, config: OpenAICompletionConfig);
|
|
63
33
|
get provider(): string;
|
|
64
34
|
getSupportedUrls(): Promise<Record<string, RegExp[]>>;
|
|
65
35
|
private getArgs;
|
|
@@ -115,12 +85,12 @@ type OpenAIResponsesModelId = 'o1' | 'o1-2024-12-17' | 'o1-mini' | 'o1-mini-2024
|
|
|
115
85
|
type OpenAISpeechModelId = 'tts-1' | 'tts-1-hd' | 'gpt-4o-mini-tts' | (string & {});
|
|
116
86
|
|
|
117
87
|
interface OpenAIProvider extends ProviderV2 {
|
|
118
|
-
(modelId: 'gpt-3.5-turbo-instruct'
|
|
88
|
+
(modelId: 'gpt-3.5-turbo-instruct'): OpenAICompletionLanguageModel;
|
|
119
89
|
(modelId: OpenAIChatModelId, settings?: OpenAIChatSettings): LanguageModelV2;
|
|
120
90
|
/**
|
|
121
91
|
Creates an OpenAI model for text generation.
|
|
122
92
|
*/
|
|
123
|
-
languageModel(modelId: 'gpt-3.5-turbo-instruct'
|
|
93
|
+
languageModel(modelId: 'gpt-3.5-turbo-instruct'): OpenAICompletionLanguageModel;
|
|
124
94
|
languageModel(modelId: OpenAIChatModelId, settings?: OpenAIChatSettings): LanguageModelV2;
|
|
125
95
|
/**
|
|
126
96
|
Creates an OpenAI chat model for text generation.
|
|
@@ -133,7 +103,7 @@ interface OpenAIProvider extends ProviderV2 {
|
|
|
133
103
|
/**
|
|
134
104
|
Creates an OpenAI completion model for text generation.
|
|
135
105
|
*/
|
|
136
|
-
completion(modelId: OpenAICompletionModelId
|
|
106
|
+
completion(modelId: OpenAICompletionModelId): LanguageModelV2;
|
|
137
107
|
/**
|
|
138
108
|
Creates a model for text embeddings.
|
|
139
109
|
*/
|
|
@@ -151,11 +121,11 @@ interface OpenAIProvider extends ProviderV2 {
|
|
|
151
121
|
/**
|
|
152
122
|
Creates a model for image generation.
|
|
153
123
|
*/
|
|
154
|
-
image(modelId: OpenAIImageModelId, settings?: OpenAIImageSettings):
|
|
124
|
+
image(modelId: OpenAIImageModelId, settings?: OpenAIImageSettings): ImageModelV2;
|
|
155
125
|
/**
|
|
156
126
|
Creates a model for image generation.
|
|
157
127
|
*/
|
|
158
|
-
imageModel(modelId: OpenAIImageModelId, settings?: OpenAIImageSettings):
|
|
128
|
+
imageModel(modelId: OpenAIImageModelId, settings?: OpenAIImageSettings): ImageModelV2;
|
|
159
129
|
/**
|
|
160
130
|
Creates a model for transcription.
|
|
161
131
|
*/
|
package/dist/index.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { LanguageModelV2, ProviderV2, EmbeddingModelV2,
|
|
1
|
+
import { LanguageModelV2, ProviderV2, EmbeddingModelV2, ImageModelV2, TranscriptionModelV1, SpeechModelV1 } from '@ai-sdk/provider';
|
|
2
2
|
import { FetchFunction } from '@ai-sdk/provider-utils';
|
|
3
3
|
import { z } from 'zod';
|
|
4
4
|
|
|
@@ -13,36 +13,6 @@ interface OpenAIChatSettings {
|
|
|
13
13
|
}
|
|
14
14
|
|
|
15
15
|
type OpenAICompletionModelId = 'gpt-3.5-turbo-instruct' | (string & {});
|
|
16
|
-
interface OpenAICompletionSettings {
|
|
17
|
-
/**
|
|
18
|
-
Echo back the prompt in addition to the completion.
|
|
19
|
-
*/
|
|
20
|
-
echo?: boolean;
|
|
21
|
-
/**
|
|
22
|
-
Modify the likelihood of specified tokens appearing in the completion.
|
|
23
|
-
|
|
24
|
-
Accepts a JSON object that maps tokens (specified by their token ID in
|
|
25
|
-
the GPT tokenizer) to an associated bias value from -100 to 100. You
|
|
26
|
-
can use this tokenizer tool to convert text to token IDs. Mathematically,
|
|
27
|
-
the bias is added to the logits generated by the model prior to sampling.
|
|
28
|
-
The exact effect will vary per model, but values between -1 and 1 should
|
|
29
|
-
decrease or increase likelihood of selection; values like -100 or 100
|
|
30
|
-
should result in a ban or exclusive selection of the relevant token.
|
|
31
|
-
|
|
32
|
-
As an example, you can pass {"50256": -100} to prevent the <|endoftext|>
|
|
33
|
-
token from being generated.
|
|
34
|
-
*/
|
|
35
|
-
logitBias?: Record<number, number>;
|
|
36
|
-
/**
|
|
37
|
-
The suffix that comes after a completion of inserted text.
|
|
38
|
-
*/
|
|
39
|
-
suffix?: string;
|
|
40
|
-
/**
|
|
41
|
-
A unique identifier representing your end-user, which can help OpenAI to
|
|
42
|
-
monitor and detect abuse. Learn more.
|
|
43
|
-
*/
|
|
44
|
-
user?: string;
|
|
45
|
-
}
|
|
46
16
|
|
|
47
17
|
type OpenAICompletionConfig = {
|
|
48
18
|
provider: string;
|
|
@@ -57,9 +27,9 @@ type OpenAICompletionConfig = {
|
|
|
57
27
|
declare class OpenAICompletionLanguageModel implements LanguageModelV2 {
|
|
58
28
|
readonly specificationVersion = "v2";
|
|
59
29
|
readonly modelId: OpenAICompletionModelId;
|
|
60
|
-
readonly settings: OpenAICompletionSettings;
|
|
61
30
|
private readonly config;
|
|
62
|
-
|
|
31
|
+
private get providerOptionsName();
|
|
32
|
+
constructor(modelId: OpenAICompletionModelId, config: OpenAICompletionConfig);
|
|
63
33
|
get provider(): string;
|
|
64
34
|
getSupportedUrls(): Promise<Record<string, RegExp[]>>;
|
|
65
35
|
private getArgs;
|
|
@@ -115,12 +85,12 @@ type OpenAIResponsesModelId = 'o1' | 'o1-2024-12-17' | 'o1-mini' | 'o1-mini-2024
|
|
|
115
85
|
type OpenAISpeechModelId = 'tts-1' | 'tts-1-hd' | 'gpt-4o-mini-tts' | (string & {});
|
|
116
86
|
|
|
117
87
|
interface OpenAIProvider extends ProviderV2 {
|
|
118
|
-
(modelId: 'gpt-3.5-turbo-instruct'
|
|
88
|
+
(modelId: 'gpt-3.5-turbo-instruct'): OpenAICompletionLanguageModel;
|
|
119
89
|
(modelId: OpenAIChatModelId, settings?: OpenAIChatSettings): LanguageModelV2;
|
|
120
90
|
/**
|
|
121
91
|
Creates an OpenAI model for text generation.
|
|
122
92
|
*/
|
|
123
|
-
languageModel(modelId: 'gpt-3.5-turbo-instruct'
|
|
93
|
+
languageModel(modelId: 'gpt-3.5-turbo-instruct'): OpenAICompletionLanguageModel;
|
|
124
94
|
languageModel(modelId: OpenAIChatModelId, settings?: OpenAIChatSettings): LanguageModelV2;
|
|
125
95
|
/**
|
|
126
96
|
Creates an OpenAI chat model for text generation.
|
|
@@ -133,7 +103,7 @@ interface OpenAIProvider extends ProviderV2 {
|
|
|
133
103
|
/**
|
|
134
104
|
Creates an OpenAI completion model for text generation.
|
|
135
105
|
*/
|
|
136
|
-
completion(modelId: OpenAICompletionModelId
|
|
106
|
+
completion(modelId: OpenAICompletionModelId): LanguageModelV2;
|
|
137
107
|
/**
|
|
138
108
|
Creates a model for text embeddings.
|
|
139
109
|
*/
|
|
@@ -151,11 +121,11 @@ interface OpenAIProvider extends ProviderV2 {
|
|
|
151
121
|
/**
|
|
152
122
|
Creates a model for image generation.
|
|
153
123
|
*/
|
|
154
|
-
image(modelId: OpenAIImageModelId, settings?: OpenAIImageSettings):
|
|
124
|
+
image(modelId: OpenAIImageModelId, settings?: OpenAIImageSettings): ImageModelV2;
|
|
155
125
|
/**
|
|
156
126
|
Creates a model for image generation.
|
|
157
127
|
*/
|
|
158
|
-
imageModel(modelId: OpenAIImageModelId, settings?: OpenAIImageSettings):
|
|
128
|
+
imageModel(modelId: OpenAIImageModelId, settings?: OpenAIImageSettings): ImageModelV2;
|
|
159
129
|
/**
|
|
160
130
|
Creates a model for transcription.
|
|
161
131
|
*/
|