@memberjunction/ai-cohere 5.40.2 → 5.41.0
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/README.md +28 -2
- package/dist/index.d.ts +1 -0
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +1 -0
- package/dist/index.js.map +1 -1
- package/dist/models/CohereEmbedding.d.ts +49 -0
- package/dist/models/CohereEmbedding.d.ts.map +1 -0
- package/dist/models/CohereEmbedding.js +148 -0
- package/dist/models/CohereEmbedding.js.map +1 -0
- package/package.json +3 -3
package/README.md
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
# @memberjunction/ai-cohere
|
|
2
2
|
|
|
3
|
-
MemberJunction AI provider for Cohere
|
|
3
|
+
MemberJunction AI provider for Cohere. It implements `BaseReranker` for semantic document reranking (Cohere Rerank API) and `BaseEmbeddings` for text and multimodal embeddings (Cohere Embed v4), useful for improving relevance and powering retrieval in RAG (Retrieval-Augmented Generation) pipelines.
|
|
4
4
|
|
|
5
5
|
## Architecture
|
|
6
6
|
|
|
@@ -28,6 +28,11 @@ graph TD
|
|
|
28
28
|
- **RAG Pipeline Integration**: Designed for use in retrieval-augmented generation workflows
|
|
29
29
|
- **Context-Aware**: Enhanced query processing for better relevance evaluation
|
|
30
30
|
|
|
31
|
+
### Embeddings (CohereEmbedding)
|
|
32
|
+
- **Multimodal Embeddings**: Embed text and images into a shared vector space (Cohere Embed v4)
|
|
33
|
+
- **Text and Batch**: Single and batch text embedding (1536-dim default)
|
|
34
|
+
- **Configurable Input Type**: Optimize embeddings for document storage or query retrieval
|
|
35
|
+
|
|
31
36
|
## Installation
|
|
32
37
|
|
|
33
38
|
```bash
|
|
@@ -57,6 +62,26 @@ for (const result of results) {
|
|
|
57
62
|
}
|
|
58
63
|
```
|
|
59
64
|
|
|
65
|
+
### Embeddings
|
|
66
|
+
|
|
67
|
+
```typescript
|
|
68
|
+
import { CohereEmbedding } from '@memberjunction/ai-cohere';
|
|
69
|
+
|
|
70
|
+
const embedding = new CohereEmbedding('your-cohere-api-key');
|
|
71
|
+
|
|
72
|
+
// Text (1536-dim vector)
|
|
73
|
+
const text = await embedding.EmbedText({ text: 'a golden retriever in the snow' });
|
|
74
|
+
|
|
75
|
+
// Multimodal: text + image fused into ONE vector
|
|
76
|
+
const multimodal = await embedding.EmbedContent({
|
|
77
|
+
content: [
|
|
78
|
+
{ type: 'text', content: 'product photo:' },
|
|
79
|
+
{ type: 'image_url', content: '<base64-image>', mimeType: 'image/png' },
|
|
80
|
+
],
|
|
81
|
+
});
|
|
82
|
+
console.log(multimodal.vector.length); // 1536
|
|
83
|
+
```
|
|
84
|
+
|
|
60
85
|
## Supported Models
|
|
61
86
|
|
|
62
87
|
| Model | Description |
|
|
@@ -66,7 +91,8 @@ for (const result of results) {
|
|
|
66
91
|
|
|
67
92
|
## Class Registration
|
|
68
93
|
|
|
69
|
-
Registered as `CohereLLM` via `@RegisterClass(BaseReranker, 'CohereLLM')`.
|
|
94
|
+
- `CohereReranker` -- Registered as `CohereLLM` via `@RegisterClass(BaseReranker, 'CohereLLM')`.
|
|
95
|
+
- `CohereEmbedding` -- Registered via `@RegisterClass(BaseEmbeddings, 'CohereEmbedding')`.
|
|
70
96
|
|
|
71
97
|
## Dependencies
|
|
72
98
|
|
package/dist/index.d.ts
CHANGED
package/dist/index.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAkCG;AAEH,OAAO,
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAkCG;AAEH,OAAO,EAAE,cAAc,EAAE,oBAAoB,EAAE,MAAM,yBAAyB,CAAC;AAE/E,OAAO,EAAE,eAAe,EAAE,MAAM,0BAA0B,CAAC"}
|
package/dist/index.js
CHANGED
package/dist/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAkCG;AAEH,OAAO,
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAkCG;AAEH,OAAO,EAAE,cAAc,EAAE,oBAAoB,EAAE,MAAM,yBAAyB,CAAC;AAE/E,OAAO,EAAE,eAAe,EAAE,MAAM,0BAA0B,CAAC"}
|
|
@@ -0,0 +1,49 @@
|
|
|
1
|
+
import { BaseEmbeddings, EmbedTextParams, EmbedTextResult, EmbedTextsParams, EmbedTextsResult, EmbedContentParams, EmbedContentResult, FileCapabilities } from '@memberjunction/ai';
|
|
2
|
+
import { CohereClient } from 'cohere-ai';
|
|
3
|
+
/** Describes an embedding model returned by {@link CohereEmbedding.GetEmbeddingModels}. */
|
|
4
|
+
export interface CohereEmbeddingModelInfo {
|
|
5
|
+
Model: string;
|
|
6
|
+
Description: string;
|
|
7
|
+
OutputDimension: number;
|
|
8
|
+
}
|
|
9
|
+
/**
|
|
10
|
+
* Cohere embedding provider for MemberJunction, backed by Cohere `embed-v4.0` via the v2 embed API.
|
|
11
|
+
*
|
|
12
|
+
* Supports the text-only `BaseEmbeddings` contract (`EmbedText`/`EmbedTexts`) and overrides
|
|
13
|
+
* `EmbedContent` for multimodal input (text + images fused into one vector). All three methods go
|
|
14
|
+
* through `client.v2.embed`, which accepts either `texts` (text) or `inputs` (structured content
|
|
15
|
+
* blocks for multimodal). Cohere's required `input_type` defaults to `search_document` and can be
|
|
16
|
+
* overridden via `SetAdditionalSettings({ inputType: '...' })`.
|
|
17
|
+
*
|
|
18
|
+
* Resolved via `ClassFactory.CreateInstance(BaseEmbeddings, "CohereEmbedding", apiKey)`.
|
|
19
|
+
*/
|
|
20
|
+
export declare class CohereEmbedding extends BaseEmbeddings {
|
|
21
|
+
private _client;
|
|
22
|
+
constructor(apiKey: string);
|
|
23
|
+
get CohereClient(): CohereClient;
|
|
24
|
+
/**
|
|
25
|
+
* Cohere embed-v4 accepts images via the v2 `inputs`/`image_url` path — and that path only
|
|
26
|
+
* supports PNG/JPEG/WebP/GIF (the API errors "only PNG, JPEG, WebP, and GIF are supported").
|
|
27
|
+
* Embed-v4's marketed PDF/document support isn't reachable here (it requires rendering pages to
|
|
28
|
+
* images / a different endpoint), so PDF is intentionally NOT declared — declaring it would pass
|
|
29
|
+
* client-side validation but fail at the API.
|
|
30
|
+
*/
|
|
31
|
+
GetFileCapabilities(): FileCapabilities | null;
|
|
32
|
+
EmbedText(params: EmbedTextParams): Promise<EmbedTextResult>;
|
|
33
|
+
EmbedTexts(params: EmbedTextsParams): Promise<EmbedTextsResult>;
|
|
34
|
+
/**
|
|
35
|
+
* Multimodal embed: text and/or images fused into ONE vector via Cohere's v2 `inputs`.
|
|
36
|
+
* Maps MJ content blocks to Cohere EmbedContent blocks. Returns an empty vector on error,
|
|
37
|
+
* consistent with EmbedText/EmbedTexts. (Error propagation + client-side mime validation are
|
|
38
|
+
* deferred pending the BaseEmbeddings error-handling decision.)
|
|
39
|
+
*/
|
|
40
|
+
EmbedContent(params: EmbedContentParams): Promise<EmbedContentResult>;
|
|
41
|
+
GetEmbeddingModels(): Promise<CohereEmbeddingModelInfo[]>;
|
|
42
|
+
/** Cohere's required input_type, overridable via AdditionalSettings; defaults to search_document. */
|
|
43
|
+
private get inputType();
|
|
44
|
+
/** Maps MJ ChatMessageContent to a Cohere EmbedInput (text + image_url blocks). */
|
|
45
|
+
private mapContentToEmbedInput;
|
|
46
|
+
/** Cohere accepts a base64 data URI or web URL; wrap raw base64 with its mime type. */
|
|
47
|
+
private toImageDataUrl;
|
|
48
|
+
}
|
|
49
|
+
//# sourceMappingURL=CohereEmbedding.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"CohereEmbedding.d.ts","sourceRoot":"","sources":["../../src/models/CohereEmbedding.ts"],"names":[],"mappings":"AACA,OAAO,EACH,cAAc,EACd,eAAe,EACf,eAAe,EACf,gBAAgB,EAChB,gBAAgB,EAChB,kBAAkB,EAClB,kBAAkB,EAGlB,gBAAgB,EAGnB,MAAM,oBAAoB,CAAC;AAC5B,OAAO,EAAE,YAAY,EAAU,MAAM,WAAW,CAAC;AASjD,2FAA2F;AAC3F,MAAM,WAAW,wBAAwB;IACrC,KAAK,EAAE,MAAM,CAAC;IACd,WAAW,EAAE,MAAM,CAAC;IACpB,eAAe,EAAE,MAAM,CAAC;CAC3B;AAED;;;;;;;;;;GAUG;AACH,qBACa,eAAgB,SAAQ,cAAc;IAC/C,OAAO,CAAC,OAAO,CAAe;gBAElB,MAAM,EAAE,MAAM;IAK1B,IAAW,YAAY,IAAI,YAAY,CAEtC;IAED;;;;;;OAMG;IACa,mBAAmB,IAAI,gBAAgB,GAAG,IAAI;IASjD,SAAS,CAAC,MAAM,EAAE,eAAe,GAAG,OAAO,CAAC,eAAe,CAAC;IAgB5D,UAAU,CAAC,MAAM,EAAE,gBAAgB,GAAG,OAAO,CAAC,gBAAgB,CAAC;IAgB5E;;;;;OAKG;IACmB,YAAY,CAAC,MAAM,EAAE,kBAAkB,GAAG,OAAO,CAAC,kBAAkB,CAAC;IAiB9E,kBAAkB,IAAI,OAAO,CAAC,wBAAwB,EAAE,CAAC;IAUtE,qGAAqG;IACrG,OAAO,KAAK,SAAS,GAGpB;IAED,mFAAmF;IACnF,OAAO,CAAC,sBAAsB;IAa9B,uFAAuF;IACvF,OAAO,CAAC,cAAc;CAMzB"}
|
|
@@ -0,0 +1,148 @@
|
|
|
1
|
+
var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
|
|
2
|
+
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
3
|
+
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
|
4
|
+
else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
|
5
|
+
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
6
|
+
};
|
|
7
|
+
var __metadata = (this && this.__metadata) || function (k, v) {
|
|
8
|
+
if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
|
|
9
|
+
};
|
|
10
|
+
import { RegisterClass } from '@memberjunction/global';
|
|
11
|
+
import { BaseEmbeddings, ModelUsage, ErrorAnalyzer, } from '@memberjunction/ai';
|
|
12
|
+
import { CohereClient } from 'cohere-ai';
|
|
13
|
+
/** Cohere's latest, natively multimodal embedding model (text + images → one vector space). */
|
|
14
|
+
const DEFAULT_MODEL = 'embed-v4.0';
|
|
15
|
+
/** Cohere requires an input_type for v3+ models; default to the document-storage use case. */
|
|
16
|
+
const DEFAULT_INPUT_TYPE = 'search_document';
|
|
17
|
+
/** embed-v4 default output dimensionality. */
|
|
18
|
+
const DEFAULT_DIMENSIONS = 1536;
|
|
19
|
+
/**
|
|
20
|
+
* Cohere embedding provider for MemberJunction, backed by Cohere `embed-v4.0` via the v2 embed API.
|
|
21
|
+
*
|
|
22
|
+
* Supports the text-only `BaseEmbeddings` contract (`EmbedText`/`EmbedTexts`) and overrides
|
|
23
|
+
* `EmbedContent` for multimodal input (text + images fused into one vector). All three methods go
|
|
24
|
+
* through `client.v2.embed`, which accepts either `texts` (text) or `inputs` (structured content
|
|
25
|
+
* blocks for multimodal). Cohere's required `input_type` defaults to `search_document` and can be
|
|
26
|
+
* overridden via `SetAdditionalSettings({ inputType: '...' })`.
|
|
27
|
+
*
|
|
28
|
+
* Resolved via `ClassFactory.CreateInstance(BaseEmbeddings, "CohereEmbedding", apiKey)`.
|
|
29
|
+
*/
|
|
30
|
+
let CohereEmbedding = class CohereEmbedding extends BaseEmbeddings {
|
|
31
|
+
constructor(apiKey) {
|
|
32
|
+
super(apiKey);
|
|
33
|
+
this._client = new CohereClient({ token: this.apiKey });
|
|
34
|
+
}
|
|
35
|
+
get CohereClient() {
|
|
36
|
+
return this._client;
|
|
37
|
+
}
|
|
38
|
+
/**
|
|
39
|
+
* Cohere embed-v4 accepts images via the v2 `inputs`/`image_url` path — and that path only
|
|
40
|
+
* supports PNG/JPEG/WebP/GIF (the API errors "only PNG, JPEG, WebP, and GIF are supported").
|
|
41
|
+
* Embed-v4's marketed PDF/document support isn't reachable here (it requires rendering pages to
|
|
42
|
+
* images / a different endpoint), so PDF is intentionally NOT declared — declaring it would pass
|
|
43
|
+
* client-side validation but fail at the API.
|
|
44
|
+
*/
|
|
45
|
+
GetFileCapabilities() {
|
|
46
|
+
return {
|
|
47
|
+
SupportedMimeTypes: ['image/png', 'image/jpeg', 'image/webp', 'image/gif'],
|
|
48
|
+
MaxFileSize: 5 * 1024 * 1024, // Cohere embed-v4: images up to 5 MB
|
|
49
|
+
MaxFilesPerRequest: 1,
|
|
50
|
+
HasFileAPI: false,
|
|
51
|
+
};
|
|
52
|
+
}
|
|
53
|
+
async EmbedText(params) {
|
|
54
|
+
const model = params.model || DEFAULT_MODEL;
|
|
55
|
+
try {
|
|
56
|
+
const response = await this._client.v2.embed({
|
|
57
|
+
model,
|
|
58
|
+
inputType: this.inputType,
|
|
59
|
+
embeddingTypes: ['float'],
|
|
60
|
+
texts: [params.text],
|
|
61
|
+
});
|
|
62
|
+
return { object: 'object', model, ModelUsage: new ModelUsage(0, 0), vector: response.embeddings.float?.[0] ?? [] };
|
|
63
|
+
}
|
|
64
|
+
catch (error) {
|
|
65
|
+
console.error('Cohere embedding error:', ErrorAnalyzer.analyzeError(error, 'Cohere'));
|
|
66
|
+
return { object: 'object', model, ModelUsage: new ModelUsage(0, 0), vector: [] };
|
|
67
|
+
}
|
|
68
|
+
}
|
|
69
|
+
async EmbedTexts(params) {
|
|
70
|
+
const model = params.model || DEFAULT_MODEL;
|
|
71
|
+
try {
|
|
72
|
+
const response = await this._client.v2.embed({
|
|
73
|
+
model,
|
|
74
|
+
inputType: this.inputType,
|
|
75
|
+
embeddingTypes: ['float'],
|
|
76
|
+
texts: params.texts,
|
|
77
|
+
});
|
|
78
|
+
return { object: 'list', model, ModelUsage: new ModelUsage(0, 0), vectors: response.embeddings.float ?? [] };
|
|
79
|
+
}
|
|
80
|
+
catch (error) {
|
|
81
|
+
console.error('Cohere embedding error:', ErrorAnalyzer.analyzeError(error, 'Cohere'));
|
|
82
|
+
return { object: 'list', model, ModelUsage: new ModelUsage(0, 0), vectors: [] };
|
|
83
|
+
}
|
|
84
|
+
}
|
|
85
|
+
/**
|
|
86
|
+
* Multimodal embed: text and/or images fused into ONE vector via Cohere's v2 `inputs`.
|
|
87
|
+
* Maps MJ content blocks to Cohere EmbedContent blocks. Returns an empty vector on error,
|
|
88
|
+
* consistent with EmbedText/EmbedTexts. (Error propagation + client-side mime validation are
|
|
89
|
+
* deferred pending the BaseEmbeddings error-handling decision.)
|
|
90
|
+
*/
|
|
91
|
+
async EmbedContent(params) {
|
|
92
|
+
const model = params.model || DEFAULT_MODEL;
|
|
93
|
+
try {
|
|
94
|
+
this.ValidateContentSupported(params.content);
|
|
95
|
+
const response = await this._client.v2.embed({
|
|
96
|
+
model,
|
|
97
|
+
inputType: this.inputType,
|
|
98
|
+
embeddingTypes: ['float'],
|
|
99
|
+
inputs: [this.mapContentToEmbedInput(params.content)],
|
|
100
|
+
});
|
|
101
|
+
return { object: 'object', model, ModelUsage: new ModelUsage(0, 0), vector: response.embeddings.float?.[0] ?? [] };
|
|
102
|
+
}
|
|
103
|
+
catch (error) {
|
|
104
|
+
console.error('Cohere embedding (content) error:', ErrorAnalyzer.analyzeError(error, 'Cohere'));
|
|
105
|
+
return { object: 'object', model, ModelUsage: new ModelUsage(0, 0), vector: [] };
|
|
106
|
+
}
|
|
107
|
+
}
|
|
108
|
+
async GetEmbeddingModels() {
|
|
109
|
+
return [
|
|
110
|
+
{
|
|
111
|
+
Model: DEFAULT_MODEL,
|
|
112
|
+
Description: 'Cohere Embed v4 — multimodal (text + image) embedding model',
|
|
113
|
+
OutputDimension: DEFAULT_DIMENSIONS,
|
|
114
|
+
},
|
|
115
|
+
];
|
|
116
|
+
}
|
|
117
|
+
/** Cohere's required input_type, overridable via AdditionalSettings; defaults to search_document. */
|
|
118
|
+
get inputType() {
|
|
119
|
+
const it = this._additionalSettings['inputType'];
|
|
120
|
+
return typeof it === 'string' ? it : DEFAULT_INPUT_TYPE;
|
|
121
|
+
}
|
|
122
|
+
/** Maps MJ ChatMessageContent to a Cohere EmbedInput (text + image_url blocks). */
|
|
123
|
+
mapContentToEmbedInput(content) {
|
|
124
|
+
if (typeof content === 'string') {
|
|
125
|
+
return { content: [{ type: 'text', text: content }] };
|
|
126
|
+
}
|
|
127
|
+
const blocks = content.map((block) => {
|
|
128
|
+
if (block.type === 'text') {
|
|
129
|
+
return { type: 'text', text: block.content };
|
|
130
|
+
}
|
|
131
|
+
return { type: 'image_url', imageUrl: { url: this.toImageDataUrl(block) } };
|
|
132
|
+
});
|
|
133
|
+
return { content: blocks };
|
|
134
|
+
}
|
|
135
|
+
/** Cohere accepts a base64 data URI or web URL; wrap raw base64 with its mime type. */
|
|
136
|
+
toImageDataUrl(block) {
|
|
137
|
+
if (block.content.startsWith('data:') || block.content.startsWith('http')) {
|
|
138
|
+
return block.content;
|
|
139
|
+
}
|
|
140
|
+
return `data:${block.mimeType || 'image/jpeg'};base64,${block.content}`;
|
|
141
|
+
}
|
|
142
|
+
};
|
|
143
|
+
CohereEmbedding = __decorate([
|
|
144
|
+
RegisterClass(BaseEmbeddings, 'CohereEmbedding'),
|
|
145
|
+
__metadata("design:paramtypes", [String])
|
|
146
|
+
], CohereEmbedding);
|
|
147
|
+
export { CohereEmbedding };
|
|
148
|
+
//# sourceMappingURL=CohereEmbedding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ACzB,CAAC;QACD,OAAO,QAAQ,KAAK,CAAC,QAAQ,IAAI,YAAY,WAAW,KAAK,CAAC,OAAO,EAAE,CAAC;IAC5E,CAAC;CACJ,CAAA;AAxHY,eAAe;IAD3B,aAAa,CAAC,cAAc,EAAE,iBAAiB,CAAC;;GACpC,eAAe,CAwH3B"}
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@memberjunction/ai-cohere",
|
|
3
3
|
"type": "module",
|
|
4
|
-
"version": "5.
|
|
4
|
+
"version": "5.41.0",
|
|
5
5
|
"description": "MemberJunction: Cohere AI Provider - Semantic reranking using Cohere's Rerank API",
|
|
6
6
|
"main": "dist/index.js",
|
|
7
7
|
"types": "dist/index.d.ts",
|
|
@@ -16,8 +16,8 @@
|
|
|
16
16
|
"author": "MemberJunction.com",
|
|
17
17
|
"license": "ISC",
|
|
18
18
|
"dependencies": {
|
|
19
|
-
"@memberjunction/ai": "5.
|
|
20
|
-
"@memberjunction/global": "5.
|
|
19
|
+
"@memberjunction/ai": "5.41.0",
|
|
20
|
+
"@memberjunction/global": "5.41.0",
|
|
21
21
|
"cohere-ai": "^7.20.0"
|
|
22
22
|
},
|
|
23
23
|
"devDependencies": {
|