feat(Embeddings Cohere Node): Add v3 Cohere models (#9887)

This commit is contained in:
KhDu 2024-07-03 10:58:54 +03:00 committed by GitHub
parent 957b2d6108
commit 403e19b3e3
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -67,17 +67,33 @@ export class EmbeddingsCohere implements INodeType {
default: 'embed-english-v2.0',
options: [
{
name: 'Embed-English-v2.0(4096 Dimensions)',
value: 'embed-english-v2.0',
},
{
name: 'Embed-English-Light-v2.0(1024 Dimensions)',
name: 'Embed-English-Light-v2.0 (1024 Dimensions)',
value: 'embed-english-light-v2.0',
},
{
name: 'Embed-Multilingual-v2.0(768 Dimensions)',
name: 'Embed-English-Light-v3.0 (384 Dimensions)',
value: 'embed-english-light-v3.0',
},
{
name: 'Embed-English-v2.0 (4096 Dimensions)',
value: 'embed-english-v2.0',
},
{
name: 'Embed-English-v3.0 (1024 Dimensions)',
value: 'embed-english-v3.0',
},
{
name: 'Embed-Multilingual-Light-v3.0 (384 Dimensions)',
value: 'embed-multilingual-light-v3.0',
},
{
name: 'Embed-Multilingual-v2.0 (768 Dimensions)',
value: 'embed-multilingual-v2.0',
},
{
name: 'Embed-Multilingual-v3.0 (1024 Dimensions)',
value: 'embed-multilingual-v3.0',
},
],
},
],
@ -86,9 +102,9 @@ export class EmbeddingsCohere implements INodeType {
async supplyData(this: IExecuteFunctions, itemIndex: number): Promise<SupplyData> {
this.logger.verbose('Supply data for embeddings Cohere');
const modelName = this.getNodeParameter('modelName', itemIndex, 'embed-english-v2.0') as string;
const credentials = await this.getCredentials('cohereApi');
const credentials = (await this.getCredentials('cohereApi')) as { apiKey: string };
const embeddings = new CohereEmbeddings({
apiKey: credentials.apiKey as string,
apiKey: credentials.apiKey,
model: modelName,
});