Skip to content

Commit 8d327e4

Browse files
Expose dimensions parameter on Jina Embeddings (#3969)
* Expose dimensions parameter on Jina Embeddings * fix linting issue * update description text to refer to dimensions * Update JinaAIEmbedding.ts --------- Co-authored-by: Henry Heng <henryheng@flowiseai.com>
1 parent 7d125d5 commit 8d327e4

File tree

1 file changed

+12
-2
lines changed

1 file changed

+12
-2
lines changed

packages/components/nodes/embeddings/JinaAIEmbedding/JinaAIEmbedding.ts

+12-2
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ class JinaAIEmbedding_Embeddings implements INode {
1717
constructor() {
1818
this.label = 'Jina Embeddings'
1919
this.name = 'jinaEmbeddings'
20-
this.version = 1.0
20+
this.version = 2.0
2121
this.type = 'JinaEmbeddings'
2222
this.icon = 'JinaAIEmbedding.svg'
2323
this.category = 'Embeddings'
@@ -36,18 +36,28 @@ class JinaAIEmbedding_Embeddings implements INode {
3636
type: 'string',
3737
default: 'jina-embeddings-v2-base-en',
3838
description: 'Refer to <a href="https://jina.ai/embeddings/" target="_blank">JinaAI documentation</a> for available models'
39+
},
40+
{
41+
label: 'Dimensions',
42+
name: 'modelDimensions',
43+
type: 'number',
44+
default: 1024,
45+
description:
46+
'Refer to <a href="https://jina.ai/embeddings/" target="_blank">JinaAI documentation</a> for available dimensions'
3947
}
4048
]
4149
}
4250

4351
async init(nodeData: INodeData, _: string, options: ICommonObject): Promise<any> {
4452
const modelName = nodeData.inputs?.modelName as string
53+
const modelDimensions = nodeData.inputs?.modelDimensions as number
4554
const credentialData = await getCredentialData(nodeData.credential ?? '', options)
4655
const apiKey = getCredentialParam('jinaAIAPIKey', credentialData, nodeData)
4756

4857
const model = new JinaEmbeddings({
4958
apiKey: apiKey,
50-
model: modelName
59+
model: modelName,
60+
dimensions: modelDimensions
5161
})
5262

5363
return model

0 commit comments

Comments
 (0)