Open History to see the last commit
1/**
2 * Provider options for Cohere embedding models.
3 *
4 * `dimensions` is deliberately absent: it's a first-class top-level option on
5 * `embed()` and is mapped to Cohere's `output_dimension` request field by the
6 * adapter.
7 */
8
9/**
10 * Provider options for `embed-v4.0`.
11 *
12 * `inputType` is required by Cohere's v2 embed API, which makes
13 * `modelOptions` required at the `embed()` call site.
14 */
15export interface CohereEmbeddingProviderOptions {
16 /**
17 * The intended downstream use of the embeddings. Cohere requires this to
18 * pick the right embedding space:
19 * - `search_document` — corpus items stored for later retrieval
20 * - `search_query` — queries run against stored documents
21 * - `classification` — inputs embedded for classification tasks
22 * - `clustering` — inputs embedded for clustering tasks
23 */
24 inputType:
25 | 'search_document'
26 | 'search_query'
27 | 'classification'
28 | 'clustering'
29
30 /**
31 * Requested embedding value encodings. The adapter always pins this to
32 * `['float']` so vectors are plain `number[]`; other encodings are not
33 * supported through TanStack AI.
34 */
35 embeddingTypes?: ['float']
36
37 /**
38 * How to handle inputs longer than the model's maximum token length.
39 * `NONE` returns an error for over-long inputs; `START`/`END` truncate
40 * from the respective side. Defaults to Cohere's server-side default
41 * (`END`) when omitted.
42 */
43 truncate?: 'NONE' | 'START' | 'END'
44}