mirror of
https://github.com/farcasclaudiu/Flowise.git
synced 2026-06-28 15:00:57 +03:00
Merge branch 'main' into feature/Credential
# Conflicts: # README.md # docker/.env.example # packages/components/nodes/documentloaders/Notion/NotionDB.ts # packages/components/nodes/memory/DynamoDb/DynamoDb.ts # packages/components/nodes/memory/MotorheadMemory/MotorheadMemory.ts # packages/components/nodes/memory/ZepMemory/ZepMemory.ts # packages/components/package.json # packages/components/src/utils.ts # packages/server/.env.example # packages/server/README.md # packages/server/marketplaces/chatflows/Conversational Retrieval QA Chain.json # packages/server/src/ChildProcess.ts # packages/server/src/DataSource.ts # packages/server/src/commands/start.ts # packages/server/src/index.ts # packages/server/src/utils/index.ts # packages/server/src/utils/logger.ts
This commit is contained in:
@@ -17,7 +17,7 @@ class OpenAI_LLMs implements INode {
|
||||
this.label = 'OpenAI'
|
||||
this.name = 'openAI'
|
||||
this.type = 'OpenAI'
|
||||
this.icon = 'openai.svg'
|
||||
this.icon = 'openai.png'
|
||||
this.category = 'LLMs'
|
||||
this.description = 'Wrapper around OpenAI large language models'
|
||||
this.baseClasses = [this.type, ...getBaseClasses(OpenAI)]
|
||||
|
||||
Binary file not shown.
|
After Width: | Height: | Size: 3.9 KiB |
@@ -1 +0,0 @@
|
||||
<svg xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" viewBox="0,0,256,256" width="96px" height="96px" fill-rule="nonzero"><g fill="#00a67e" fill-rule="nonzero" stroke="none" stroke-width="1" stroke-linecap="butt" stroke-linejoin="miter" stroke-miterlimit="10" stroke-dasharray="" stroke-dashoffset="0" font-family="none" font-weight="none" font-size="none" text-anchor="none" style="mix-blend-mode: normal"><g transform="scale(10.66667,10.66667)"><path d="M11.13477,1.01758c-0.26304,-0.01259 -0.528,-0.00875 -0.79687,0.01563c-2.22436,0.20069 -4.00167,1.76087 -4.72852,3.78711c-1.71233,0.35652 -3.1721,1.48454 -3.9375,3.13672c-0.93789,2.02702 -0.47459,4.34373 0.91602,5.98633c-0.54763,1.66186 -0.30227,3.49111 0.74414,4.97852c1.28618,1.82589 3.52454,2.58282 5.64258,2.19922c1.16505,1.30652 2.87295,2.00936 4.6875,1.8457c2.22441,-0.2007 4.0017,-1.7608 4.72852,-3.78711c1.71235,-0.35654 3.17321,-1.4837 3.93945,-3.13672c0.93809,-2.0267 0.47529,-4.34583 -0.91602,-5.98828c0.54663,-1.66125 0.29983,-3.48985 -0.74609,-4.97656c-1.28618,-1.82589 -3.52454,-2.58282 -5.64258,-2.19922c-0.99242,-1.11291 -2.37852,-1.78893 -3.89062,-1.86133zM11.02539,2.51367c0.89653,0.03518 1.7296,0.36092 2.40625,0.9082c-0.11306,0.05604 -0.23154,0.09454 -0.3418,0.1582l-4.01367,2.31641c-0.306,0.176 -0.496,0.50247 -0.5,0.85547l-0.05859,5.48633l-1.76758,-1.04883v-4.4043c0,-2.136 1.55759,-4.04291 3.68359,-4.25391c0.19937,-0.01975 0.39689,-0.02523 0.5918,-0.01758zM16.125,4.25586c1.27358,0.00756 2.51484,0.5693 3.29297,1.6543c0.65289,0.90943 0.89227,1.99184 0.72852,3.03711c-0.10507,-0.06991 -0.19832,-0.15312 -0.30859,-0.2168l-4.01172,-2.31641c-0.306,-0.176 -0.68224,-0.17886 -0.99023,-0.00586l-4.7832,2.69531l0.02344,-2.05469l3.81445,-2.20117c0.69375,-0.4005 1.47022,-0.59633 2.23438,-0.5918zM5.2832,6.47266c-0.008,0.12587 -0.0332,0.24774 -0.0332,0.375v4.63281c0,0.353 0.18623,0.67938 0.49023,0.85938l4.72461,2.79688l-1.79102,1.00586l-3.81445,-2.20312c-1.85,-1.068 -2.7228,-3.37236 -1.8418,-5.31836c0.46198,-1.02041 1.27879,-1.76751 2.26562,-2.14844zM15.32617,7.85742l3.81445,2.20313c1.85,1.068 2.72475,3.37236 1.84375,5.31836c-0.46209,1.02065 -1.28043,1.7676 -2.26758,2.14844c0.00797,-0.12565 0.0332,-0.24797 0.0332,-0.375v-4.63086c0,-0.354 -0.18623,-0.68133 -0.49023,-0.86133l-4.72461,-2.79687zM12.02539,9.71094l1.96875,1.16797l-0.02734,2.28906l-1.99219,1.11914l-1.96875,-1.16601l0.02539,-2.28906zM15.48242,11.76172l1.76758,1.04883v4.4043c0,2.136 -1.55759,4.04291 -3.68359,4.25391c-1.11644,0.11059 -2.17429,-0.22435 -2.99805,-0.89062c0.11306,-0.05604 0.23154,-0.09454 0.3418,-0.1582l4.01367,-2.31641c0.306,-0.176 0.496,-0.50247 0.5,-0.85547zM13.94727,14.89648l-0.02344,2.05469l-3.81445,2.20117c-1.85,1.068 -4.28234,0.6735 -5.52734,-1.0625c-0.65289,-0.90943 -0.89227,-1.99184 -0.72852,-3.03711c0.10521,0.07006 0.19816,0.15299 0.30859,0.2168l4.01172,2.31641c0.306,0.176 0.68223,0.17886 0.99023,0.00586z"></path></g></g></svg>
|
||||
|
Before Width: | Height: | Size: 2.9 KiB |
@@ -0,0 +1,122 @@
|
||||
import { ICommonObject, INode, INodeData, INodeParams } from '../../../src/Interface'
|
||||
import { getBaseClasses, getCredentialData, getCredentialParam } from '../../../src/utils'
|
||||
import { Replicate, ReplicateInput } from 'langchain/llms/replicate'
|
||||
|
||||
class Replicate_LLMs implements INode {
|
||||
label: string
|
||||
name: string
|
||||
type: string
|
||||
icon: string
|
||||
category: string
|
||||
description: string
|
||||
baseClasses: string[]
|
||||
credential: INodeParams
|
||||
inputs: INodeParams[]
|
||||
|
||||
constructor() {
|
||||
this.label = 'Replicate'
|
||||
this.name = 'replicate'
|
||||
this.type = 'Replicate'
|
||||
this.icon = 'replicate.svg'
|
||||
this.category = 'LLMs'
|
||||
this.description = 'Use Replicate to run open source models on cloud'
|
||||
this.baseClasses = [this.type, 'BaseChatModel', ...getBaseClasses(Replicate)]
|
||||
this.credential = {
|
||||
label: 'Connect Credential',
|
||||
name: 'credential',
|
||||
type: 'credential',
|
||||
credentialNames: ['replicateApi']
|
||||
}
|
||||
this.inputs = [
|
||||
{
|
||||
label: 'Model',
|
||||
name: 'model',
|
||||
type: 'string',
|
||||
placeholder: 'a16z-infra/llama13b-v2-chat:df7690f1994d94e96ad9d568eac121aecf50684a0b0963b25a41cc40061269e5',
|
||||
optional: true
|
||||
},
|
||||
{
|
||||
label: 'Temperature',
|
||||
name: 'temperature',
|
||||
type: 'number',
|
||||
description:
|
||||
'Adjusts randomness of outputs, greater than 1 is random and 0 is deterministic, 0.75 is a good starting value.',
|
||||
default: 0.7,
|
||||
optional: true
|
||||
},
|
||||
{
|
||||
label: 'Max Tokens',
|
||||
name: 'maxTokens',
|
||||
type: 'number',
|
||||
description: 'Maximum number of tokens to generate. A word is generally 2-3 tokens',
|
||||
optional: true,
|
||||
additionalParams: true
|
||||
},
|
||||
{
|
||||
label: 'Top Probability',
|
||||
name: 'topP',
|
||||
type: 'number',
|
||||
description:
|
||||
'When decoding text, samples from the top p percentage of most likely tokens; lower to ignore less likely tokens',
|
||||
optional: true,
|
||||
additionalParams: true
|
||||
},
|
||||
{
|
||||
label: 'Repetition Penalty',
|
||||
name: 'repetitionPenalty',
|
||||
type: 'number',
|
||||
description:
|
||||
'Penalty for repeated words in generated text; 1 is no penalty, values greater than 1 discourage repetition, less than 1 encourage it. (minimum: 0.01; maximum: 5)',
|
||||
optional: true,
|
||||
additionalParams: true
|
||||
},
|
||||
{
|
||||
label: 'Additional Inputs',
|
||||
name: 'additionalInputs',
|
||||
type: 'json',
|
||||
description:
|
||||
'Each model has different parameters, refer to the specific model accepted inputs. For example: <a target="_blank" href="https://replicate.com/a16z-infra/llama13b-v2-chat/api#inputs">llama13b-v2</a>',
|
||||
additionalParams: true,
|
||||
optional: true
|
||||
}
|
||||
]
|
||||
}
|
||||
|
||||
async init(nodeData: INodeData, _: string, options: ICommonObject): Promise<any> {
|
||||
const modelName = nodeData.inputs?.model as string
|
||||
const temperature = nodeData.inputs?.temperature as string
|
||||
const maxTokens = nodeData.inputs?.maxTokens as string
|
||||
const topP = nodeData.inputs?.topP as string
|
||||
const repetitionPenalty = nodeData.inputs?.repetitionPenalty as string
|
||||
const additionalInputs = nodeData.inputs?.additionalInputs as string
|
||||
|
||||
const credentialData = await getCredentialData(nodeData.credential ?? '', options)
|
||||
const apiKey = getCredentialParam('apiKey', credentialData, nodeData)
|
||||
|
||||
const version = modelName.split(':').pop()
|
||||
const name = modelName.split(':')[0].split('/').pop()
|
||||
const org = modelName.split(':')[0].split('/')[0]
|
||||
|
||||
const obj: ReplicateInput = {
|
||||
model: `${org}/${name}:${version}`,
|
||||
apiKey
|
||||
}
|
||||
|
||||
let inputs: any = {}
|
||||
if (maxTokens) inputs.max_length = parseInt(maxTokens, 10)
|
||||
if (temperature) inputs.temperature = parseFloat(temperature)
|
||||
if (topP) inputs.top_p = parseFloat(topP)
|
||||
if (repetitionPenalty) inputs.repetition_penalty = parseFloat(repetitionPenalty)
|
||||
if (additionalInputs) {
|
||||
const parsedInputs =
|
||||
typeof additionalInputs === 'object' ? additionalInputs : additionalInputs ? JSON.parse(additionalInputs) : {}
|
||||
inputs = { ...inputs, ...parsedInputs }
|
||||
}
|
||||
if (Object.keys(inputs).length) obj.input = inputs
|
||||
|
||||
const model = new Replicate(obj)
|
||||
return model
|
||||
}
|
||||
}
|
||||
|
||||
module.exports = { nodeClass: Replicate_LLMs }
|
||||
@@ -0,0 +1,7 @@
|
||||
<svg version="1.1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" x="0px" y="0px" viewBox="0 0 1000 1000" class="logo" xml:space="preserve">
|
||||
<g>
|
||||
<polygon points="1000,427.6 1000,540.6 603.4,540.6 603.4,1000 477,1000 477,427.6 "></polygon>
|
||||
<polygon points="1000,213.8 1000,327 364.8,327 364.8,1000 238.4,1000 238.4,213.8 "></polygon>
|
||||
<polygon points="1000,0 1000,113.2 126.4,113.2 126.4,1000 0,1000 0,0 "></polygon>
|
||||
</g>
|
||||
</svg>
|
||||
|
After Width: | Height: | Size: 476 B |
Reference in New Issue
Block a user