Merge branch 'main' into feature/RAG-VectorStores-Updates
This commit is contained in:
commit
f151a77d3f
|
|
@ -1,6 +1,6 @@
|
||||||
{
|
{
|
||||||
"name": "flowise",
|
"name": "flowise",
|
||||||
"version": "1.4.9",
|
"version": "1.4.10",
|
||||||
"private": true,
|
"private": true,
|
||||||
"homepage": "https://flowiseai.com",
|
"homepage": "https://flowiseai.com",
|
||||||
"workspaces": [
|
"workspaces": [
|
||||||
|
|
@ -48,7 +48,7 @@
|
||||||
"pretty-quick": "^3.1.3",
|
"pretty-quick": "^3.1.3",
|
||||||
"rimraf": "^3.0.2",
|
"rimraf": "^3.0.2",
|
||||||
"run-script-os": "^1.1.6",
|
"run-script-os": "^1.1.6",
|
||||||
"turbo": "1.7.4",
|
"turbo": "^1.7.4",
|
||||||
"typescript": "^4.8.4"
|
"typescript": "^4.8.4"
|
||||||
},
|
},
|
||||||
"engines": {
|
"engines": {
|
||||||
|
|
|
||||||
|
|
@ -1,7 +1,9 @@
|
||||||
import { ICommonObject, INode, INodeData, INodeParams } from '../../../src/Interface'
|
import { ICommonObject, INode, INodeData, INodeParams } from '../../../src/Interface'
|
||||||
import { getBaseClasses, getCredentialData, getCredentialParam } from '../../../src/utils'
|
import { convertMultiOptionsToStringArray, getBaseClasses, getCredentialData, getCredentialParam } from '../../../src/utils'
|
||||||
import { BaseCache } from 'langchain/schema'
|
import { BaseCache } from 'langchain/schema'
|
||||||
import { ChatGoogleGenerativeAI } from '@langchain/google-genai'
|
import { ChatGoogleGenerativeAI, GoogleGenerativeAIChatInput } from '@langchain/google-genai'
|
||||||
|
import { HarmBlockThreshold, HarmCategory } from '@google/generative-ai'
|
||||||
|
import type { SafetySetting } from '@google/generative-ai'
|
||||||
|
|
||||||
class GoogleGenerativeAI_ChatModels implements INode {
|
class GoogleGenerativeAI_ChatModels implements INode {
|
||||||
label: string
|
label: string
|
||||||
|
|
@ -74,6 +76,73 @@ class GoogleGenerativeAI_ChatModels implements INode {
|
||||||
step: 0.1,
|
step: 0.1,
|
||||||
optional: true,
|
optional: true,
|
||||||
additionalParams: true
|
additionalParams: true
|
||||||
|
},
|
||||||
|
{
|
||||||
|
label: 'Top Next Highest Probability Tokens',
|
||||||
|
name: 'topK',
|
||||||
|
type: 'number',
|
||||||
|
description: `Decode using top-k sampling: consider the set of top_k most probable tokens. Must be positive`,
|
||||||
|
step: 1,
|
||||||
|
optional: true,
|
||||||
|
additionalParams: true
|
||||||
|
},
|
||||||
|
{
|
||||||
|
label: 'Harm Category',
|
||||||
|
name: 'harmCategory',
|
||||||
|
type: 'multiOptions',
|
||||||
|
description:
|
||||||
|
'Refer to <a target="_blank" href="https://cloud.google.com/vertex-ai/docs/generative-ai/multimodal/configure-safety-attributes#safety_attribute_definitions">official guide</a> on how to use Harm Category',
|
||||||
|
options: [
|
||||||
|
{
|
||||||
|
label: 'Dangerous',
|
||||||
|
name: HarmCategory.HARM_CATEGORY_DANGEROUS_CONTENT
|
||||||
|
},
|
||||||
|
{
|
||||||
|
label: 'Harassment',
|
||||||
|
name: HarmCategory.HARM_CATEGORY_HARASSMENT
|
||||||
|
},
|
||||||
|
{
|
||||||
|
label: 'Hate Speech',
|
||||||
|
name: HarmCategory.HARM_CATEGORY_HATE_SPEECH
|
||||||
|
},
|
||||||
|
{
|
||||||
|
label: 'Sexually Explicit',
|
||||||
|
name: HarmCategory.HARM_CATEGORY_SEXUALLY_EXPLICIT
|
||||||
|
}
|
||||||
|
],
|
||||||
|
optional: true,
|
||||||
|
additionalParams: true
|
||||||
|
},
|
||||||
|
{
|
||||||
|
label: 'Harm Block Threshold',
|
||||||
|
name: 'harmBlockThreshold',
|
||||||
|
type: 'multiOptions',
|
||||||
|
description:
|
||||||
|
'Refer to <a target="_blank" href="https://cloud.google.com/vertex-ai/docs/generative-ai/multimodal/configure-safety-attributes#safety_setting_thresholds">official guide</a> on how to use Harm Block Threshold',
|
||||||
|
options: [
|
||||||
|
{
|
||||||
|
label: 'Low and Above',
|
||||||
|
name: HarmBlockThreshold.BLOCK_LOW_AND_ABOVE
|
||||||
|
},
|
||||||
|
{
|
||||||
|
label: 'Medium and Above',
|
||||||
|
name: HarmBlockThreshold.BLOCK_MEDIUM_AND_ABOVE
|
||||||
|
},
|
||||||
|
{
|
||||||
|
label: 'None',
|
||||||
|
name: HarmBlockThreshold.BLOCK_NONE
|
||||||
|
},
|
||||||
|
{
|
||||||
|
label: 'Only High',
|
||||||
|
name: HarmBlockThreshold.BLOCK_ONLY_HIGH
|
||||||
|
},
|
||||||
|
{
|
||||||
|
label: 'Threshold Unspecified',
|
||||||
|
name: HarmBlockThreshold.HARM_BLOCK_THRESHOLD_UNSPECIFIED
|
||||||
|
}
|
||||||
|
],
|
||||||
|
optional: true,
|
||||||
|
additionalParams: true
|
||||||
}
|
}
|
||||||
]
|
]
|
||||||
}
|
}
|
||||||
|
|
@ -86,9 +155,12 @@ class GoogleGenerativeAI_ChatModels implements INode {
|
||||||
const modelName = nodeData.inputs?.modelName as string
|
const modelName = nodeData.inputs?.modelName as string
|
||||||
const maxOutputTokens = nodeData.inputs?.maxOutputTokens as string
|
const maxOutputTokens = nodeData.inputs?.maxOutputTokens as string
|
||||||
const topP = nodeData.inputs?.topP as string
|
const topP = nodeData.inputs?.topP as string
|
||||||
|
const topK = nodeData.inputs?.topK as string
|
||||||
|
const harmCategory = nodeData.inputs?.harmCategory as string
|
||||||
|
const harmBlockThreshold = nodeData.inputs?.harmBlockThreshold as string
|
||||||
const cache = nodeData.inputs?.cache as BaseCache
|
const cache = nodeData.inputs?.cache as BaseCache
|
||||||
|
|
||||||
const obj = {
|
const obj: Partial<GoogleGenerativeAIChatInput> = {
|
||||||
apiKey: apiKey,
|
apiKey: apiKey,
|
||||||
modelName: modelName,
|
modelName: modelName,
|
||||||
maxOutputTokens: 2048
|
maxOutputTokens: 2048
|
||||||
|
|
@ -98,8 +170,23 @@ class GoogleGenerativeAI_ChatModels implements INode {
|
||||||
|
|
||||||
const model = new ChatGoogleGenerativeAI(obj)
|
const model = new ChatGoogleGenerativeAI(obj)
|
||||||
if (topP) model.topP = parseFloat(topP)
|
if (topP) model.topP = parseFloat(topP)
|
||||||
|
if (topK) model.topK = parseFloat(topK)
|
||||||
if (cache) model.cache = cache
|
if (cache) model.cache = cache
|
||||||
if (temperature) model.temperature = parseFloat(temperature)
|
if (temperature) model.temperature = parseFloat(temperature)
|
||||||
|
|
||||||
|
// Safety Settings
|
||||||
|
let harmCategories: string[] = convertMultiOptionsToStringArray(harmCategory)
|
||||||
|
let harmBlockThresholds: string[] = convertMultiOptionsToStringArray(harmBlockThreshold)
|
||||||
|
if (harmCategories.length != harmBlockThresholds.length)
|
||||||
|
throw new Error(`Harm Category & Harm Block Threshold are not the same length`)
|
||||||
|
const safetySettings: SafetySetting[] = harmCategories.map((harmCategory, index) => {
|
||||||
|
return {
|
||||||
|
category: harmCategory as HarmCategory,
|
||||||
|
threshold: harmBlockThresholds[index] as HarmBlockThreshold
|
||||||
|
}
|
||||||
|
})
|
||||||
|
if (safetySettings.length > 0) model.safetySettings = safetySettings
|
||||||
|
|
||||||
return model
|
return model
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -73,7 +73,11 @@ class CustomFunction_Utilities implements INode {
|
||||||
|
|
||||||
if (Object.keys(inputVars).length) {
|
if (Object.keys(inputVars).length) {
|
||||||
for (const item in inputVars) {
|
for (const item in inputVars) {
|
||||||
sandbox[`$${item}`] = inputVars[item]
|
let value = inputVars[item]
|
||||||
|
if (typeof value === 'string') {
|
||||||
|
value = handleEscapeCharacters(value, true)
|
||||||
|
}
|
||||||
|
sandbox[`$${item}`] = value
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -1,6 +1,6 @@
|
||||||
{
|
{
|
||||||
"name": "flowise-components",
|
"name": "flowise-components",
|
||||||
"version": "1.5.0",
|
"version": "1.5.1",
|
||||||
"description": "Flowiseai Components",
|
"description": "Flowiseai Components",
|
||||||
"main": "dist/src/index",
|
"main": "dist/src/index",
|
||||||
"types": "dist/src/index.d.ts",
|
"types": "dist/src/index.d.ts",
|
||||||
|
|
@ -26,6 +26,7 @@
|
||||||
"@gomomento/sdk": "^1.51.1",
|
"@gomomento/sdk": "^1.51.1",
|
||||||
"@gomomento/sdk-core": "^1.51.1",
|
"@gomomento/sdk-core": "^1.51.1",
|
||||||
"@google-ai/generativelanguage": "^0.2.1",
|
"@google-ai/generativelanguage": "^0.2.1",
|
||||||
|
"@google/generative-ai": "^0.1.3",
|
||||||
"@huggingface/inference": "^2.6.1",
|
"@huggingface/inference": "^2.6.1",
|
||||||
"@langchain/community": "^0.0.16",
|
"@langchain/community": "^0.0.16",
|
||||||
"@langchain/google-genai": "^0.0.6",
|
"@langchain/google-genai": "^0.0.6",
|
||||||
|
|
@ -37,7 +38,7 @@
|
||||||
"@supabase/supabase-js": "^2.29.0",
|
"@supabase/supabase-js": "^2.29.0",
|
||||||
"@types/js-yaml": "^4.0.5",
|
"@types/js-yaml": "^4.0.5",
|
||||||
"@types/jsdom": "^21.1.1",
|
"@types/jsdom": "^21.1.1",
|
||||||
"@upstash/redis": "^1.22.1",
|
"@upstash/redis": "1.22.1",
|
||||||
"@zilliz/milvus2-sdk-node": "^2.2.24",
|
"@zilliz/milvus2-sdk-node": "^2.2.24",
|
||||||
"apify-client": "^2.7.1",
|
"apify-client": "^2.7.1",
|
||||||
"axios": "1.6.2",
|
"axios": "1.6.2",
|
||||||
|
|
|
||||||
|
|
@ -673,3 +673,18 @@ export const convertBaseMessagetoIMessage = (messages: BaseMessage[]): IMessage[
|
||||||
}
|
}
|
||||||
return formatmessages
|
return formatmessages
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Convert MultiOptions String to String Array
|
||||||
|
* @param {string} inputString
|
||||||
|
* @returns {string[]}
|
||||||
|
*/
|
||||||
|
export const convertMultiOptionsToStringArray = (inputString: string): string[] => {
|
||||||
|
let ArrayString: string[] = []
|
||||||
|
try {
|
||||||
|
ArrayString = JSON.parse(inputString)
|
||||||
|
} catch (e) {
|
||||||
|
ArrayString = []
|
||||||
|
}
|
||||||
|
return ArrayString
|
||||||
|
}
|
||||||
|
|
|
||||||
|
|
@ -1,6 +1,6 @@
|
||||||
{
|
{
|
||||||
"name": "flowise",
|
"name": "flowise",
|
||||||
"version": "1.4.9",
|
"version": "1.4.10",
|
||||||
"description": "Flowiseai Server",
|
"description": "Flowiseai Server",
|
||||||
"main": "dist/index",
|
"main": "dist/index",
|
||||||
"types": "dist/index.d.ts",
|
"types": "dist/index.d.ts",
|
||||||
|
|
|
||||||
|
|
@ -1,6 +1,6 @@
|
||||||
{
|
{
|
||||||
"name": "flowise-ui",
|
"name": "flowise-ui",
|
||||||
"version": "1.4.6",
|
"version": "1.4.7",
|
||||||
"license": "SEE LICENSE IN LICENSE.md",
|
"license": "SEE LICENSE IN LICENSE.md",
|
||||||
"homepage": "https://flowiseai.com",
|
"homepage": "https://flowiseai.com",
|
||||||
"author": {
|
"author": {
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue