@ai-sdk/cohere 4.0.0-beta.5 → 4.0.0-beta.54
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 +405 -4
- package/README.md +2 -0
- package/dist/index.d.ts +4 -4
- package/dist/index.js +404 -272
- package/dist/index.js.map +1 -1
- package/docs/25-cohere.mdx +59 -4
- package/package.json +14 -14
- package/src/{cohere-chat-options.ts → cohere-chat-language-model-options.ts} +17 -3
- package/src/cohere-chat-language-model.ts +94 -24
- 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 -1067
- package/dist/index.mjs.map +0 -1
- /package/src/{cohere-embedding-options.ts → cohere-embedding-model-options.ts} +0 -0
package/dist/index.d.mts
DELETED
|
@@ -1,117 +0,0 @@
|
|
|
1
|
-
import { z } from 'zod/v4';
|
|
2
|
-
import { ProviderV4, LanguageModelV4, EmbeddingModelV4, RerankingModelV4 } from '@ai-sdk/provider';
|
|
3
|
-
import { FetchFunction } from '@ai-sdk/provider-utils';
|
|
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 cohereLanguageModelOptions: z.ZodObject<{
|
|
7
|
-
thinking: z.ZodOptional<z.ZodObject<{
|
|
8
|
-
type: z.ZodOptional<z.ZodEnum<{
|
|
9
|
-
enabled: "enabled";
|
|
10
|
-
disabled: "disabled";
|
|
11
|
-
}>>;
|
|
12
|
-
tokenBudget: z.ZodOptional<z.ZodNumber>;
|
|
13
|
-
}, z.core.$strip>>;
|
|
14
|
-
}, z.core.$strip>;
|
|
15
|
-
type CohereLanguageModelOptions = z.infer<typeof cohereLanguageModelOptions>;
|
|
16
|
-
|
|
17
|
-
type CohereRerankingModelId = 'rerank-v3.5' | 'rerank-english-v3.0' | 'rerank-multilingual-v3.0' | (string & {});
|
|
18
|
-
type CohereRerankingModelOptions = {
|
|
19
|
-
/**
|
|
20
|
-
* Long documents will be automatically truncated to the specified number of tokens.
|
|
21
|
-
*
|
|
22
|
-
* @default 4096
|
|
23
|
-
*/
|
|
24
|
-
maxTokensPerDoc?: number;
|
|
25
|
-
/**
|
|
26
|
-
* The priority of the request.
|
|
27
|
-
*
|
|
28
|
-
* @default 0
|
|
29
|
-
*/
|
|
30
|
-
priority?: number;
|
|
31
|
-
};
|
|
32
|
-
|
|
33
|
-
type CohereEmbeddingModelId = 'embed-english-v3.0' | 'embed-multilingual-v3.0' | 'embed-english-light-v3.0' | 'embed-multilingual-light-v3.0' | 'embed-english-v2.0' | 'embed-english-light-v2.0' | 'embed-multilingual-v2.0' | (string & {});
|
|
34
|
-
declare const cohereEmbeddingModelOptions: z.ZodObject<{
|
|
35
|
-
inputType: z.ZodOptional<z.ZodEnum<{
|
|
36
|
-
search_document: "search_document";
|
|
37
|
-
search_query: "search_query";
|
|
38
|
-
classification: "classification";
|
|
39
|
-
clustering: "clustering";
|
|
40
|
-
}>>;
|
|
41
|
-
truncate: z.ZodOptional<z.ZodEnum<{
|
|
42
|
-
NONE: "NONE";
|
|
43
|
-
START: "START";
|
|
44
|
-
END: "END";
|
|
45
|
-
}>>;
|
|
46
|
-
outputDimension: z.ZodOptional<z.ZodUnion<readonly [z.ZodLiteral<256>, z.ZodLiteral<512>, z.ZodLiteral<1024>, z.ZodLiteral<1536>]>>;
|
|
47
|
-
}, z.core.$strip>;
|
|
48
|
-
type CohereEmbeddingModelOptions = z.infer<typeof cohereEmbeddingModelOptions>;
|
|
49
|
-
|
|
50
|
-
interface CohereProvider extends ProviderV4 {
|
|
51
|
-
(modelId: CohereChatModelId): LanguageModelV4;
|
|
52
|
-
/**
|
|
53
|
-
* Creates a model for text generation.
|
|
54
|
-
*/
|
|
55
|
-
languageModel(modelId: CohereChatModelId): LanguageModelV4;
|
|
56
|
-
/**
|
|
57
|
-
* Creates a model for text embeddings.
|
|
58
|
-
*/
|
|
59
|
-
embedding(modelId: CohereEmbeddingModelId): EmbeddingModelV4;
|
|
60
|
-
/**
|
|
61
|
-
* Creates a model for text embeddings.
|
|
62
|
-
*/
|
|
63
|
-
embeddingModel(modelId: CohereEmbeddingModelId): EmbeddingModelV4;
|
|
64
|
-
/**
|
|
65
|
-
* @deprecated Use `embedding` instead.
|
|
66
|
-
*/
|
|
67
|
-
textEmbedding(modelId: CohereEmbeddingModelId): EmbeddingModelV4;
|
|
68
|
-
/**
|
|
69
|
-
* @deprecated Use `embeddingModel` instead.
|
|
70
|
-
*/
|
|
71
|
-
textEmbeddingModel(modelId: CohereEmbeddingModelId): EmbeddingModelV4;
|
|
72
|
-
/**
|
|
73
|
-
* Creates a model for reranking.
|
|
74
|
-
*/
|
|
75
|
-
reranking(modelId: CohereRerankingModelId): RerankingModelV4;
|
|
76
|
-
/**
|
|
77
|
-
* Creates a model for reranking.
|
|
78
|
-
*/
|
|
79
|
-
rerankingModel(modelId: CohereRerankingModelId): RerankingModelV4;
|
|
80
|
-
}
|
|
81
|
-
interface CohereProviderSettings {
|
|
82
|
-
/**
|
|
83
|
-
* Use a different URL prefix for API calls, e.g. to use proxy servers.
|
|
84
|
-
* The default prefix is `https://api.cohere.com/v2`.
|
|
85
|
-
*/
|
|
86
|
-
baseURL?: string;
|
|
87
|
-
/**
|
|
88
|
-
* API key that is being send using the `Authorization` header.
|
|
89
|
-
* It defaults to the `COHERE_API_KEY` environment variable.
|
|
90
|
-
*/
|
|
91
|
-
apiKey?: string;
|
|
92
|
-
/**
|
|
93
|
-
* Custom headers to include in the requests.
|
|
94
|
-
*/
|
|
95
|
-
headers?: Record<string, string>;
|
|
96
|
-
/**
|
|
97
|
-
* Custom fetch implementation. You can use it as a middleware to intercept requests,
|
|
98
|
-
* or to provide a custom fetch implementation for e.g. testing.
|
|
99
|
-
*/
|
|
100
|
-
fetch?: FetchFunction;
|
|
101
|
-
/**
|
|
102
|
-
* Optional function to generate a unique ID for each request.
|
|
103
|
-
*/
|
|
104
|
-
generateId?: () => string;
|
|
105
|
-
}
|
|
106
|
-
/**
|
|
107
|
-
* Create a Cohere AI provider instance.
|
|
108
|
-
*/
|
|
109
|
-
declare function createCohere(options?: CohereProviderSettings): CohereProvider;
|
|
110
|
-
/**
|
|
111
|
-
* Default Cohere provider instance.
|
|
112
|
-
*/
|
|
113
|
-
declare const cohere: CohereProvider;
|
|
114
|
-
|
|
115
|
-
declare const VERSION: string;
|
|
116
|
-
|
|
117
|
-
export { type CohereLanguageModelOptions as CohereChatModelOptions, type CohereEmbeddingModelOptions, type CohereLanguageModelOptions, type CohereProvider, type CohereProviderSettings, type CohereRerankingModelOptions, type CohereRerankingModelOptions as CohereRerankingOptions, VERSION, cohere, createCohere };
|