mirror of
https://github.com/farcasclaudiu/Flowise.git
synced 2026-06-28 17:01:00 +03:00
Chore/LC v0.3 (#3517)
* bump langchain version to 0.3, upgrades on all chat models * update all docs loader to have documents and text output options * fix pnpm lock file
This commit is contained in:
@@ -1 +0,0 @@
|
||||
<svg width="32" height="32" fill="none" xmlns="http://www.w3.org/2000/svg"><path d="M15.991 28.555c1.064 0 1.926-.624 1.926-1.394V15.074h-3.852v12.087c0 .77.862 1.394 1.926 1.394Z" fill="#F9AB00" stroke="#F9AB00"/><path d="M23.01 16.825a6.301 6.301 0 0 0-6.606-1.467c-.322.117-.39.525-.148.767l7.294 7.294a.61.61 0 0 0 1.01-.238 6.3 6.3 0 0 0-1.55-6.356Z" fill="#5BB974" stroke="#5BB974"/><path d="M8.516 16.825a6.301 6.301 0 0 1 6.606-1.467c.322.117.39.525.148.767l-7.294 7.294a.61.61 0 0 1-1.01-.238 6.3 6.3 0 0 1 1.55-6.356Z" fill="#129EAF" stroke="#129EAF"/><path d="M22.433 10.781c-2.856 0-5.314 1.726-6.419 4.204-.139.312.102.647.443.647h11.62a.681.681 0 0 0 .613-.984c-1.17-2.296-3.532-3.867-6.258-3.867Z" fill="#AF5CF7" stroke="#AF5CF7"/><path d="M17.05 7.486c-2.02 2.02-2.538 4.977-1.567 7.51.122.32.53.386.77.145l8.218-8.217a.681.681 0 0 0-.262-1.13c-2.453-.795-5.233-.235-7.16 1.692Z" fill="#FF8BCB" stroke="#FF8BCB"/><path d="M14.476 7.486c2.02 2.02 2.538 4.977 1.566 7.51-.122.32-.529.386-.77.145L7.055 6.924a.681.681 0 0 1 .262-1.13C9.769 5 12.549 5.56 14.476 7.486Z" fill="#FA7B17" stroke="#FA7B17"/><path d="M9.093 10.781c2.856 0 5.314 1.726 6.418 4.204.14.312-.1.647-.442.647H3.449a.681.681 0 0 1-.613-.984c1.17-2.296 3.532-3.867 6.257-3.867Z" fill="#4285F4" stroke="#4285F4"/></svg>
|
||||
|
Before Width: | Height: | Size: 1.3 KiB |
@@ -1,67 +0,0 @@
|
||||
import { GooglePaLMEmbeddings, GooglePaLMEmbeddingsParams } from '@langchain/community/embeddings/googlepalm'
|
||||
import { ICommonObject, INode, INodeData, INodeOptionsValue, INodeParams } from '../../../src/Interface'
|
||||
import { getBaseClasses, getCredentialData, getCredentialParam } from '../../../src/utils'
|
||||
import { MODEL_TYPE, getModels } from '../../../src/modelLoader'
|
||||
|
||||
class GooglePaLMEmbedding_Embeddings implements INode {
|
||||
label: string
|
||||
name: string
|
||||
version: number
|
||||
type: string
|
||||
icon: string
|
||||
category: string
|
||||
description: string
|
||||
baseClasses: string[]
|
||||
credential: INodeParams
|
||||
inputs: INodeParams[]
|
||||
|
||||
constructor() {
|
||||
this.label = 'Google PaLM Embeddings'
|
||||
this.name = 'googlePaLMEmbeddings'
|
||||
this.version = 2.0
|
||||
this.type = 'GooglePaLMEmbeddings'
|
||||
this.icon = 'GooglePaLM.svg'
|
||||
this.category = 'Embeddings'
|
||||
this.description = 'Google MakerSuite PaLM API to generate embeddings for a given text'
|
||||
this.baseClasses = [this.type, ...getBaseClasses(GooglePaLMEmbeddings)]
|
||||
this.credential = {
|
||||
label: 'Connect Credential',
|
||||
name: 'credential',
|
||||
type: 'credential',
|
||||
credentialNames: ['googleMakerSuite']
|
||||
}
|
||||
this.inputs = [
|
||||
{
|
||||
label: 'Model Name',
|
||||
name: 'modelName',
|
||||
type: 'asyncOptions',
|
||||
loadMethod: 'listModels',
|
||||
default: 'models/embedding-gecko-001'
|
||||
}
|
||||
]
|
||||
}
|
||||
|
||||
//@ts-ignore
|
||||
loadMethods = {
|
||||
async listModels(): Promise<INodeOptionsValue[]> {
|
||||
return await getModels(MODEL_TYPE.EMBEDDING, 'googlePaLMEmbeddings')
|
||||
}
|
||||
}
|
||||
|
||||
async init(nodeData: INodeData, _: string, options: ICommonObject): Promise<any> {
|
||||
const modelName = nodeData.inputs?.modelName as string
|
||||
|
||||
const credentialData = await getCredentialData(nodeData.credential ?? '', options)
|
||||
const googleMakerSuiteKey = getCredentialParam('googleMakerSuiteKey', credentialData, nodeData)
|
||||
|
||||
const obj: Partial<GooglePaLMEmbeddingsParams> = {
|
||||
modelName: modelName,
|
||||
apiKey: googleMakerSuiteKey
|
||||
}
|
||||
|
||||
const model = new GooglePaLMEmbeddings(obj)
|
||||
return model
|
||||
}
|
||||
}
|
||||
|
||||
module.exports = { nodeClass: GooglePaLMEmbedding_Embeddings }
|
||||
+7
-7
@@ -1,5 +1,4 @@
|
||||
import { GoogleAuthOptions } from 'google-auth-library'
|
||||
import { GoogleVertexAIEmbeddings, GoogleVertexAIEmbeddingsParams } from '@langchain/community/embeddings/googlevertexai'
|
||||
import { VertexAIEmbeddings, GoogleVertexAIEmbeddingsInput } from '@langchain/google-vertexai'
|
||||
import { ICommonObject, INode, INodeData, INodeOptionsValue, INodeParams } from '../../../src/Interface'
|
||||
import { getBaseClasses, getCredentialData, getCredentialParam } from '../../../src/utils'
|
||||
import { MODEL_TYPE, getModels } from '../../../src/modelLoader'
|
||||
@@ -24,7 +23,7 @@ class GoogleVertexAIEmbedding_Embeddings implements INode {
|
||||
this.icon = 'GoogleVertex.svg'
|
||||
this.category = 'Embeddings'
|
||||
this.description = 'Google vertexAI API to generate embeddings for a given text'
|
||||
this.baseClasses = [this.type, ...getBaseClasses(GoogleVertexAIEmbeddings)]
|
||||
this.baseClasses = [this.type, ...getBaseClasses(VertexAIEmbeddings)]
|
||||
this.credential = {
|
||||
label: 'Connect Credential',
|
||||
name: 'credential',
|
||||
@@ -59,7 +58,7 @@ class GoogleVertexAIEmbedding_Embeddings implements INode {
|
||||
const googleApplicationCredential = getCredentialParam('googleApplicationCredential', credentialData, nodeData)
|
||||
const projectID = getCredentialParam('projectID', credentialData, nodeData)
|
||||
|
||||
const authOptions: GoogleAuthOptions = {}
|
||||
const authOptions: any = {}
|
||||
if (Object.keys(credentialData).length !== 0) {
|
||||
if (!googleApplicationCredentialFilePath && !googleApplicationCredential)
|
||||
throw new Error('Please specify your Google Application Credential')
|
||||
@@ -75,11 +74,12 @@ class GoogleVertexAIEmbedding_Embeddings implements INode {
|
||||
|
||||
if (projectID) authOptions.projectId = projectID
|
||||
}
|
||||
const obj: GoogleVertexAIEmbeddingsParams = {}
|
||||
if (modelName) obj.model = modelName
|
||||
const obj: GoogleVertexAIEmbeddingsInput = {
|
||||
model: modelName
|
||||
}
|
||||
if (Object.keys(authOptions).length !== 0) obj.authOptions = authOptions
|
||||
|
||||
const model = new GoogleVertexAIEmbeddings(obj)
|
||||
const model = new VertexAIEmbeddings(obj)
|
||||
return model
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user