@ai-sdk/cohere 4.0.0-beta.9 → 4.0.0-canary.34
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 +219 -0
- package/README.md +2 -0
- package/dist/index.d.ts +4 -4
- package/dist/index.js +360 -264
- package/dist/index.js.map +1 -1
- package/docs/25-cohere.mdx +59 -2
- package/package.json +11 -9
- package/src/{cohere-chat-options.ts → cohere-chat-language-model-options.ts} +17 -3
- package/src/cohere-chat-language-model.ts +36 -16
- package/src/cohere-chat-prompt.ts +8 -1
- package/src/cohere-embedding-model.ts +23 -6
- package/src/cohere-prepare-tools.ts +3 -3
- package/src/cohere-provider.ts +8 -9
- package/src/convert-cohere-usage.ts +1 -1
- package/src/convert-to-cohere-chat-prompt.ts +119 -54
- package/src/index.ts +8 -6
- package/src/map-cohere-finish-reason.ts +1 -1
- package/src/reranking/{cohere-reranking-options.ts → cohere-reranking-model-options.ts} +5 -1
- package/src/reranking/cohere-reranking-model.ts +5 -6
- package/dist/index.d.mts +0 -117
- package/dist/index.mjs +0 -1102
- package/dist/index.mjs.map +0 -1
- /package/src/{cohere-embedding-options.ts → cohere-embedding-model-options.ts} +0 -0
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,224 @@
|
|
|
1
1
|
# @ai-sdk/cohere
|
|
2
2
|
|
|
3
|
+
## 4.0.0-canary.34
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- f2919d5: feat(provider/cohere): add support for passing images to Cohere models
|
|
8
|
+
|
|
9
|
+
## 4.0.0-canary.33
|
|
10
|
+
|
|
11
|
+
### Patch Changes
|
|
12
|
+
|
|
13
|
+
- 0c4c275: trigger initial canary release
|
|
14
|
+
- Updated dependencies [0c4c275]
|
|
15
|
+
- @ai-sdk/provider-utils@5.0.0-canary.31
|
|
16
|
+
- @ai-sdk/provider@4.0.0-canary.15
|
|
17
|
+
|
|
18
|
+
## 4.0.0-beta.32
|
|
19
|
+
|
|
20
|
+
### Major Changes
|
|
21
|
+
|
|
22
|
+
- 04e9009: chore: make provider implementations code patterns more consistent, including renaming certain exported symbols
|
|
23
|
+
|
|
24
|
+
For all externally exported symbols that were renamed, the old names continue to work via deprecated aliases.
|
|
25
|
+
|
|
26
|
+
### Patch Changes
|
|
27
|
+
|
|
28
|
+
- Updated dependencies [08d2129]
|
|
29
|
+
- @ai-sdk/provider-utils@5.0.0-beta.30
|
|
30
|
+
|
|
31
|
+
## 4.0.0-beta.31
|
|
32
|
+
|
|
33
|
+
### Patch Changes
|
|
34
|
+
|
|
35
|
+
- 9bd6512: feat(provider): change file part data property to be tagged with a type and remove the image part type
|
|
36
|
+
- 258c093: chore: ensure consistent import handling and avoid import duplicates or cycles
|
|
37
|
+
- Updated dependencies [9bd6512]
|
|
38
|
+
- Updated dependencies [258c093]
|
|
39
|
+
- Updated dependencies [b6783da]
|
|
40
|
+
- @ai-sdk/provider-utils@5.0.0-beta.29
|
|
41
|
+
- @ai-sdk/provider@4.0.0-beta.14
|
|
42
|
+
|
|
43
|
+
## 4.0.0-beta.30
|
|
44
|
+
|
|
45
|
+
### Patch Changes
|
|
46
|
+
|
|
47
|
+
- 9f0e36c: trigger release for all packages after provenance setup
|
|
48
|
+
- Updated dependencies [9f0e36c]
|
|
49
|
+
- @ai-sdk/provider@4.0.0-beta.13
|
|
50
|
+
- @ai-sdk/provider-utils@5.0.0-beta.28
|
|
51
|
+
|
|
52
|
+
## 4.0.0-beta.29
|
|
53
|
+
|
|
54
|
+
### Patch Changes
|
|
55
|
+
|
|
56
|
+
- 58a2ad7: fix: more precise default message for tool execution denial
|
|
57
|
+
- Updated dependencies [785fe16]
|
|
58
|
+
- Updated dependencies [67df0a0]
|
|
59
|
+
- Updated dependencies [befb78c]
|
|
60
|
+
- Updated dependencies [0458559]
|
|
61
|
+
- Updated dependencies [5852c0a]
|
|
62
|
+
- Updated dependencies [fc92055]
|
|
63
|
+
- @ai-sdk/provider-utils@5.0.0-beta.27
|
|
64
|
+
|
|
65
|
+
## 4.0.0-beta.28
|
|
66
|
+
|
|
67
|
+
### Patch Changes
|
|
68
|
+
|
|
69
|
+
- Updated dependencies [2e98477]
|
|
70
|
+
- @ai-sdk/provider-utils@5.0.0-beta.26
|
|
71
|
+
|
|
72
|
+
## 4.0.0-beta.27
|
|
73
|
+
|
|
74
|
+
### Patch Changes
|
|
75
|
+
|
|
76
|
+
- Updated dependencies [eea8d98]
|
|
77
|
+
- @ai-sdk/provider-utils@5.0.0-beta.25
|
|
78
|
+
|
|
79
|
+
## 4.0.0-beta.26
|
|
80
|
+
|
|
81
|
+
### Patch Changes
|
|
82
|
+
|
|
83
|
+
- Updated dependencies [f807e45]
|
|
84
|
+
- @ai-sdk/provider-utils@5.0.0-beta.24
|
|
85
|
+
|
|
86
|
+
## 4.0.0-beta.25
|
|
87
|
+
|
|
88
|
+
### Patch Changes
|
|
89
|
+
|
|
90
|
+
- Updated dependencies [350ea38]
|
|
91
|
+
- @ai-sdk/provider-utils@5.0.0-beta.23
|
|
92
|
+
|
|
93
|
+
## 4.0.0-beta.24
|
|
94
|
+
|
|
95
|
+
### Patch Changes
|
|
96
|
+
|
|
97
|
+
- Updated dependencies [083947b]
|
|
98
|
+
- @ai-sdk/provider-utils@5.0.0-beta.22
|
|
99
|
+
|
|
100
|
+
## 4.0.0-beta.23
|
|
101
|
+
|
|
102
|
+
### Patch Changes
|
|
103
|
+
|
|
104
|
+
- Updated dependencies [add1126]
|
|
105
|
+
- @ai-sdk/provider-utils@5.0.0-beta.21
|
|
106
|
+
|
|
107
|
+
## 4.0.0-beta.22
|
|
108
|
+
|
|
109
|
+
### Patch Changes
|
|
110
|
+
|
|
111
|
+
- b3976a2: Add workflow serialization support to all provider models.
|
|
112
|
+
|
|
113
|
+
**`@ai-sdk/provider-utils`:** New `serializeModel()` helper that extracts only serializable properties from a model instance, filtering out functions and objects containing functions. Third-party provider authors can use this to add workflow support to their own models.
|
|
114
|
+
|
|
115
|
+
**All providers:** `headers` is now optional in provider config types. This is non-breaking — existing code that passes `headers` continues to work. Custom provider implementations that construct model configs manually can now omit `headers`, which is useful when models are deserialized from a workflow step boundary where auth is provided separately.
|
|
116
|
+
|
|
117
|
+
All provider model classes now include `WORKFLOW_SERIALIZE` and `WORKFLOW_DESERIALIZE` static methods, enabling them to cross workflow step boundaries without serialization errors.
|
|
118
|
+
|
|
119
|
+
- Updated dependencies [b3976a2]
|
|
120
|
+
- Updated dependencies [ff5eba1]
|
|
121
|
+
- @ai-sdk/provider-utils@5.0.0-beta.20
|
|
122
|
+
- @ai-sdk/provider@4.0.0-beta.12
|
|
123
|
+
|
|
124
|
+
## 4.0.0-beta.21
|
|
125
|
+
|
|
126
|
+
### Major Changes
|
|
127
|
+
|
|
128
|
+
- ef992f8: Remove CommonJS exports from all packages. All packages are now ESM-only (`"type": "module"`). Consumers using `require()` must switch to ESM `import` syntax.
|
|
129
|
+
|
|
130
|
+
### Patch Changes
|
|
131
|
+
|
|
132
|
+
- Updated dependencies [ef992f8]
|
|
133
|
+
- @ai-sdk/provider@4.0.0-beta.11
|
|
134
|
+
- @ai-sdk/provider-utils@5.0.0-beta.19
|
|
135
|
+
|
|
136
|
+
## 4.0.0-beta.20
|
|
137
|
+
|
|
138
|
+
### Patch Changes
|
|
139
|
+
|
|
140
|
+
- 90e2d8a: chore: fix unused vars not being flagged by our lint tooling
|
|
141
|
+
- Updated dependencies [90e2d8a]
|
|
142
|
+
- @ai-sdk/provider-utils@5.0.0-beta.18
|
|
143
|
+
|
|
144
|
+
## 4.0.0-beta.19
|
|
145
|
+
|
|
146
|
+
### Patch Changes
|
|
147
|
+
|
|
148
|
+
- Updated dependencies [3ae1786]
|
|
149
|
+
- @ai-sdk/provider-utils@5.0.0-beta.17
|
|
150
|
+
|
|
151
|
+
## 4.0.0-beta.18
|
|
152
|
+
|
|
153
|
+
### Patch Changes
|
|
154
|
+
|
|
155
|
+
- Updated dependencies [176466a]
|
|
156
|
+
- @ai-sdk/provider@4.0.0-beta.10
|
|
157
|
+
- @ai-sdk/provider-utils@5.0.0-beta.16
|
|
158
|
+
|
|
159
|
+
## 4.0.0-beta.17
|
|
160
|
+
|
|
161
|
+
### Patch Changes
|
|
162
|
+
|
|
163
|
+
- Updated dependencies [e311194]
|
|
164
|
+
- @ai-sdk/provider@4.0.0-beta.9
|
|
165
|
+
- @ai-sdk/provider-utils@5.0.0-beta.15
|
|
166
|
+
|
|
167
|
+
## 4.0.0-beta.16
|
|
168
|
+
|
|
169
|
+
### Patch Changes
|
|
170
|
+
|
|
171
|
+
- Updated dependencies [34bd95d]
|
|
172
|
+
- Updated dependencies [008271d]
|
|
173
|
+
- @ai-sdk/provider@4.0.0-beta.8
|
|
174
|
+
- @ai-sdk/provider-utils@5.0.0-beta.14
|
|
175
|
+
|
|
176
|
+
## 4.0.0-beta.15
|
|
177
|
+
|
|
178
|
+
### Patch Changes
|
|
179
|
+
|
|
180
|
+
- Updated dependencies [b0c2869]
|
|
181
|
+
- Updated dependencies [7e26e81]
|
|
182
|
+
- @ai-sdk/provider-utils@5.0.0-beta.13
|
|
183
|
+
|
|
184
|
+
## 4.0.0-beta.14
|
|
185
|
+
|
|
186
|
+
### Patch Changes
|
|
187
|
+
|
|
188
|
+
- Updated dependencies [46d1149]
|
|
189
|
+
- @ai-sdk/provider-utils@5.0.0-beta.12
|
|
190
|
+
|
|
191
|
+
## 4.0.0-beta.13
|
|
192
|
+
|
|
193
|
+
### Patch Changes
|
|
194
|
+
|
|
195
|
+
- 6fd51c0: fix(provider): preserve error type prefix in getErrorMessage
|
|
196
|
+
- Updated dependencies [6fd51c0]
|
|
197
|
+
- @ai-sdk/provider-utils@5.0.0-beta.11
|
|
198
|
+
- @ai-sdk/provider@4.0.0-beta.7
|
|
199
|
+
|
|
200
|
+
## 4.0.0-beta.12
|
|
201
|
+
|
|
202
|
+
### Patch Changes
|
|
203
|
+
|
|
204
|
+
- c29a26f: feat(provider): add support for provider references and uploading files as supported per provider
|
|
205
|
+
- Updated dependencies [c29a26f]
|
|
206
|
+
- @ai-sdk/provider-utils@5.0.0-beta.10
|
|
207
|
+
- @ai-sdk/provider@4.0.0-beta.6
|
|
208
|
+
|
|
209
|
+
## 4.0.0-beta.11
|
|
210
|
+
|
|
211
|
+
### Patch Changes
|
|
212
|
+
|
|
213
|
+
- 38fc777: Add AI Gateway hint to provider READMEs
|
|
214
|
+
|
|
215
|
+
## 4.0.0-beta.10
|
|
216
|
+
|
|
217
|
+
### Patch Changes
|
|
218
|
+
|
|
219
|
+
- Updated dependencies [2e17091]
|
|
220
|
+
- @ai-sdk/provider-utils@5.0.0-beta.9
|
|
221
|
+
|
|
3
222
|
## 4.0.0-beta.9
|
|
4
223
|
|
|
5
224
|
### Patch Changes
|
package/README.md
CHANGED
|
@@ -2,6 +2,8 @@
|
|
|
2
2
|
|
|
3
3
|
The **[Cohere provider](https://ai-sdk.dev/providers/ai-sdk-providers/cohere)** for the [AI SDK](https://ai-sdk.dev/docs) contains language model support for the Cohere API.
|
|
4
4
|
|
|
5
|
+
> **Deploying to Vercel?** With Vercel's AI Gateway you can access Cohere (and hundreds of models from other providers) — no additional packages, API keys, or extra cost. [Get started with AI Gateway](https://vercel.com/ai-gateway).
|
|
6
|
+
|
|
5
7
|
## Setup
|
|
6
8
|
|
|
7
9
|
The Cohere provider is available in the `@ai-sdk/cohere` module. You can install it with
|
package/dist/index.d.ts
CHANGED
|
@@ -2,8 +2,8 @@ import { z } from 'zod/v4';
|
|
|
2
2
|
import { ProviderV4, LanguageModelV4, EmbeddingModelV4, RerankingModelV4 } from '@ai-sdk/provider';
|
|
3
3
|
import { FetchFunction } from '@ai-sdk/provider-utils';
|
|
4
4
|
|
|
5
|
-
type CohereChatModelId = 'command-a-03-2025' | 'command-a-reasoning-08-2025' | 'command-r7b-12-2024' | 'command-r-plus-04-2024' | 'command-r-plus' | 'command-r-08-2024' | 'command-r-03-2024' | 'command-r' | 'command' | 'command-nightly' | 'command-light' | 'command-light-nightly' | (string & {});
|
|
6
|
-
declare const
|
|
5
|
+
type CohereChatModelId = 'command-a-03-2025' | 'command-a-reasoning-08-2025' | 'command-a-vision-07-2025' | 'command-r7b-12-2024' | 'command-r-plus-04-2024' | 'command-r-plus' | 'command-r-08-2024' | 'command-r-03-2024' | 'command-r' | 'command' | 'command-nightly' | 'command-light' | 'command-light-nightly' | (string & {});
|
|
6
|
+
declare const cohereLanguageModelChatOptions: z.ZodObject<{
|
|
7
7
|
thinking: z.ZodOptional<z.ZodObject<{
|
|
8
8
|
type: z.ZodOptional<z.ZodEnum<{
|
|
9
9
|
enabled: "enabled";
|
|
@@ -12,7 +12,7 @@ declare const cohereLanguageModelOptions: z.ZodObject<{
|
|
|
12
12
|
tokenBudget: z.ZodOptional<z.ZodNumber>;
|
|
13
13
|
}, z.core.$strip>>;
|
|
14
14
|
}, z.core.$strip>;
|
|
15
|
-
type
|
|
15
|
+
type CohereLanguageModelChatOptions = z.infer<typeof cohereLanguageModelChatOptions>;
|
|
16
16
|
|
|
17
17
|
type CohereRerankingModelId = 'rerank-v3.5' | 'rerank-english-v3.0' | 'rerank-multilingual-v3.0' | (string & {});
|
|
18
18
|
type CohereRerankingModelOptions = {
|
|
@@ -114,4 +114,4 @@ declare const cohere: CohereProvider;
|
|
|
114
114
|
|
|
115
115
|
declare const VERSION: string;
|
|
116
116
|
|
|
117
|
-
export { type
|
|
117
|
+
export { type CohereLanguageModelChatOptions as CohereChatModelOptions, type CohereEmbeddingModelOptions, type CohereLanguageModelChatOptions, type CohereLanguageModelChatOptions as CohereLanguageModelOptions, type CohereProvider, type CohereProviderSettings, type CohereRerankingModelOptions, type CohereRerankingModelOptions as CohereRerankingOptions, VERSION, cohere, createCohere };
|