mirror of
https://github.com/farcasclaudiu/Flowise.git
synced 2026-06-28 19:00:59 +03:00
- update LangchainJS version
- add types & interfaces - small ui bug fix - update marketplace files
This commit is contained in:
@@ -1,5 +1,6 @@
|
||||
import { INode, INodeData, INodeParams } from '../../../src/Interface'
|
||||
import { getBaseClasses } from '../../../src/utils'
|
||||
import { OpenAIEmbeddings } from 'langchain/embeddings/openai'
|
||||
|
||||
class OpenAIEmbedding_Embeddings implements INode {
|
||||
label: string
|
||||
@@ -18,6 +19,7 @@ class OpenAIEmbedding_Embeddings implements INode {
|
||||
this.icon = 'openai.png'
|
||||
this.category = 'Embeddings'
|
||||
this.description = 'OpenAI API to generate embeddings for a given text'
|
||||
this.baseClasses = [this.type, ...getBaseClasses(OpenAIEmbeddings)]
|
||||
this.inputs = [
|
||||
{
|
||||
label: 'OpenAI Api Key',
|
||||
@@ -27,13 +29,7 @@ class OpenAIEmbedding_Embeddings implements INode {
|
||||
]
|
||||
}
|
||||
|
||||
async getBaseClasses(): Promise<string[]> {
|
||||
const { OpenAIEmbeddings } = await import('langchain/embeddings')
|
||||
return getBaseClasses(OpenAIEmbeddings)
|
||||
}
|
||||
|
||||
async init(nodeData: INodeData): Promise<any> {
|
||||
const { OpenAIEmbeddings } = await import('langchain/embeddings')
|
||||
const openAIApiKey = nodeData.inputs?.openAIApiKey as string
|
||||
|
||||
const model = new OpenAIEmbeddings({ openAIApiKey })
|
||||
|
||||
Reference in New Issue
Block a user